1# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
2
3# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
5# This file is free software; the Free Software Foundation
6# gives unlimited permission to copy and/or distribute it,
7# with or without modifications, as long as this notice is preserved.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12# PARTICULAR PURPOSE.
13
14m4_ifndef([AC_AUTOCONF_VERSION],
15  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
17[m4_warning([this file was generated for autoconf 2.67.
18You have another version of autoconf.  It may work, but is not guaranteed to.
19If you have problems, you may need to regenerate the build system entirely.
20To do so, use the procedure documented by the package, typically `autoreconf'.])])
21
22# codeset.m4 serial 4 (gettext-0.18)
23dnl Copyright (C) 2000-2002, 2006, 2008-2010 Free Software Foundation, Inc.
24dnl This file is free software; the Free Software Foundation
25dnl gives unlimited permission to copy and/or distribute it,
26dnl with or without modifications, as long as this notice is preserved.
27
28dnl From Bruno Haible.
29
30AC_DEFUN([AM_LANGINFO_CODESET],
31[
32  AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset],
33    [AC_TRY_LINK([#include <langinfo.h>],
34      [char* cs = nl_langinfo(CODESET); return !cs;],
35      [am_cv_langinfo_codeset=yes],
36      [am_cv_langinfo_codeset=no])
37    ])
38  if test $am_cv_langinfo_codeset = yes; then
39    AC_DEFINE([HAVE_LANGINFO_CODESET], [1],
40      [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
41  fi
42])
43
44# fcntl-o.m4 serial 1
45dnl Copyright (C) 2006, 2009-2010 Free Software Foundation, Inc.
46dnl This file is free software; the Free Software Foundation
47dnl gives unlimited permission to copy and/or distribute it,
48dnl with or without modifications, as long as this notice is preserved.
49
50dnl Written by Paul Eggert.
51
52# Test whether the flags O_NOATIME and O_NOFOLLOW actually work.
53# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise.
54# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise.
55AC_DEFUN([gl_FCNTL_O_FLAGS],
56[
57  dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW.
58  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
59  AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h],
60    [AC_RUN_IFELSE(
61       [AC_LANG_PROGRAM(
62          [[#include <sys/types.h>
63           #include <sys/stat.h>
64           #include <unistd.h>
65           #include <fcntl.h>
66           #ifndef O_NOATIME
67            #define O_NOATIME 0
68           #endif
69           #ifndef O_NOFOLLOW
70            #define O_NOFOLLOW 0
71           #endif
72           static int const constants[] =
73            {
74              O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND,
75              O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY
76            };
77          ]],
78          [[
79            int status = !constants;
80            {
81              static char const sym[] = "conftest.sym";
82              if (symlink (".", sym) != 0
83                  || close (open (sym, O_RDONLY | O_NOFOLLOW)) == 0)
84                status |= 32;
85              unlink (sym);
86            }
87            {
88              static char const file[] = "confdefs.h";
89              int fd = open (file, O_RDONLY | O_NOATIME);
90              char c;
91              struct stat st0, st1;
92              if (fd < 0
93                  || fstat (fd, &st0) != 0
94                  || sleep (1) != 0
95                  || read (fd, &c, 1) != 1
96                  || close (fd) != 0
97                  || stat (file, &st1) != 0
98                  || st0.st_atime != st1.st_atime)
99                status |= 64;
100            }
101            return status;]])],
102       [gl_cv_header_working_fcntl_h=yes],
103       [case $? in #(
104        32) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #(
105        64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #(
106        96) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #(
107         *) gl_cv_header_working_fcntl_h='no';;
108        esac],
109       [gl_cv_header_working_fcntl_h=cross-compiling])])
110
111  case $gl_cv_header_working_fcntl_h in #(
112  *O_NOATIME* | no | cross-compiling) ac_val=0;; #(
113  *) ac_val=1;;
114  esac
115  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val],
116    [Define to 1 if O_NOATIME works.])
117
118  case $gl_cv_header_working_fcntl_h in #(
119  *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #(
120  *) ac_val=1;;
121  esac
122  AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val],
123    [Define to 1 if O_NOFOLLOW works.])
124])
125
126# gettext.m4 serial 63 (gettext-0.18)
127dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
128dnl This file is free software; the Free Software Foundation
129dnl gives unlimited permission to copy and/or distribute it,
130dnl with or without modifications, as long as this notice is preserved.
131dnl
132dnl This file can can be used in projects which are not available under
133dnl the GNU General Public License or the GNU Library General Public
134dnl License but which still want to provide support for the GNU gettext
135dnl functionality.
136dnl Please note that the actual code of the GNU gettext library is covered
137dnl by the GNU Library General Public License, and the rest of the GNU
138dnl gettext package package is covered by the GNU General Public License.
139dnl They are *not* in the public domain.
140
141dnl Authors:
142dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
143dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
144
145dnl Macro to add for using GNU gettext.
146
147dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
148dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
149dnl    default (if it is not specified or empty) is 'no-libtool'.
150dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
151dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
152dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
153dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
154dnl    depending on --{enable,disable}-{shared,static} and on the presence of
155dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
156dnl    $(top_builddir)/intl/libintl.a will be created.
157dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
158dnl    implementations (in libc or libintl) without the ngettext() function
159dnl    will be ignored.  If NEEDSYMBOL is specified and is
160dnl    'need-formatstring-macros', then GNU gettext implementations that don't
161dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
162dnl INTLDIR is used to find the intl libraries.  If empty,
163dnl    the value `$(top_builddir)/intl/' is used.
164dnl
165dnl The result of the configuration is one of three cases:
166dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
167dnl    and used.
168dnl    Catalog format: GNU --> install in $(datadir)
169dnl    Catalog extension: .mo after installation, .gmo in source tree
170dnl 2) GNU gettext has been found in the system's C library.
171dnl    Catalog format: GNU --> install in $(datadir)
172dnl    Catalog extension: .mo after installation, .gmo in source tree
173dnl 3) No internationalization, always use English msgid.
174dnl    Catalog format: none
175dnl    Catalog extension: none
176dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
177dnl The use of .gmo is historical (it was needed to avoid overwriting the
178dnl GNU format catalogs when building on a platform with an X/Open gettext),
179dnl but we keep it in order not to force irrelevant filename changes on the
180dnl maintainers.
181dnl
182AC_DEFUN([AM_GNU_GETTEXT],
183[
184  dnl Argument checking.
185  ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
186    [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
187])])])])])
188  ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old],
189    [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])])
190  ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
191    [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
192])])])])
193  define([gt_included_intl],
194    ifelse([$1], [external],
195      ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]),
196      [yes]))
197  define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], []))
198  gt_NEEDS_INIT
199  AM_GNU_GETTEXT_NEED([$2])
200
201  AC_REQUIRE([AM_PO_SUBDIRS])dnl
202  ifelse(gt_included_intl, yes, [
203    AC_REQUIRE([AM_INTL_SUBDIR])dnl
204  ])
205
206  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
207  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
208  AC_REQUIRE([AC_LIB_RPATH])
209
210  dnl Sometimes libintl requires libiconv, so first search for libiconv.
211  dnl Ideally we would do this search only after the
212  dnl      if test "$USE_NLS" = "yes"; then
213  dnl        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
214  dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
215  dnl the configure script would need to contain the same shell code
216  dnl again, outside any 'if'. There are two solutions:
217  dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
218  dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
219  dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
220  dnl documented, we avoid it.
221  ifelse(gt_included_intl, yes, , [
222    AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
223  ])
224
225  dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
226  gt_INTL_MACOSX
227
228  dnl Set USE_NLS.
229  AC_REQUIRE([AM_NLS])
230
231  ifelse(gt_included_intl, yes, [
232    BUILD_INCLUDED_LIBINTL=no
233    USE_INCLUDED_LIBINTL=no
234  ])
235  LIBINTL=
236  LTLIBINTL=
237  POSUB=
238
239  dnl Add a version number to the cache macros.
240  case " $gt_needs " in
241    *" need-formatstring-macros "*) gt_api_version=3 ;;
242    *" need-ngettext "*) gt_api_version=2 ;;
243    *) gt_api_version=1 ;;
244  esac
245  gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
246  gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
247
248  dnl If we use NLS figure out what method
249  if test "$USE_NLS" = "yes"; then
250    gt_use_preinstalled_gnugettext=no
251    ifelse(gt_included_intl, yes, [
252      AC_MSG_CHECKING([whether included gettext is requested])
253      AC_ARG_WITH([included-gettext],
254        [  --with-included-gettext use the GNU gettext library included here],
255        nls_cv_force_use_gnu_gettext=$withval,
256        nls_cv_force_use_gnu_gettext=no)
257      AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
258
259      nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
260      if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
261    ])
262        dnl User does not insist on using GNU NLS library.  Figure out what
263        dnl to use.  If GNU gettext is available we use this.  Else we have
264        dnl to fall back to GNU NLS library.
265
266        if test $gt_api_version -ge 3; then
267          gt_revision_test_code='
268#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
269#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
270#endif
271changequote(,)dnl
272typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
273changequote([,])dnl
274'
275        else
276          gt_revision_test_code=
277        fi
278        if test $gt_api_version -ge 2; then
279          gt_expression_test_code=' + * ngettext ("", "", 0)'
280        else
281          gt_expression_test_code=
282        fi
283
284        AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
285         [AC_TRY_LINK([#include <libintl.h>
286$gt_revision_test_code
287extern int _nl_msg_cat_cntr;
288extern int *_nl_domain_bindings;],
289            [bindtextdomain ("", "");
290return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings],
291            [eval "$gt_func_gnugettext_libc=yes"],
292            [eval "$gt_func_gnugettext_libc=no"])])
293
294        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
295          dnl Sometimes libintl requires libiconv, so first search for libiconv.
296          ifelse(gt_included_intl, yes, , [
297            AM_ICONV_LINK
298          ])
299          dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
300          dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
301          dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
302          dnl even if libiconv doesn't exist.
303          AC_LIB_LINKFLAGS_BODY([intl])
304          AC_CACHE_CHECK([for GNU gettext in libintl],
305            [$gt_func_gnugettext_libintl],
306           [gt_save_CPPFLAGS="$CPPFLAGS"
307            CPPFLAGS="$CPPFLAGS $INCINTL"
308            gt_save_LIBS="$LIBS"
309            LIBS="$LIBS $LIBINTL"
310            dnl Now see whether libintl exists and does not depend on libiconv.
311            AC_TRY_LINK([#include <libintl.h>
312$gt_revision_test_code
313extern int _nl_msg_cat_cntr;
314extern
315#ifdef __cplusplus
316"C"
317#endif
318const char *_nl_expand_alias (const char *);],
319              [bindtextdomain ("", "");
320return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
321              [eval "$gt_func_gnugettext_libintl=yes"],
322              [eval "$gt_func_gnugettext_libintl=no"])
323            dnl Now see whether libintl exists and depends on libiconv.
324            if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
325              LIBS="$LIBS $LIBICONV"
326              AC_TRY_LINK([#include <libintl.h>
327$gt_revision_test_code
328extern int _nl_msg_cat_cntr;
329extern
330#ifdef __cplusplus
331"C"
332#endif
333const char *_nl_expand_alias (const char *);],
334                [bindtextdomain ("", "");
335return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
336               [LIBINTL="$LIBINTL $LIBICONV"
337                LTLIBINTL="$LTLIBINTL $LTLIBICONV"
338                eval "$gt_func_gnugettext_libintl=yes"
339               ])
340            fi
341            CPPFLAGS="$gt_save_CPPFLAGS"
342            LIBS="$gt_save_LIBS"])
343        fi
344
345        dnl If an already present or preinstalled GNU gettext() is found,
346        dnl use it.  But if this macro is used in GNU gettext, and GNU
347        dnl gettext is already preinstalled in libintl, we update this
348        dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
349        if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
350           || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
351                && test "$PACKAGE" != gettext-runtime \
352                && test "$PACKAGE" != gettext-tools; }; then
353          gt_use_preinstalled_gnugettext=yes
354        else
355          dnl Reset the values set by searching for libintl.
356          LIBINTL=
357          LTLIBINTL=
358          INCINTL=
359        fi
360
361    ifelse(gt_included_intl, yes, [
362        if test "$gt_use_preinstalled_gnugettext" != "yes"; then
363          dnl GNU gettext is not found in the C library.
364          dnl Fall back on included GNU gettext library.
365          nls_cv_use_gnu_gettext=yes
366        fi
367      fi
368
369      if test "$nls_cv_use_gnu_gettext" = "yes"; then
370        dnl Mark actions used to generate GNU NLS library.
371        BUILD_INCLUDED_LIBINTL=yes
372        USE_INCLUDED_LIBINTL=yes
373        LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD"
374        LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD"
375        LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
376      fi
377
378      CATOBJEXT=
379      if test "$gt_use_preinstalled_gnugettext" = "yes" \
380         || test "$nls_cv_use_gnu_gettext" = "yes"; then
381        dnl Mark actions to use GNU gettext tools.
382        CATOBJEXT=.gmo
383      fi
384    ])
385
386    if test -n "$INTL_MACOSX_LIBS"; then
387      if test "$gt_use_preinstalled_gnugettext" = "yes" \
388         || test "$nls_cv_use_gnu_gettext" = "yes"; then
389        dnl Some extra flags are needed during linking.
390        LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
391        LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
392      fi
393    fi
394
395    if test "$gt_use_preinstalled_gnugettext" = "yes" \
396       || test "$nls_cv_use_gnu_gettext" = "yes"; then
397      AC_DEFINE([ENABLE_NLS], [1],
398        [Define to 1 if translation of program messages to the user's native language
399   is requested.])
400    else
401      USE_NLS=no
402    fi
403  fi
404
405  AC_MSG_CHECKING([whether to use NLS])
406  AC_MSG_RESULT([$USE_NLS])
407  if test "$USE_NLS" = "yes"; then
408    AC_MSG_CHECKING([where the gettext function comes from])
409    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
410      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
411        gt_source="external libintl"
412      else
413        gt_source="libc"
414      fi
415    else
416      gt_source="included intl directory"
417    fi
418    AC_MSG_RESULT([$gt_source])
419  fi
420
421  if test "$USE_NLS" = "yes"; then
422
423    if test "$gt_use_preinstalled_gnugettext" = "yes"; then
424      if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
425        AC_MSG_CHECKING([how to link with libintl])
426        AC_MSG_RESULT([$LIBINTL])
427        AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
428      fi
429
430      dnl For backward compatibility. Some packages may be using this.
431      AC_DEFINE([HAVE_GETTEXT], [1],
432       [Define if the GNU gettext() function is already present or preinstalled.])
433      AC_DEFINE([HAVE_DCGETTEXT], [1],
434       [Define if the GNU dcgettext() function is already present or preinstalled.])
435    fi
436
437    dnl We need to process the po/ directory.
438    POSUB=po
439  fi
440
441  ifelse(gt_included_intl, yes, [
442    dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
443    dnl to 'yes' because some of the testsuite requires it.
444    if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
445      BUILD_INCLUDED_LIBINTL=yes
446    fi
447
448    dnl Make all variables we use known to autoconf.
449    AC_SUBST([BUILD_INCLUDED_LIBINTL])
450    AC_SUBST([USE_INCLUDED_LIBINTL])
451    AC_SUBST([CATOBJEXT])
452
453    dnl For backward compatibility. Some configure.ins may be using this.
454    nls_cv_header_intl=
455    nls_cv_header_libgt=
456
457    dnl For backward compatibility. Some Makefiles may be using this.
458    DATADIRNAME=share
459    AC_SUBST([DATADIRNAME])
460
461    dnl For backward compatibility. Some Makefiles may be using this.
462    INSTOBJEXT=.mo
463    AC_SUBST([INSTOBJEXT])
464
465    dnl For backward compatibility. Some Makefiles may be using this.
466    GENCAT=gencat
467    AC_SUBST([GENCAT])
468
469    dnl For backward compatibility. Some Makefiles may be using this.
470    INTLOBJS=
471    if test "$USE_INCLUDED_LIBINTL" = yes; then
472      INTLOBJS="\$(GETTOBJS)"
473    fi
474    AC_SUBST([INTLOBJS])
475
476    dnl Enable libtool support if the surrounding package wishes it.
477    INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
478    AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX])
479  ])
480
481  dnl For backward compatibility. Some Makefiles may be using this.
482  INTLLIBS="$LIBINTL"
483  AC_SUBST([INTLLIBS])
484
485  dnl Make all documented variables known to autoconf.
486  AC_SUBST([LIBINTL])
487  AC_SUBST([LTLIBINTL])
488  AC_SUBST([POSUB])
489])
490
491
492dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
493m4_define([gt_NEEDS_INIT],
494[
495  m4_divert_text([DEFAULTS], [gt_needs=])
496  m4_define([gt_NEEDS_INIT], [])
497])
498
499
500dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
501AC_DEFUN([AM_GNU_GETTEXT_NEED],
502[
503  m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
504])
505
506
507dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
508AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
509
510# glibc2.m4 serial 2
511dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc.
512dnl This file is free software; the Free Software Foundation
513dnl gives unlimited permission to copy and/or distribute it,
514dnl with or without modifications, as long as this notice is preserved.
515
516# Test for the GNU C Library, version 2.0 or newer.
517# From Bruno Haible.
518
519AC_DEFUN([gt_GLIBC2],
520  [
521    AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer],
522      [ac_cv_gnu_library_2],
523      [AC_EGREP_CPP([Lucky GNU user],
524        [
525#include <features.h>
526#ifdef __GNU_LIBRARY__
527 #if (__GLIBC__ >= 2)
528  Lucky GNU user
529 #endif
530#endif
531        ],
532        [ac_cv_gnu_library_2=yes],
533        [ac_cv_gnu_library_2=no])
534      ]
535    )
536    AC_SUBST([GLIBC2])
537    GLIBC2="$ac_cv_gnu_library_2"
538  ]
539)
540
541# glibc21.m4 serial 4
542dnl Copyright (C) 2000-2002, 2004, 2008-2010 Free Software Foundation, Inc.
543dnl This file is free software; the Free Software Foundation
544dnl gives unlimited permission to copy and/or distribute it,
545dnl with or without modifications, as long as this notice is preserved.
546
547# Test for the GNU C Library, version 2.1 or newer.
548# From Bruno Haible.
549
550AC_DEFUN([gl_GLIBC21],
551  [
552    AC_CACHE_CHECK([whether we are using the GNU C Library 2.1 or newer],
553      [ac_cv_gnu_library_2_1],
554      [AC_EGREP_CPP([Lucky GNU user],
555        [
556#include <features.h>
557#ifdef __GNU_LIBRARY__
558 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
559  Lucky GNU user
560 #endif
561#endif
562        ],
563        [ac_cv_gnu_library_2_1=yes],
564        [ac_cv_gnu_library_2_1=no])
565      ]
566    )
567    AC_SUBST([GLIBC21])
568    GLIBC21="$ac_cv_gnu_library_2_1"
569  ]
570)
571
572# Configure paths for GTK+
573# Owen Taylor     1997-2001
574
575dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
576dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES,
577dnl pass to pkg-config
578dnl
579AC_DEFUN([AM_PATH_GTK_2_0],
580[dnl
581dnl Get the cflags and libraries from pkg-config
582dnl
583AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
584		    , enable_gtktest=yes)
585
586  pkg_config_args=gtk+-2.0
587  for module in . $4
588  do
589      case "$module" in
590         gthread)
591             pkg_config_args="$pkg_config_args gthread-2.0"
592         ;;
593      esac
594  done
595
596  no_gtk=""
597
598  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
599
600  if test x$PKG_CONFIG != xno ; then
601    if pkg-config --atleast-pkgconfig-version 0.7 ; then
602      :
603    else
604      echo "*** pkg-config too old; version 0.7 or better required."
605      no_gtk=yes
606      PKG_CONFIG=no
607    fi
608  else
609    no_gtk=yes
610  fi
611
612  min_gtk_version=ifelse([$1], ,2.0.0,$1)
613  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
614
615  if test x$PKG_CONFIG != xno ; then
616    ## don't try to run the test against uninstalled libtool libs
617    if $PKG_CONFIG --uninstalled $pkg_config_args; then
618	  echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
619	  enable_gtktest=no
620    fi
621
622    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
623	  :
624    else
625	  no_gtk=yes
626    fi
627  fi
628
629  if test x"$no_gtk" = x ; then
630    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
631    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
632    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
633           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
634    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
635           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
636    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
637           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
638    if test "x$enable_gtktest" = "xyes" ; then
639      ac_save_CFLAGS="$CFLAGS"
640      ac_save_LIBS="$LIBS"
641      CFLAGS="$CFLAGS $GTK_CFLAGS"
642      LIBS="$GTK_LIBS $LIBS"
643dnl
644dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
645dnl checks the results of pkg-config to some extent)
646dnl
647      rm -f conf.gtktest
648      AC_TRY_RUN([
649#include <gtk/gtk.h>
650#include <stdio.h>
651#include <stdlib.h>
652
653int
654main ()
655{
656  int major, minor, micro;
657  char *tmp_version;
658
659  fclose (fopen ("conf.gtktest", "w"));
660
661  /* HP/UX 9 (%@#!) writes to sscanf strings */
662  tmp_version = g_strdup("$min_gtk_version");
663  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
664     printf("%s, bad version string\n", "$min_gtk_version");
665     exit(1);
666   }
667
668  if ((gtk_major_version != $gtk_config_major_version) ||
669      (gtk_minor_version != $gtk_config_minor_version) ||
670      (gtk_micro_version != $gtk_config_micro_version))
671    {
672      printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
673             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
674             gtk_major_version, gtk_minor_version, gtk_micro_version);
675      printf ("*** was found! If pkg-config was correct, then it is best\n");
676      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
677      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
678      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
679      printf("*** required on your system.\n");
680      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
681      printf("*** to point to the correct configuration files\n");
682    }
683  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
684	   (gtk_minor_version != GTK_MINOR_VERSION) ||
685           (gtk_micro_version != GTK_MICRO_VERSION))
686    {
687      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
688	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
689      printf("*** library (version %d.%d.%d)\n",
690	     gtk_major_version, gtk_minor_version, gtk_micro_version);
691    }
692  else
693    {
694      if ((gtk_major_version > major) ||
695        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
696        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
697      {
698        return 0;
699       }
700     else
701      {
702        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
703               gtk_major_version, gtk_minor_version, gtk_micro_version);
704        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
705	       major, minor, micro);
706        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
707        printf("***\n");
708        printf("*** If you have already installed a sufficiently new version, this error\n");
709        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
710        printf("*** being found. The easiest way to fix this is to remove the old version\n");
711        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
712        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
713        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
714        printf("*** so that the correct libraries are found at run-time))\n");
715      }
716    }
717  return 1;
718}
719],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
720       CFLAGS="$ac_save_CFLAGS"
721       LIBS="$ac_save_LIBS"
722     fi
723  fi
724  if test "x$no_gtk" = x ; then
725     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
726     ifelse([$2], , :, [$2])
727  else
728     AC_MSG_RESULT(no)
729     if test "$PKG_CONFIG" = "no" ; then
730       echo "*** A new enough version of pkg-config was not found."
731       echo "*** See http://pkgconfig.sourceforge.net"
732     else
733       if test -f conf.gtktest ; then
734        :
735       else
736          echo "*** Could not run GTK+ test program, checking why..."
737	  ac_save_CFLAGS="$CFLAGS"
738	  ac_save_LIBS="$LIBS"
739          CFLAGS="$CFLAGS $GTK_CFLAGS"
740          LIBS="$LIBS $GTK_LIBS"
741          AC_TRY_LINK([
742#include <gtk/gtk.h>
743#include <stdio.h>
744],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
745        [ echo "*** The test program compiled, but did not run. This usually means"
746          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
747          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
748          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
749          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
750          echo "*** is required on your system"
751	  echo "***"
752          echo "*** If you have an old version installed, it is best to remove it, although"
753          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
754        [ echo "*** The test program failed to compile or link. See the file config.log for the"
755          echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
756          CFLAGS="$ac_save_CFLAGS"
757          LIBS="$ac_save_LIBS"
758       fi
759     fi
760     GTK_CFLAGS=""
761     GTK_LIBS=""
762     ifelse([$3], , :, [$3])
763  fi
764  AC_SUBST(GTK_CFLAGS)
765  AC_SUBST(GTK_LIBS)
766  rm -f conf.gtktest
767])
768
769# iconv.m4 serial 11 (gettext-0.18.1)
770dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
771dnl This file is free software; the Free Software Foundation
772dnl gives unlimited permission to copy and/or distribute it,
773dnl with or without modifications, as long as this notice is preserved.
774
775dnl From Bruno Haible.
776
777AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
778[
779  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
780  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
781  AC_REQUIRE([AC_LIB_RPATH])
782
783  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
784  dnl accordingly.
785  AC_LIB_LINKFLAGS_BODY([iconv])
786])
787
788AC_DEFUN([AM_ICONV_LINK],
789[
790  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
791  dnl those with the standalone portable GNU libiconv installed).
792  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
793
794  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
795  dnl accordingly.
796  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
797
798  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
799  dnl because if the user has installed libiconv and not disabled its use
800  dnl via --without-libiconv-prefix, he wants to use it. The first
801  dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
802  am_save_CPPFLAGS="$CPPFLAGS"
803  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
804
805  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
806    am_cv_func_iconv="no, consider installing GNU libiconv"
807    am_cv_lib_iconv=no
808    AC_TRY_LINK([#include <stdlib.h>
809#include <iconv.h>],
810      [iconv_t cd = iconv_open("","");
811       iconv(cd,NULL,NULL,NULL,NULL);
812       iconv_close(cd);],
813      [am_cv_func_iconv=yes])
814    if test "$am_cv_func_iconv" != yes; then
815      am_save_LIBS="$LIBS"
816      LIBS="$LIBS $LIBICONV"
817      AC_TRY_LINK([#include <stdlib.h>
818#include <iconv.h>],
819        [iconv_t cd = iconv_open("","");
820         iconv(cd,NULL,NULL,NULL,NULL);
821         iconv_close(cd);],
822        [am_cv_lib_iconv=yes]
823        [am_cv_func_iconv=yes])
824      LIBS="$am_save_LIBS"
825    fi
826  ])
827  if test "$am_cv_func_iconv" = yes; then
828    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
829      dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
830      am_save_LIBS="$LIBS"
831      if test $am_cv_lib_iconv = yes; then
832        LIBS="$LIBS $LIBICONV"
833      fi
834      AC_TRY_RUN([
835#include <iconv.h>
836#include <string.h>
837int main ()
838{
839  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
840     returns.  */
841  {
842    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
843    if (cd_utf8_to_88591 != (iconv_t)(-1))
844      {
845        static const char input[] = "\342\202\254"; /* EURO SIGN */
846        char buf[10];
847        const char *inptr = input;
848        size_t inbytesleft = strlen (input);
849        char *outptr = buf;
850        size_t outbytesleft = sizeof (buf);
851        size_t res = iconv (cd_utf8_to_88591,
852                            (char **) &inptr, &inbytesleft,
853                            &outptr, &outbytesleft);
854        if (res == 0)
855          return 1;
856      }
857  }
858  /* Test against Solaris 10 bug: Failures are not distinguishable from
859     successful returns.  */
860  {
861    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
862    if (cd_ascii_to_88591 != (iconv_t)(-1))
863      {
864        static const char input[] = "\263";
865        char buf[10];
866        const char *inptr = input;
867        size_t inbytesleft = strlen (input);
868        char *outptr = buf;
869        size_t outbytesleft = sizeof (buf);
870        size_t res = iconv (cd_ascii_to_88591,
871                            (char **) &inptr, &inbytesleft,
872                            &outptr, &outbytesleft);
873        if (res == 0)
874          return 1;
875      }
876  }
877#if 0 /* This bug could be worked around by the caller.  */
878  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
879  {
880    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
881    if (cd_88591_to_utf8 != (iconv_t)(-1))
882      {
883        static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
884        char buf[50];
885        const char *inptr = input;
886        size_t inbytesleft = strlen (input);
887        char *outptr = buf;
888        size_t outbytesleft = sizeof (buf);
889        size_t res = iconv (cd_88591_to_utf8,
890                            (char **) &inptr, &inbytesleft,
891                            &outptr, &outbytesleft);
892        if ((int)res > 0)
893          return 1;
894      }
895  }
896#endif
897  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
898     provided.  */
899  if (/* Try standardized names.  */
900      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
901      /* Try IRIX, OSF/1 names.  */
902      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
903      /* Try AIX names.  */
904      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
905      /* Try HP-UX names.  */
906      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
907    return 1;
908  return 0;
909}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
910        [case "$host_os" in
911           aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
912           *)            am_cv_func_iconv_works="guessing yes" ;;
913         esac])
914      LIBS="$am_save_LIBS"
915    ])
916    case "$am_cv_func_iconv_works" in
917      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
918      *)   am_func_iconv=yes ;;
919    esac
920  else
921    am_func_iconv=no am_cv_lib_iconv=no
922  fi
923  if test "$am_func_iconv" = yes; then
924    AC_DEFINE([HAVE_ICONV], [1],
925      [Define if you have the iconv() function and it works.])
926  fi
927  if test "$am_cv_lib_iconv" = yes; then
928    AC_MSG_CHECKING([how to link with libiconv])
929    AC_MSG_RESULT([$LIBICONV])
930  else
931    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
932    dnl either.
933    CPPFLAGS="$am_save_CPPFLAGS"
934    LIBICONV=
935    LTLIBICONV=
936  fi
937  AC_SUBST([LIBICONV])
938  AC_SUBST([LTLIBICONV])
939])
940
941dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
942dnl avoid warnings like
943dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
944dnl This is tricky because of the way 'aclocal' is implemented:
945dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
946dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
947dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
948dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
949dnl   warnings.
950m4_define([gl_iconv_AC_DEFUN],
951  m4_version_prereq([2.64],
952    [[AC_DEFUN_ONCE(
953        [$1], [$2])]],
954    [[AC_DEFUN(
955        [$1], [$2])]]))
956gl_iconv_AC_DEFUN([AM_ICONV],
957[
958  AM_ICONV_LINK
959  if test "$am_cv_func_iconv" = yes; then
960    AC_MSG_CHECKING([for iconv declaration])
961    AC_CACHE_VAL([am_cv_proto_iconv], [
962      AC_TRY_COMPILE([
963#include <stdlib.h>
964#include <iconv.h>
965extern
966#ifdef __cplusplus
967"C"
968#endif
969#if defined(__STDC__) || defined(__cplusplus)
970size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
971#else
972size_t iconv();
973#endif
974], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
975      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);"])
976    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
977    AC_MSG_RESULT([
978         $am_cv_proto_iconv])
979    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
980      [Define as const if the declaration of iconv() needs const.])
981  fi
982])
983
984# intdiv0.m4 serial 3 (gettext-0.18)
985dnl Copyright (C) 2002, 2007-2010 Free Software Foundation, Inc.
986dnl This file is free software; the Free Software Foundation
987dnl gives unlimited permission to copy and/or distribute it,
988dnl with or without modifications, as long as this notice is preserved.
989
990dnl From Bruno Haible.
991
992AC_DEFUN([gt_INTDIV0],
993[
994  AC_REQUIRE([AC_PROG_CC])dnl
995  AC_REQUIRE([AC_CANONICAL_HOST])dnl
996
997  AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
998    gt_cv_int_divbyzero_sigfpe,
999    [
1000      gt_cv_int_divbyzero_sigfpe=
1001changequote(,)dnl
1002      case "$host_os" in
1003        macos* | darwin[6-9]* | darwin[1-9][0-9]*)
1004          # On MacOS X 10.2 or newer, just assume the same as when cross-
1005          # compiling. If we were to perform the real test, 1 Crash Report
1006          # dialog window would pop up.
1007          case "$host_cpu" in
1008            i[34567]86 | x86_64)
1009              gt_cv_int_divbyzero_sigfpe="guessing yes" ;;
1010          esac
1011          ;;
1012      esac
1013changequote([,])dnl
1014      if test -z "$gt_cv_int_divbyzero_sigfpe"; then
1015        AC_TRY_RUN([
1016#include <stdlib.h>
1017#include <signal.h>
1018
1019static void
1020sigfpe_handler (int sig)
1021{
1022  /* Exit with code 0 if SIGFPE, with code 1 if any other signal.  */
1023  exit (sig != SIGFPE);
1024}
1025
1026int x = 1;
1027int y = 0;
1028int z;
1029int nan;
1030
1031int main ()
1032{
1033  signal (SIGFPE, sigfpe_handler);
1034/* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP.  */
1035#if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
1036  signal (SIGTRAP, sigfpe_handler);
1037#endif
1038/* Linux/SPARC yields signal SIGILL.  */
1039#if defined (__sparc__) && defined (__linux__)
1040  signal (SIGILL, sigfpe_handler);
1041#endif
1042
1043  z = x / y;
1044  nan = y / y;
1045  exit (1);
1046}
1047], [gt_cv_int_divbyzero_sigfpe=yes], [gt_cv_int_divbyzero_sigfpe=no],
1048          [
1049            # Guess based on the CPU.
1050changequote(,)dnl
1051            case "$host_cpu" in
1052              alpha* | i[34567]86 | x86_64 | m68k | s390*)
1053                gt_cv_int_divbyzero_sigfpe="guessing yes";;
1054              *)
1055                gt_cv_int_divbyzero_sigfpe="guessing no";;
1056            esac
1057changequote([,])dnl
1058          ])
1059      fi
1060    ])
1061  case "$gt_cv_int_divbyzero_sigfpe" in
1062    *yes) value=1;;
1063    *) value=0;;
1064  esac
1065  AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value],
1066    [Define if integer division by zero raises signal SIGFPE.])
1067])
1068
1069# intl.m4 serial 17 (gettext-0.18)
1070dnl Copyright (C) 1995-2009 Free Software Foundation, Inc.
1071dnl This file is free software; the Free Software Foundation
1072dnl gives unlimited permission to copy and/or distribute it,
1073dnl with or without modifications, as long as this notice is preserved.
1074dnl
1075dnl This file can can be used in projects which are not available under
1076dnl the GNU General Public License or the GNU Library General Public
1077dnl License but which still want to provide support for the GNU gettext
1078dnl functionality.
1079dnl Please note that the actual code of the GNU gettext library is covered
1080dnl by the GNU Library General Public License, and the rest of the GNU
1081dnl gettext package package is covered by the GNU General Public License.
1082dnl They are *not* in the public domain.
1083
1084dnl Authors:
1085dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
1086dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2009.
1087
1088AC_PREREQ([2.52])
1089
1090dnl Checks for all prerequisites of the intl subdirectory,
1091dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
1092dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
1093AC_DEFUN([AM_INTL_SUBDIR],
1094[
1095  AC_REQUIRE([AC_PROG_INSTALL])dnl
1096  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
1097  AC_REQUIRE([AC_PROG_CC])dnl
1098  AC_REQUIRE([AC_CANONICAL_HOST])dnl
1099  AC_REQUIRE([gt_GLIBC2])dnl
1100  AC_REQUIRE([AC_PROG_RANLIB])dnl
1101  AC_REQUIRE([gl_VISIBILITY])dnl
1102  AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl
1103  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl
1104  AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
1105  AC_REQUIRE([gt_TYPE_WINT_T])dnl
1106  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
1107  AC_REQUIRE([gt_TYPE_INTMAX_T])
1108  AC_REQUIRE([gt_PRINTF_POSIX])
1109  AC_REQUIRE([gl_GLIBC21])dnl
1110  AC_REQUIRE([gl_XSIZE])dnl
1111  AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl
1112  AC_REQUIRE([gt_INTL_MACOSX])dnl
1113
1114  dnl Support for automake's --enable-silent-rules.
1115  case "$enable_silent_rules" in
1116    yes) INTL_DEFAULT_VERBOSITY=0;;
1117    no)  INTL_DEFAULT_VERBOSITY=1;;
1118    *)   INTL_DEFAULT_VERBOSITY=1;;
1119  esac
1120  AC_SUBST([INTL_DEFAULT_VERBOSITY])
1121
1122  AC_CHECK_TYPE([ptrdiff_t], ,
1123    [AC_DEFINE([ptrdiff_t], [long],
1124       [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
1125    ])
1126  AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
1127  AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \
1128    snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
1129
1130  dnl Use the _snprintf function only if it is declared (because on NetBSD it
1131  dnl is defined as a weak alias of snprintf; we prefer to use the latter).
1132  gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
1133  gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
1134
1135  dnl Use the *_unlocked functions only if they are declared.
1136  dnl (because some of them were defined without being declared in Solaris
1137  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
1138  dnl on Solaris 2.5.1 to run on Solaris 2.6).
1139  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
1140  gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
1141
1142  case $gt_cv_func_printf_posix in
1143    *yes) HAVE_POSIX_PRINTF=1 ;;
1144    *) HAVE_POSIX_PRINTF=0 ;;
1145  esac
1146  AC_SUBST([HAVE_POSIX_PRINTF])
1147  if test "$ac_cv_func_asprintf" = yes; then
1148    HAVE_ASPRINTF=1
1149  else
1150    HAVE_ASPRINTF=0
1151  fi
1152  AC_SUBST([HAVE_ASPRINTF])
1153  if test "$ac_cv_func_snprintf" = yes; then
1154    HAVE_SNPRINTF=1
1155  else
1156    HAVE_SNPRINTF=0
1157  fi
1158  AC_SUBST([HAVE_SNPRINTF])
1159  if test "$ac_cv_func_newlocale" = yes; then
1160    HAVE_NEWLOCALE=1
1161  else
1162    HAVE_NEWLOCALE=0
1163  fi
1164  AC_SUBST([HAVE_NEWLOCALE])
1165  if test "$ac_cv_func_wprintf" = yes; then
1166    HAVE_WPRINTF=1
1167  else
1168    HAVE_WPRINTF=0
1169  fi
1170  AC_SUBST([HAVE_WPRINTF])
1171
1172  AM_LANGINFO_CODESET
1173  gt_LC_MESSAGES
1174
1175  dnl Compilation on mingw and Cygwin needs special Makefile rules, because
1176  dnl 1. when we install a shared library, we must arrange to export
1177  dnl    auxiliary pointer variables for every exported variable,
1178  dnl 2. when we install a shared library and a static library simultaneously,
1179  dnl    the include file specifies __declspec(dllimport) and therefore we
1180  dnl    must arrange to define the auxiliary pointer variables for the
1181  dnl    exported variables _also_ in the static library.
1182  if test "$enable_shared" = yes; then
1183    case "$host_os" in
1184      mingw* | cygwin*) is_woe32dll=yes ;;
1185      *) is_woe32dll=no ;;
1186    esac
1187  else
1188    is_woe32dll=no
1189  fi
1190  WOE32DLL=$is_woe32dll
1191  AC_SUBST([WOE32DLL])
1192
1193  dnl On mingw and Cygwin, we can activate special Makefile rules which add
1194  dnl version information to the shared libraries and executables.
1195  case "$host_os" in
1196    mingw* | cygwin*) is_woe32=yes ;;
1197    *) is_woe32=no ;;
1198  esac
1199  WOE32=$is_woe32
1200  AC_SUBST([WOE32])
1201  if test $WOE32 = yes; then
1202    dnl Check for a program that compiles Windows resource files.
1203    AC_CHECK_TOOL([WINDRES], [windres])
1204  fi
1205
1206  dnl Determine whether when creating a library, "-lc" should be passed to
1207  dnl libtool or not. On many platforms, it is required for the libtool option
1208  dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool
1209  dnl in the *.la files - makes it impossible to create multithreaded programs,
1210  dnl because libtool also reorders the -lc to come before the -pthread, and
1211  dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>.
1212  case "$host_os" in
1213    hpux*) LTLIBC="" ;;
1214    *)     LTLIBC="-lc" ;;
1215  esac
1216  AC_SUBST([LTLIBC])
1217
1218  dnl Rename some macros and functions used for locking.
1219  AH_BOTTOM([
1220#define __libc_lock_t                   gl_lock_t
1221#define __libc_lock_define              gl_lock_define
1222#define __libc_lock_define_initialized  gl_lock_define_initialized
1223#define __libc_lock_init                gl_lock_init
1224#define __libc_lock_lock                gl_lock_lock
1225#define __libc_lock_unlock              gl_lock_unlock
1226#define __libc_lock_recursive_t                   gl_recursive_lock_t
1227#define __libc_lock_define_recursive              gl_recursive_lock_define
1228#define __libc_lock_define_initialized_recursive  gl_recursive_lock_define_initialized
1229#define __libc_lock_init_recursive                gl_recursive_lock_init
1230#define __libc_lock_lock_recursive                gl_recursive_lock_lock
1231#define __libc_lock_unlock_recursive              gl_recursive_lock_unlock
1232#define glthread_in_use  libintl_thread_in_use
1233#define glthread_lock_init_func     libintl_lock_init_func
1234#define glthread_lock_lock_func     libintl_lock_lock_func
1235#define glthread_lock_unlock_func   libintl_lock_unlock_func
1236#define glthread_lock_destroy_func  libintl_lock_destroy_func
1237#define glthread_rwlock_init_multithreaded     libintl_rwlock_init_multithreaded
1238#define glthread_rwlock_init_func              libintl_rwlock_init_func
1239#define glthread_rwlock_rdlock_multithreaded   libintl_rwlock_rdlock_multithreaded
1240#define glthread_rwlock_rdlock_func            libintl_rwlock_rdlock_func
1241#define glthread_rwlock_wrlock_multithreaded   libintl_rwlock_wrlock_multithreaded
1242#define glthread_rwlock_wrlock_func            libintl_rwlock_wrlock_func
1243#define glthread_rwlock_unlock_multithreaded   libintl_rwlock_unlock_multithreaded
1244#define glthread_rwlock_unlock_func            libintl_rwlock_unlock_func
1245#define glthread_rwlock_destroy_multithreaded  libintl_rwlock_destroy_multithreaded
1246#define glthread_rwlock_destroy_func           libintl_rwlock_destroy_func
1247#define glthread_recursive_lock_init_multithreaded     libintl_recursive_lock_init_multithreaded
1248#define glthread_recursive_lock_init_func              libintl_recursive_lock_init_func
1249#define glthread_recursive_lock_lock_multithreaded     libintl_recursive_lock_lock_multithreaded
1250#define glthread_recursive_lock_lock_func              libintl_recursive_lock_lock_func
1251#define glthread_recursive_lock_unlock_multithreaded   libintl_recursive_lock_unlock_multithreaded
1252#define glthread_recursive_lock_unlock_func            libintl_recursive_lock_unlock_func
1253#define glthread_recursive_lock_destroy_multithreaded  libintl_recursive_lock_destroy_multithreaded
1254#define glthread_recursive_lock_destroy_func           libintl_recursive_lock_destroy_func
1255#define glthread_once_func            libintl_once_func
1256#define glthread_once_singlethreaded  libintl_once_singlethreaded
1257#define glthread_once_multithreaded   libintl_once_multithreaded
1258])
1259])
1260
1261
1262dnl Checks for the core files of the intl subdirectory:
1263dnl   dcigettext.c
1264dnl   eval-plural.h
1265dnl   explodename.c
1266dnl   finddomain.c
1267dnl   gettextP.h
1268dnl   gmo.h
1269dnl   hash-string.h hash-string.c
1270dnl   l10nflist.c
1271dnl   libgnuintl.h.in (except the *printf stuff)
1272dnl   loadinfo.h
1273dnl   loadmsgcat.c
1274dnl   localealias.c
1275dnl   log.c
1276dnl   plural-exp.h plural-exp.c
1277dnl   plural.y
1278dnl Used by libglocale.
1279AC_DEFUN([gt_INTL_SUBDIR_CORE],
1280[
1281  AC_REQUIRE([AC_C_INLINE])dnl
1282  AC_REQUIRE([AC_TYPE_SIZE_T])dnl
1283  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
1284  AC_REQUIRE([AC_FUNC_ALLOCA])dnl
1285  AC_REQUIRE([AC_FUNC_MMAP])dnl
1286  AC_REQUIRE([gt_INTDIV0])dnl
1287  AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
1288  AC_REQUIRE([gt_INTTYPES_PRI])dnl
1289  AC_REQUIRE([gl_LOCK])dnl
1290
1291  AC_TRY_LINK(
1292    [int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }],
1293    [],
1294    [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1],
1295       [Define to 1 if the compiler understands __builtin_expect.])])
1296
1297  AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h])
1298  AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \
1299    stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \
1300    argz_stringify argz_next __fsetlocking])
1301
1302  dnl Use the *_unlocked functions only if they are declared.
1303  dnl (because some of them were defined without being declared in Solaris
1304  dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
1305  dnl on Solaris 2.5.1 to run on Solaris 2.6).
1306  dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
1307  gt_CHECK_DECL([feof_unlocked], [#include <stdio.h>])
1308  gt_CHECK_DECL([fgets_unlocked], [#include <stdio.h>])
1309
1310  AM_ICONV
1311
1312  dnl intl/plural.c is generated from intl/plural.y. It requires bison,
1313  dnl because plural.y uses bison specific features. It requires at least
1314  dnl bison-1.26 because earlier versions generate a plural.c that doesn't
1315  dnl compile.
1316  dnl bison is only needed for the maintainer (who touches plural.y). But in
1317  dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
1318  dnl the rule in general Makefile. Now, some people carelessly touch the
1319  dnl files or have a broken "make" program, hence the plural.c rule will
1320  dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
1321  dnl present or too old.
1322  AC_CHECK_PROGS([INTLBISON], [bison])
1323  if test -z "$INTLBISON"; then
1324    ac_verc_fail=yes
1325  else
1326    dnl Found it, now check the version.
1327    AC_MSG_CHECKING([version of bison])
1328changequote(<<,>>)dnl
1329    ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
1330    case $ac_prog_version in
1331      '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
1332      1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
1333changequote([,])dnl
1334         ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
1335      *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
1336    esac
1337    AC_MSG_RESULT([$ac_prog_version])
1338  fi
1339  if test $ac_verc_fail = yes; then
1340    INTLBISON=:
1341  fi
1342])
1343
1344
1345dnl gt_CHECK_DECL(FUNC, INCLUDES)
1346dnl Check whether a function is declared.
1347AC_DEFUN([gt_CHECK_DECL],
1348[
1349  AC_CACHE_CHECK([whether $1 is declared], [ac_cv_have_decl_$1],
1350    [AC_TRY_COMPILE([$2], [
1351#ifndef $1
1352  char *p = (char *) $1;
1353#endif
1354], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
1355  if test $ac_cv_have_decl_$1 = yes; then
1356    gt_value=1
1357  else
1358    gt_value=0
1359  fi
1360  AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
1361    [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
1362])
1363
1364# intlmacosx.m4 serial 3 (gettext-0.18)
1365dnl Copyright (C) 2004-2010 Free Software Foundation, Inc.
1366dnl This file is free software; the Free Software Foundation
1367dnl gives unlimited permission to copy and/or distribute it,
1368dnl with or without modifications, as long as this notice is preserved.
1369dnl
1370dnl This file can can be used in projects which are not available under
1371dnl the GNU General Public License or the GNU Library General Public
1372dnl License but which still want to provide support for the GNU gettext
1373dnl functionality.
1374dnl Please note that the actual code of the GNU gettext library is covered
1375dnl by the GNU Library General Public License, and the rest of the GNU
1376dnl gettext package package is covered by the GNU General Public License.
1377dnl They are *not* in the public domain.
1378
1379dnl Checks for special options needed on MacOS X.
1380dnl Defines INTL_MACOSX_LIBS.
1381AC_DEFUN([gt_INTL_MACOSX],
1382[
1383  dnl Check for API introduced in MacOS X 10.2.
1384  AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
1385    [gt_cv_func_CFPreferencesCopyAppValue],
1386    [gt_save_LIBS="$LIBS"
1387     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
1388     AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>],
1389       [CFPreferencesCopyAppValue(NULL, NULL)],
1390       [gt_cv_func_CFPreferencesCopyAppValue=yes],
1391       [gt_cv_func_CFPreferencesCopyAppValue=no])
1392     LIBS="$gt_save_LIBS"])
1393  if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
1394    AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
1395      [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
1396  fi
1397  dnl Check for API introduced in MacOS X 10.3.
1398  AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent],
1399    [gt_save_LIBS="$LIBS"
1400     LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
1401     AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();],
1402       [gt_cv_func_CFLocaleCopyCurrent=yes],
1403       [gt_cv_func_CFLocaleCopyCurrent=no])
1404     LIBS="$gt_save_LIBS"])
1405  if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
1406    AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1],
1407      [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
1408  fi
1409  INTL_MACOSX_LIBS=
1410  if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
1411    INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
1412  fi
1413  AC_SUBST([INTL_MACOSX_LIBS])
1414])
1415
1416# intmax.m4 serial 5 (gettext-0.18)
1417dnl Copyright (C) 2002-2005, 2008-2010 Free Software Foundation, Inc.
1418dnl This file is free software; the Free Software Foundation
1419dnl gives unlimited permission to copy and/or distribute it,
1420dnl with or without modifications, as long as this notice is preserved.
1421
1422dnl From Bruno Haible.
1423dnl Test whether the system has the 'intmax_t' type, but don't attempt to
1424dnl find a replacement if it is lacking.
1425
1426AC_DEFUN([gt_TYPE_INTMAX_T],
1427[
1428  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
1429  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
1430  AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t],
1431    [AC_TRY_COMPILE([
1432#include <stddef.h>
1433#include <stdlib.h>
1434#if HAVE_STDINT_H_WITH_UINTMAX
1435#include <stdint.h>
1436#endif
1437#if HAVE_INTTYPES_H_WITH_UINTMAX
1438#include <inttypes.h>
1439#endif
1440],     [intmax_t x = -1;
1441        return !x;],
1442       [gt_cv_c_intmax_t=yes],
1443       [gt_cv_c_intmax_t=no])])
1444  if test $gt_cv_c_intmax_t = yes; then
1445    AC_DEFINE([HAVE_INTMAX_T], [1],
1446      [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.])
1447  fi
1448])
1449
1450# inttypes-pri.m4 serial 6 (gettext-0.18)
1451dnl Copyright (C) 1997-2002, 2006, 2008-2010 Free Software Foundation, Inc.
1452dnl This file is free software; the Free Software Foundation
1453dnl gives unlimited permission to copy and/or distribute it,
1454dnl with or without modifications, as long as this notice is preserved.
1455
1456dnl From Bruno Haible.
1457
1458AC_PREREQ([2.52])
1459
1460# Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
1461# macros to non-string values.  This is the case on AIX 4.3.3.
1462
1463AC_DEFUN([gt_INTTYPES_PRI],
1464[
1465  AC_CHECK_HEADERS([inttypes.h])
1466  if test $ac_cv_header_inttypes_h = yes; then
1467    AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
1468      [gt_cv_inttypes_pri_broken],
1469      [
1470        AC_TRY_COMPILE([#include <inttypes.h>
1471#ifdef PRId32
1472char *p = PRId32;
1473#endif
1474], [], [gt_cv_inttypes_pri_broken=no], [gt_cv_inttypes_pri_broken=yes])
1475      ])
1476  fi
1477  if test "$gt_cv_inttypes_pri_broken" = yes; then
1478    AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1],
1479      [Define if <inttypes.h> exists and defines unusable PRI* macros.])
1480    PRI_MACROS_BROKEN=1
1481  else
1482    PRI_MACROS_BROKEN=0
1483  fi
1484  AC_SUBST([PRI_MACROS_BROKEN])
1485])
1486
1487# inttypes_h.m4 serial 9
1488dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc.
1489dnl This file is free software; the Free Software Foundation
1490dnl gives unlimited permission to copy and/or distribute it,
1491dnl with or without modifications, as long as this notice is preserved.
1492
1493dnl From Paul Eggert.
1494
1495# Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
1496# doesn't clash with <sys/types.h>, and declares uintmax_t.
1497
1498AC_DEFUN([gl_AC_HEADER_INTTYPES_H],
1499[
1500  AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h],
1501  [AC_TRY_COMPILE(
1502    [#include <sys/types.h>
1503#include <inttypes.h>],
1504    [uintmax_t i = (uintmax_t) -1; return !i;],
1505    [gl_cv_header_inttypes_h=yes],
1506    [gl_cv_header_inttypes_h=no])])
1507  if test $gl_cv_header_inttypes_h = yes; then
1508    AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1],
1509      [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
1510       and declares uintmax_t. ])
1511  fi
1512])
1513
1514# lcmessage.m4 serial 6 (gettext-0.18)
1515dnl Copyright (C) 1995-2002, 2004-2005, 2008-2010 Free Software Foundation,
1516dnl Inc.
1517dnl This file is free software; the Free Software Foundation
1518dnl gives unlimited permission to copy and/or distribute it,
1519dnl with or without modifications, as long as this notice is preserved.
1520dnl
1521dnl This file can can be used in projects which are not available under
1522dnl the GNU General Public License or the GNU Library General Public
1523dnl License but which still want to provide support for the GNU gettext
1524dnl functionality.
1525dnl Please note that the actual code of the GNU gettext library is covered
1526dnl by the GNU Library General Public License, and the rest of the GNU
1527dnl gettext package package is covered by the GNU General Public License.
1528dnl They are *not* in the public domain.
1529
1530dnl Authors:
1531dnl   Ulrich Drepper <drepper@cygnus.com>, 1995.
1532
1533# Check whether LC_MESSAGES is available in <locale.h>.
1534
1535AC_DEFUN([gt_LC_MESSAGES],
1536[
1537  AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES],
1538    [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1539       [gt_cv_val_LC_MESSAGES=yes], [gt_cv_val_LC_MESSAGES=no])])
1540  if test $gt_cv_val_LC_MESSAGES = yes; then
1541    AC_DEFINE([HAVE_LC_MESSAGES], [1],
1542      [Define if your <locale.h> file defines LC_MESSAGES.])
1543  fi
1544])
1545
1546# lib-ld.m4 serial 4 (gettext-0.18)
1547dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
1548dnl This file is free software; the Free Software Foundation
1549dnl gives unlimited permission to copy and/or distribute it,
1550dnl with or without modifications, as long as this notice is preserved.
1551
1552dnl Subroutines of libtool.m4,
1553dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
1554dnl with libtool.m4.
1555
1556dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
1557AC_DEFUN([AC_LIB_PROG_LD_GNU],
1558[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
1559[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
1560case `$LD -v 2>&1 </dev/null` in
1561*GNU* | *'with BFD'*)
1562  acl_cv_prog_gnu_ld=yes ;;
1563*)
1564  acl_cv_prog_gnu_ld=no ;;
1565esac])
1566with_gnu_ld=$acl_cv_prog_gnu_ld
1567])
1568
1569dnl From libtool-1.4. Sets the variable LD.
1570AC_DEFUN([AC_LIB_PROG_LD],
1571[AC_ARG_WITH([gnu-ld],
1572[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
1573test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
1574AC_REQUIRE([AC_PROG_CC])dnl
1575AC_REQUIRE([AC_CANONICAL_HOST])dnl
1576# Prepare PATH_SEPARATOR.
1577# The user is always right.
1578if test "${PATH_SEPARATOR+set}" != set; then
1579  echo "#! /bin/sh" >conf$$.sh
1580  echo  "exit 0"   >>conf$$.sh
1581  chmod +x conf$$.sh
1582  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
1583    PATH_SEPARATOR=';'
1584  else
1585    PATH_SEPARATOR=:
1586  fi
1587  rm -f conf$$.sh
1588fi
1589ac_prog=ld
1590if test "$GCC" = yes; then
1591  # Check if gcc -print-prog-name=ld gives a path.
1592  AC_MSG_CHECKING([for ld used by GCC])
1593  case $host in
1594  *-*-mingw*)
1595    # gcc leaves a trailing carriage return which upsets mingw
1596    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
1597  *)
1598    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
1599  esac
1600  case $ac_prog in
1601    # Accept absolute paths.
1602    [[\\/]* | [A-Za-z]:[\\/]*)]
1603      [re_direlt='/[^/][^/]*/\.\./']
1604      # Canonicalize the path of ld
1605      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
1606      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
1607        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
1608      done
1609      test -z "$LD" && LD="$ac_prog"
1610      ;;
1611  "")
1612    # If it fails, then pretend we aren't using GCC.
1613    ac_prog=ld
1614    ;;
1615  *)
1616    # If it is relative, then search for the first ld in PATH.
1617    with_gnu_ld=unknown
1618    ;;
1619  esac
1620elif test "$with_gnu_ld" = yes; then
1621  AC_MSG_CHECKING([for GNU ld])
1622else
1623  AC_MSG_CHECKING([for non-GNU ld])
1624fi
1625AC_CACHE_VAL([acl_cv_path_LD],
1626[if test -z "$LD"; then
1627  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
1628  for ac_dir in $PATH; do
1629    test -z "$ac_dir" && ac_dir=.
1630    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
1631      acl_cv_path_LD="$ac_dir/$ac_prog"
1632      # Check to see if the program is GNU ld.  I'd rather use --version,
1633      # but apparently some GNU ld's only accept -v.
1634      # Break only if it was the GNU/non-GNU ld that we prefer.
1635      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
1636      *GNU* | *'with BFD'*)
1637        test "$with_gnu_ld" != no && break ;;
1638      *)
1639        test "$with_gnu_ld" != yes && break ;;
1640      esac
1641    fi
1642  done
1643  IFS="$ac_save_ifs"
1644else
1645  acl_cv_path_LD="$LD" # Let the user override the test with a path.
1646fi])
1647LD="$acl_cv_path_LD"
1648if test -n "$LD"; then
1649  AC_MSG_RESULT([$LD])
1650else
1651  AC_MSG_RESULT([no])
1652fi
1653test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
1654AC_LIB_PROG_LD_GNU
1655])
1656
1657# lib-link.m4 serial 21 (gettext-0.18)
1658dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
1659dnl This file is free software; the Free Software Foundation
1660dnl gives unlimited permission to copy and/or distribute it,
1661dnl with or without modifications, as long as this notice is preserved.
1662
1663dnl From Bruno Haible.
1664
1665AC_PREREQ([2.54])
1666
1667dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
1668dnl the libraries corresponding to explicit and implicit dependencies.
1669dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
1670dnl augments the CPPFLAGS variable.
1671dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
1672dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
1673AC_DEFUN([AC_LIB_LINKFLAGS],
1674[
1675  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1676  AC_REQUIRE([AC_LIB_RPATH])
1677  pushdef([Name],[translit([$1],[./-], [___])])
1678  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1679                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1680  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
1681    AC_LIB_LINKFLAGS_BODY([$1], [$2])
1682    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
1683    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
1684    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
1685    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
1686  ])
1687  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
1688  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
1689  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
1690  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
1691  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1692  AC_SUBST([LIB]NAME)
1693  AC_SUBST([LTLIB]NAME)
1694  AC_SUBST([LIB]NAME[_PREFIX])
1695  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
1696  dnl results of this search when this library appears as a dependency.
1697  HAVE_LIB[]NAME=yes
1698  popdef([NAME])
1699  popdef([Name])
1700])
1701
1702dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
1703dnl searches for libname and the libraries corresponding to explicit and
1704dnl implicit dependencies, together with the specified include files and
1705dnl the ability to compile and link the specified testcode. The missing-message
1706dnl defaults to 'no' and may contain additional hints for the user.
1707dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
1708dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
1709dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
1710dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
1711dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
1712dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
1713AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
1714[
1715  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
1716  AC_REQUIRE([AC_LIB_RPATH])
1717  pushdef([Name],[translit([$1],[./-], [___])])
1718  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1719                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1720
1721  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
1722  dnl accordingly.
1723  AC_LIB_LINKFLAGS_BODY([$1], [$2])
1724
1725  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
1726  dnl because if the user has installed lib[]Name and not disabled its use
1727  dnl via --without-lib[]Name-prefix, he wants to use it.
1728  ac_save_CPPFLAGS="$CPPFLAGS"
1729  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
1730
1731  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
1732    ac_save_LIBS="$LIBS"
1733    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
1734    dnl because these -l options might require -L options that are present in
1735    dnl LIBS. -l options benefit only from the -L options listed before it.
1736    dnl Otherwise, add it to the front of LIBS, because it may be a static
1737    dnl library that depends on another static library that is present in LIBS.
1738    dnl Static libraries benefit only from the static libraries listed after
1739    dnl it.
1740    case " $LIB[]NAME" in
1741      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
1742      *)       LIBS="$LIB[]NAME $LIBS" ;;
1743    esac
1744    AC_TRY_LINK([$3], [$4],
1745      [ac_cv_lib[]Name=yes],
1746      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
1747    LIBS="$ac_save_LIBS"
1748  ])
1749  if test "$ac_cv_lib[]Name" = yes; then
1750    HAVE_LIB[]NAME=yes
1751    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
1752    AC_MSG_CHECKING([how to link with lib[]$1])
1753    AC_MSG_RESULT([$LIB[]NAME])
1754  else
1755    HAVE_LIB[]NAME=no
1756    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
1757    dnl $INC[]NAME either.
1758    CPPFLAGS="$ac_save_CPPFLAGS"
1759    LIB[]NAME=
1760    LTLIB[]NAME=
1761    LIB[]NAME[]_PREFIX=
1762  fi
1763  AC_SUBST([HAVE_LIB]NAME)
1764  AC_SUBST([LIB]NAME)
1765  AC_SUBST([LTLIB]NAME)
1766  AC_SUBST([LIB]NAME[_PREFIX])
1767  popdef([NAME])
1768  popdef([Name])
1769])
1770
1771dnl Determine the platform dependent parameters needed to use rpath:
1772dnl   acl_libext,
1773dnl   acl_shlibext,
1774dnl   acl_hardcode_libdir_flag_spec,
1775dnl   acl_hardcode_libdir_separator,
1776dnl   acl_hardcode_direct,
1777dnl   acl_hardcode_minus_L.
1778AC_DEFUN([AC_LIB_RPATH],
1779[
1780  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
1781  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
1782  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
1783  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
1784  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
1785  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
1786  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
1787    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
1788    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
1789    . ./conftest.sh
1790    rm -f ./conftest.sh
1791    acl_cv_rpath=done
1792  ])
1793  wl="$acl_cv_wl"
1794  acl_libext="$acl_cv_libext"
1795  acl_shlibext="$acl_cv_shlibext"
1796  acl_libname_spec="$acl_cv_libname_spec"
1797  acl_library_names_spec="$acl_cv_library_names_spec"
1798  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
1799  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
1800  acl_hardcode_direct="$acl_cv_hardcode_direct"
1801  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
1802  dnl Determine whether the user wants rpath handling at all.
1803  AC_ARG_ENABLE([rpath],
1804    [  --disable-rpath         do not hardcode runtime library paths],
1805    :, enable_rpath=yes)
1806])
1807
1808dnl AC_LIB_FROMPACKAGE(name, package)
1809dnl declares that libname comes from the given package. The configure file
1810dnl will then not have a --with-libname-prefix option but a
1811dnl --with-package-prefix option. Several libraries can come from the same
1812dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
1813dnl macro call that searches for libname.
1814AC_DEFUN([AC_LIB_FROMPACKAGE],
1815[
1816  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1817                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1818  define([acl_frompackage_]NAME, [$2])
1819  popdef([NAME])
1820  pushdef([PACK],[$2])
1821  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
1822                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1823  define([acl_libsinpackage_]PACKUP,
1824    m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
1825  popdef([PACKUP])
1826  popdef([PACK])
1827])
1828
1829dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
1830dnl the libraries corresponding to explicit and implicit dependencies.
1831dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
1832dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
1833dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
1834AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
1835[
1836  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
1837  pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
1838                                [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1839  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
1840  pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
1841                                  [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
1842  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
1843  dnl Autoconf >= 2.61 supports dots in --with options.
1844  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
1845  dnl By default, look in $includedir and $libdir.
1846  use_additional=yes
1847  AC_LIB_WITH_FINAL_PREFIX([
1848    eval additional_includedir=\"$includedir\"
1849    eval additional_libdir=\"$libdir\"
1850  ])
1851  AC_ARG_WITH(P_A_C_K[-prefix],
1852[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
1853  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
1854[
1855    if test "X$withval" = "Xno"; then
1856      use_additional=no
1857    else
1858      if test "X$withval" = "X"; then
1859        AC_LIB_WITH_FINAL_PREFIX([
1860          eval additional_includedir=\"$includedir\"
1861          eval additional_libdir=\"$libdir\"
1862        ])
1863      else
1864        additional_includedir="$withval/include"
1865        additional_libdir="$withval/$acl_libdirstem"
1866        if test "$acl_libdirstem2" != "$acl_libdirstem" \
1867           && ! test -d "$withval/$acl_libdirstem"; then
1868          additional_libdir="$withval/$acl_libdirstem2"
1869        fi
1870      fi
1871    fi
1872])
1873  dnl Search the library and its dependencies in $additional_libdir and
1874  dnl $LDFLAGS. Using breadth-first-seach.
1875  LIB[]NAME=
1876  LTLIB[]NAME=
1877  INC[]NAME=
1878  LIB[]NAME[]_PREFIX=
1879  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
1880  dnl computed. So it has to be reset here.
1881  HAVE_LIB[]NAME=
1882  rpathdirs=
1883  ltrpathdirs=
1884  names_already_handled=
1885  names_next_round='$1 $2'
1886  while test -n "$names_next_round"; do
1887    names_this_round="$names_next_round"
1888    names_next_round=
1889    for name in $names_this_round; do
1890      already_handled=
1891      for n in $names_already_handled; do
1892        if test "$n" = "$name"; then
1893          already_handled=yes
1894          break
1895        fi
1896      done
1897      if test -z "$already_handled"; then
1898        names_already_handled="$names_already_handled $name"
1899        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
1900        dnl or AC_LIB_HAVE_LINKFLAGS call.
1901        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
1902        eval value=\"\$HAVE_LIB$uppername\"
1903        if test -n "$value"; then
1904          if test "$value" = yes; then
1905            eval value=\"\$LIB$uppername\"
1906            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
1907            eval value=\"\$LTLIB$uppername\"
1908            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
1909          else
1910            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
1911            dnl that this library doesn't exist. So just drop it.
1912            :
1913          fi
1914        else
1915          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
1916          dnl and the already constructed $LIBNAME/$LTLIBNAME.
1917          found_dir=
1918          found_la=
1919          found_so=
1920          found_a=
1921          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
1922          if test -n "$acl_shlibext"; then
1923            shrext=".$acl_shlibext"             # typically: shrext=.so
1924          else
1925            shrext=
1926          fi
1927          if test $use_additional = yes; then
1928            dir="$additional_libdir"
1929            dnl The same code as in the loop below:
1930            dnl First look for a shared library.
1931            if test -n "$acl_shlibext"; then
1932              if test -f "$dir/$libname$shrext"; then
1933                found_dir="$dir"
1934                found_so="$dir/$libname$shrext"
1935              else
1936                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1937                  ver=`(cd "$dir" && \
1938                        for f in "$libname$shrext".*; do echo "$f"; done \
1939                        | sed -e "s,^$libname$shrext\\\\.,," \
1940                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1941                        | sed 1q ) 2>/dev/null`
1942                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1943                    found_dir="$dir"
1944                    found_so="$dir/$libname$shrext.$ver"
1945                  fi
1946                else
1947                  eval library_names=\"$acl_library_names_spec\"
1948                  for f in $library_names; do
1949                    if test -f "$dir/$f"; then
1950                      found_dir="$dir"
1951                      found_so="$dir/$f"
1952                      break
1953                    fi
1954                  done
1955                fi
1956              fi
1957            fi
1958            dnl Then look for a static library.
1959            if test "X$found_dir" = "X"; then
1960              if test -f "$dir/$libname.$acl_libext"; then
1961                found_dir="$dir"
1962                found_a="$dir/$libname.$acl_libext"
1963              fi
1964            fi
1965            if test "X$found_dir" != "X"; then
1966              if test -f "$dir/$libname.la"; then
1967                found_la="$dir/$libname.la"
1968              fi
1969            fi
1970          fi
1971          if test "X$found_dir" = "X"; then
1972            for x in $LDFLAGS $LTLIB[]NAME; do
1973              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
1974              case "$x" in
1975                -L*)
1976                  dir=`echo "X$x" | sed -e 's/^X-L//'`
1977                  dnl First look for a shared library.
1978                  if test -n "$acl_shlibext"; then
1979                    if test -f "$dir/$libname$shrext"; then
1980                      found_dir="$dir"
1981                      found_so="$dir/$libname$shrext"
1982                    else
1983                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
1984                        ver=`(cd "$dir" && \
1985                              for f in "$libname$shrext".*; do echo "$f"; done \
1986                              | sed -e "s,^$libname$shrext\\\\.,," \
1987                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
1988                              | sed 1q ) 2>/dev/null`
1989                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
1990                          found_dir="$dir"
1991                          found_so="$dir/$libname$shrext.$ver"
1992                        fi
1993                      else
1994                        eval library_names=\"$acl_library_names_spec\"
1995                        for f in $library_names; do
1996                          if test -f "$dir/$f"; then
1997                            found_dir="$dir"
1998                            found_so="$dir/$f"
1999                            break
2000                          fi
2001                        done
2002                      fi
2003                    fi
2004                  fi
2005                  dnl Then look for a static library.
2006                  if test "X$found_dir" = "X"; then
2007                    if test -f "$dir/$libname.$acl_libext"; then
2008                      found_dir="$dir"
2009                      found_a="$dir/$libname.$acl_libext"
2010                    fi
2011                  fi
2012                  if test "X$found_dir" != "X"; then
2013                    if test -f "$dir/$libname.la"; then
2014                      found_la="$dir/$libname.la"
2015                    fi
2016                  fi
2017                  ;;
2018              esac
2019              if test "X$found_dir" != "X"; then
2020                break
2021              fi
2022            done
2023          fi
2024          if test "X$found_dir" != "X"; then
2025            dnl Found the library.
2026            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
2027            if test "X$found_so" != "X"; then
2028              dnl Linking with a shared library. We attempt to hardcode its
2029              dnl directory into the executable's runpath, unless it's the
2030              dnl standard /usr/lib.
2031              if test "$enable_rpath" = no \
2032                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
2033                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
2034                dnl No hardcoding is needed.
2035                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2036              else
2037                dnl Use an explicit option to hardcode DIR into the resulting
2038                dnl binary.
2039                dnl Potentially add DIR to ltrpathdirs.
2040                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2041                haveit=
2042                for x in $ltrpathdirs; do
2043                  if test "X$x" = "X$found_dir"; then
2044                    haveit=yes
2045                    break
2046                  fi
2047                done
2048                if test -z "$haveit"; then
2049                  ltrpathdirs="$ltrpathdirs $found_dir"
2050                fi
2051                dnl The hardcoding into $LIBNAME is system dependent.
2052                if test "$acl_hardcode_direct" = yes; then
2053                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
2054                  dnl resulting binary.
2055                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2056                else
2057                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
2058                    dnl Use an explicit option to hardcode DIR into the resulting
2059                    dnl binary.
2060                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2061                    dnl Potentially add DIR to rpathdirs.
2062                    dnl The rpathdirs will be appended to $LIBNAME at the end.
2063                    haveit=
2064                    for x in $rpathdirs; do
2065                      if test "X$x" = "X$found_dir"; then
2066                        haveit=yes
2067                        break
2068                      fi
2069                    done
2070                    if test -z "$haveit"; then
2071                      rpathdirs="$rpathdirs $found_dir"
2072                    fi
2073                  else
2074                    dnl Rely on "-L$found_dir".
2075                    dnl But don't add it if it's already contained in the LDFLAGS
2076                    dnl or the already constructed $LIBNAME
2077                    haveit=
2078                    for x in $LDFLAGS $LIB[]NAME; do
2079                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2080                      if test "X$x" = "X-L$found_dir"; then
2081                        haveit=yes
2082                        break
2083                      fi
2084                    done
2085                    if test -z "$haveit"; then
2086                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
2087                    fi
2088                    if test "$acl_hardcode_minus_L" != no; then
2089                      dnl FIXME: Not sure whether we should use
2090                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2091                      dnl here.
2092                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
2093                    else
2094                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
2095                      dnl here, because this doesn't fit in flags passed to the
2096                      dnl compiler. So give up. No hardcoding. This affects only
2097                      dnl very old systems.
2098                      dnl FIXME: Not sure whether we should use
2099                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
2100                      dnl here.
2101                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2102                    fi
2103                  fi
2104                fi
2105              fi
2106            else
2107              if test "X$found_a" != "X"; then
2108                dnl Linking with a static library.
2109                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
2110              else
2111                dnl We shouldn't come here, but anyway it's good to have a
2112                dnl fallback.
2113                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
2114              fi
2115            fi
2116            dnl Assume the include files are nearby.
2117            additional_includedir=
2118            case "$found_dir" in
2119              */$acl_libdirstem | */$acl_libdirstem/)
2120                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
2121                if test "$name" = '$1'; then
2122                  LIB[]NAME[]_PREFIX="$basedir"
2123                fi
2124                additional_includedir="$basedir/include"
2125                ;;
2126              */$acl_libdirstem2 | */$acl_libdirstem2/)
2127                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
2128                if test "$name" = '$1'; then
2129                  LIB[]NAME[]_PREFIX="$basedir"
2130                fi
2131                additional_includedir="$basedir/include"
2132                ;;
2133            esac
2134            if test "X$additional_includedir" != "X"; then
2135              dnl Potentially add $additional_includedir to $INCNAME.
2136              dnl But don't add it
2137              dnl   1. if it's the standard /usr/include,
2138              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
2139              dnl   3. if it's already present in $CPPFLAGS or the already
2140              dnl      constructed $INCNAME,
2141              dnl   4. if it doesn't exist as a directory.
2142              if test "X$additional_includedir" != "X/usr/include"; then
2143                haveit=
2144                if test "X$additional_includedir" = "X/usr/local/include"; then
2145                  if test -n "$GCC"; then
2146                    case $host_os in
2147                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2148                    esac
2149                  fi
2150                fi
2151                if test -z "$haveit"; then
2152                  for x in $CPPFLAGS $INC[]NAME; do
2153                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2154                    if test "X$x" = "X-I$additional_includedir"; then
2155                      haveit=yes
2156                      break
2157                    fi
2158                  done
2159                  if test -z "$haveit"; then
2160                    if test -d "$additional_includedir"; then
2161                      dnl Really add $additional_includedir to $INCNAME.
2162                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
2163                    fi
2164                  fi
2165                fi
2166              fi
2167            fi
2168            dnl Look for dependencies.
2169            if test -n "$found_la"; then
2170              dnl Read the .la file. It defines the variables
2171              dnl dlname, library_names, old_library, dependency_libs, current,
2172              dnl age, revision, installed, dlopen, dlpreopen, libdir.
2173              save_libdir="$libdir"
2174              case "$found_la" in
2175                */* | *\\*) . "$found_la" ;;
2176                *) . "./$found_la" ;;
2177              esac
2178              libdir="$save_libdir"
2179              dnl We use only dependency_libs.
2180              for dep in $dependency_libs; do
2181                case "$dep" in
2182                  -L*)
2183                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
2184                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
2185                    dnl But don't add it
2186                    dnl   1. if it's the standard /usr/lib,
2187                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
2188                    dnl   3. if it's already present in $LDFLAGS or the already
2189                    dnl      constructed $LIBNAME,
2190                    dnl   4. if it doesn't exist as a directory.
2191                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
2192                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
2193                      haveit=
2194                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
2195                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
2196                        if test -n "$GCC"; then
2197                          case $host_os in
2198                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2199                          esac
2200                        fi
2201                      fi
2202                      if test -z "$haveit"; then
2203                        haveit=
2204                        for x in $LDFLAGS $LIB[]NAME; do
2205                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2206                          if test "X$x" = "X-L$additional_libdir"; then
2207                            haveit=yes
2208                            break
2209                          fi
2210                        done
2211                        if test -z "$haveit"; then
2212                          if test -d "$additional_libdir"; then
2213                            dnl Really add $additional_libdir to $LIBNAME.
2214                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
2215                          fi
2216                        fi
2217                        haveit=
2218                        for x in $LDFLAGS $LTLIB[]NAME; do
2219                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2220                          if test "X$x" = "X-L$additional_libdir"; then
2221                            haveit=yes
2222                            break
2223                          fi
2224                        done
2225                        if test -z "$haveit"; then
2226                          if test -d "$additional_libdir"; then
2227                            dnl Really add $additional_libdir to $LTLIBNAME.
2228                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
2229                          fi
2230                        fi
2231                      fi
2232                    fi
2233                    ;;
2234                  -R*)
2235                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
2236                    if test "$enable_rpath" != no; then
2237                      dnl Potentially add DIR to rpathdirs.
2238                      dnl The rpathdirs will be appended to $LIBNAME at the end.
2239                      haveit=
2240                      for x in $rpathdirs; do
2241                        if test "X$x" = "X$dir"; then
2242                          haveit=yes
2243                          break
2244                        fi
2245                      done
2246                      if test -z "$haveit"; then
2247                        rpathdirs="$rpathdirs $dir"
2248                      fi
2249                      dnl Potentially add DIR to ltrpathdirs.
2250                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
2251                      haveit=
2252                      for x in $ltrpathdirs; do
2253                        if test "X$x" = "X$dir"; then
2254                          haveit=yes
2255                          break
2256                        fi
2257                      done
2258                      if test -z "$haveit"; then
2259                        ltrpathdirs="$ltrpathdirs $dir"
2260                      fi
2261                    fi
2262                    ;;
2263                  -l*)
2264                    dnl Handle this in the next round.
2265                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
2266                    ;;
2267                  *.la)
2268                    dnl Handle this in the next round. Throw away the .la's
2269                    dnl directory; it is already contained in a preceding -L
2270                    dnl option.
2271                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
2272                    ;;
2273                  *)
2274                    dnl Most likely an immediate library name.
2275                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
2276                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
2277                    ;;
2278                esac
2279              done
2280            fi
2281          else
2282            dnl Didn't find the library; assume it is in the system directories
2283            dnl known to the linker and runtime loader. (All the system
2284            dnl directories known to the linker should also be known to the
2285            dnl runtime loader, otherwise the system is severely misconfigured.)
2286            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
2287            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
2288          fi
2289        fi
2290      fi
2291    done
2292  done
2293  if test "X$rpathdirs" != "X"; then
2294    if test -n "$acl_hardcode_libdir_separator"; then
2295      dnl Weird platform: only the last -rpath option counts, the user must
2296      dnl pass all path elements in one option. We can arrange that for a
2297      dnl single library, but not when more than one $LIBNAMEs are used.
2298      alldirs=
2299      for found_dir in $rpathdirs; do
2300        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
2301      done
2302      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
2303      acl_save_libdir="$libdir"
2304      libdir="$alldirs"
2305      eval flag=\"$acl_hardcode_libdir_flag_spec\"
2306      libdir="$acl_save_libdir"
2307      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2308    else
2309      dnl The -rpath options are cumulative.
2310      for found_dir in $rpathdirs; do
2311        acl_save_libdir="$libdir"
2312        libdir="$found_dir"
2313        eval flag=\"$acl_hardcode_libdir_flag_spec\"
2314        libdir="$acl_save_libdir"
2315        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
2316      done
2317    fi
2318  fi
2319  if test "X$ltrpathdirs" != "X"; then
2320    dnl When using libtool, the option that works for both libraries and
2321    dnl executables is -R. The -R options are cumulative.
2322    for found_dir in $ltrpathdirs; do
2323      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
2324    done
2325  fi
2326  popdef([P_A_C_K])
2327  popdef([PACKLIBS])
2328  popdef([PACKUP])
2329  popdef([PACK])
2330  popdef([NAME])
2331])
2332
2333dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
2334dnl unless already present in VAR.
2335dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
2336dnl contains two or three consecutive elements that belong together.
2337AC_DEFUN([AC_LIB_APPENDTOVAR],
2338[
2339  for element in [$2]; do
2340    haveit=
2341    for x in $[$1]; do
2342      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2343      if test "X$x" = "X$element"; then
2344        haveit=yes
2345        break
2346      fi
2347    done
2348    if test -z "$haveit"; then
2349      [$1]="${[$1]}${[$1]:+ }$element"
2350    fi
2351  done
2352])
2353
2354dnl For those cases where a variable contains several -L and -l options
2355dnl referring to unknown libraries and directories, this macro determines the
2356dnl necessary additional linker options for the runtime path.
2357dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
2358dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
2359dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
2360dnl otherwise linking without libtool is assumed.
2361AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
2362[
2363  AC_REQUIRE([AC_LIB_RPATH])
2364  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
2365  $1=
2366  if test "$enable_rpath" != no; then
2367    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
2368      dnl Use an explicit option to hardcode directories into the resulting
2369      dnl binary.
2370      rpathdirs=
2371      next=
2372      for opt in $2; do
2373        if test -n "$next"; then
2374          dir="$next"
2375          dnl No need to hardcode the standard /usr/lib.
2376          if test "X$dir" != "X/usr/$acl_libdirstem" \
2377             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
2378            rpathdirs="$rpathdirs $dir"
2379          fi
2380          next=
2381        else
2382          case $opt in
2383            -L) next=yes ;;
2384            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
2385                 dnl No need to hardcode the standard /usr/lib.
2386                 if test "X$dir" != "X/usr/$acl_libdirstem" \
2387                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
2388                   rpathdirs="$rpathdirs $dir"
2389                 fi
2390                 next= ;;
2391            *) next= ;;
2392          esac
2393        fi
2394      done
2395      if test "X$rpathdirs" != "X"; then
2396        if test -n ""$3""; then
2397          dnl libtool is used for linking. Use -R options.
2398          for dir in $rpathdirs; do
2399            $1="${$1}${$1:+ }-R$dir"
2400          done
2401        else
2402          dnl The linker is used for linking directly.
2403          if test -n "$acl_hardcode_libdir_separator"; then
2404            dnl Weird platform: only the last -rpath option counts, the user
2405            dnl must pass all path elements in one option.
2406            alldirs=
2407            for dir in $rpathdirs; do
2408              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
2409            done
2410            acl_save_libdir="$libdir"
2411            libdir="$alldirs"
2412            eval flag=\"$acl_hardcode_libdir_flag_spec\"
2413            libdir="$acl_save_libdir"
2414            $1="$flag"
2415          else
2416            dnl The -rpath options are cumulative.
2417            for dir in $rpathdirs; do
2418              acl_save_libdir="$libdir"
2419              libdir="$dir"
2420              eval flag=\"$acl_hardcode_libdir_flag_spec\"
2421              libdir="$acl_save_libdir"
2422              $1="${$1}${$1:+ }$flag"
2423            done
2424          fi
2425        fi
2426      fi
2427    fi
2428  fi
2429  AC_SUBST([$1])
2430])
2431
2432# lib-prefix.m4 serial 7 (gettext-0.18)
2433dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
2434dnl This file is free software; the Free Software Foundation
2435dnl gives unlimited permission to copy and/or distribute it,
2436dnl with or without modifications, as long as this notice is preserved.
2437
2438dnl From Bruno Haible.
2439
2440dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
2441dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
2442dnl require excessive bracketing.
2443ifdef([AC_HELP_STRING],
2444[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
2445[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
2446
2447dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
2448dnl to access previously installed libraries. The basic assumption is that
2449dnl a user will want packages to use other packages he previously installed
2450dnl with the same --prefix option.
2451dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
2452dnl libraries, but is otherwise very convenient.
2453AC_DEFUN([AC_LIB_PREFIX],
2454[
2455  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
2456  AC_REQUIRE([AC_PROG_CC])
2457  AC_REQUIRE([AC_CANONICAL_HOST])
2458  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
2459  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2460  dnl By default, look in $includedir and $libdir.
2461  use_additional=yes
2462  AC_LIB_WITH_FINAL_PREFIX([
2463    eval additional_includedir=\"$includedir\"
2464    eval additional_libdir=\"$libdir\"
2465  ])
2466  AC_LIB_ARG_WITH([lib-prefix],
2467[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
2468  --without-lib-prefix    don't search for libraries in includedir and libdir],
2469[
2470    if test "X$withval" = "Xno"; then
2471      use_additional=no
2472    else
2473      if test "X$withval" = "X"; then
2474        AC_LIB_WITH_FINAL_PREFIX([
2475          eval additional_includedir=\"$includedir\"
2476          eval additional_libdir=\"$libdir\"
2477        ])
2478      else
2479        additional_includedir="$withval/include"
2480        additional_libdir="$withval/$acl_libdirstem"
2481      fi
2482    fi
2483])
2484  if test $use_additional = yes; then
2485    dnl Potentially add $additional_includedir to $CPPFLAGS.
2486    dnl But don't add it
2487    dnl   1. if it's the standard /usr/include,
2488    dnl   2. if it's already present in $CPPFLAGS,
2489    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
2490    dnl   4. if it doesn't exist as a directory.
2491    if test "X$additional_includedir" != "X/usr/include"; then
2492      haveit=
2493      for x in $CPPFLAGS; do
2494        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2495        if test "X$x" = "X-I$additional_includedir"; then
2496          haveit=yes
2497          break
2498        fi
2499      done
2500      if test -z "$haveit"; then
2501        if test "X$additional_includedir" = "X/usr/local/include"; then
2502          if test -n "$GCC"; then
2503            case $host_os in
2504              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
2505            esac
2506          fi
2507        fi
2508        if test -z "$haveit"; then
2509          if test -d "$additional_includedir"; then
2510            dnl Really add $additional_includedir to $CPPFLAGS.
2511            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
2512          fi
2513        fi
2514      fi
2515    fi
2516    dnl Potentially add $additional_libdir to $LDFLAGS.
2517    dnl But don't add it
2518    dnl   1. if it's the standard /usr/lib,
2519    dnl   2. if it's already present in $LDFLAGS,
2520    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
2521    dnl   4. if it doesn't exist as a directory.
2522    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
2523      haveit=
2524      for x in $LDFLAGS; do
2525        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
2526        if test "X$x" = "X-L$additional_libdir"; then
2527          haveit=yes
2528          break
2529        fi
2530      done
2531      if test -z "$haveit"; then
2532        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
2533          if test -n "$GCC"; then
2534            case $host_os in
2535              linux*) haveit=yes;;
2536            esac
2537          fi
2538        fi
2539        if test -z "$haveit"; then
2540          if test -d "$additional_libdir"; then
2541            dnl Really add $additional_libdir to $LDFLAGS.
2542            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
2543          fi
2544        fi
2545      fi
2546    fi
2547  fi
2548])
2549
2550dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
2551dnl acl_final_exec_prefix, containing the values to which $prefix and
2552dnl $exec_prefix will expand at the end of the configure script.
2553AC_DEFUN([AC_LIB_PREPARE_PREFIX],
2554[
2555  dnl Unfortunately, prefix and exec_prefix get only finally determined
2556  dnl at the end of configure.
2557  if test "X$prefix" = "XNONE"; then
2558    acl_final_prefix="$ac_default_prefix"
2559  else
2560    acl_final_prefix="$prefix"
2561  fi
2562  if test "X$exec_prefix" = "XNONE"; then
2563    acl_final_exec_prefix='${prefix}'
2564  else
2565    acl_final_exec_prefix="$exec_prefix"
2566  fi
2567  acl_save_prefix="$prefix"
2568  prefix="$acl_final_prefix"
2569  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
2570  prefix="$acl_save_prefix"
2571])
2572
2573dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
2574dnl variables prefix and exec_prefix bound to the values they will have
2575dnl at the end of the configure script.
2576AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
2577[
2578  acl_save_prefix="$prefix"
2579  prefix="$acl_final_prefix"
2580  acl_save_exec_prefix="$exec_prefix"
2581  exec_prefix="$acl_final_exec_prefix"
2582  $1
2583  exec_prefix="$acl_save_exec_prefix"
2584  prefix="$acl_save_prefix"
2585])
2586
2587dnl AC_LIB_PREPARE_MULTILIB creates
2588dnl - a variable acl_libdirstem, containing the basename of the libdir, either
2589dnl   "lib" or "lib64" or "lib/64",
2590dnl - a variable acl_libdirstem2, as a secondary possible value for
2591dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
2592dnl   "lib/amd64".
2593AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
2594[
2595  dnl There is no formal standard regarding lib and lib64.
2596  dnl On glibc systems, the current practice is that on a system supporting
2597  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
2598  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
2599  dnl the compiler's default mode by looking at the compiler's library search
2600  dnl path. If at least one of its elements ends in /lib64 or points to a
2601  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
2602  dnl Otherwise we use the default, namely "lib".
2603  dnl On Solaris systems, the current practice is that on a system supporting
2604  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
2605  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
2606  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
2607  AC_REQUIRE([AC_CANONICAL_HOST])
2608  acl_libdirstem=lib
2609  acl_libdirstem2=
2610  case "$host_os" in
2611    solaris*)
2612      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
2613      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
2614      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
2615      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
2616      dnl symlink is missing, so we set acl_libdirstem2 too.
2617      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
2618        [AC_EGREP_CPP([sixtyfour bits], [
2619#ifdef _LP64
2620sixtyfour bits
2621#endif
2622           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
2623        ])
2624      if test $gl_cv_solaris_64bit = yes; then
2625        acl_libdirstem=lib/64
2626        case "$host_cpu" in
2627          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
2628          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
2629        esac
2630      fi
2631      ;;
2632    *)
2633      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
2634      if test -n "$searchpath"; then
2635        acl_save_IFS="${IFS= 	}"; IFS=":"
2636        for searchdir in $searchpath; do
2637          if test -d "$searchdir"; then
2638            case "$searchdir" in
2639              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
2640              */../ | */.. )
2641                # Better ignore directories of this form. They are misleading.
2642                ;;
2643              *) searchdir=`cd "$searchdir" && pwd`
2644                 case "$searchdir" in
2645                   */lib64 ) acl_libdirstem=lib64 ;;
2646                 esac ;;
2647            esac
2648          fi
2649        done
2650        IFS="$acl_save_IFS"
2651      fi
2652      ;;
2653  esac
2654  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
2655])
2656
2657# lock.m4 serial 10 (gettext-0.18)
2658dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
2659dnl This file is free software; the Free Software Foundation
2660dnl gives unlimited permission to copy and/or distribute it,
2661dnl with or without modifications, as long as this notice is preserved.
2662
2663dnl From Bruno Haible.
2664
2665AC_DEFUN([gl_LOCK],
2666[
2667  AC_REQUIRE([gl_THREADLIB])
2668  if test "$gl_threads_api" = posix; then
2669    # OSF/1 4.0 and MacOS X 10.1 lack the pthread_rwlock_t type and the
2670    # pthread_rwlock_* functions.
2671    AC_CHECK_TYPE([pthread_rwlock_t],
2672      [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1],
2673         [Define if the POSIX multithreading library has read/write locks.])],
2674      [],
2675      [#include <pthread.h>])
2676    # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro.
2677    AC_TRY_COMPILE([#include <pthread.h>],
2678      [#if __FreeBSD__ == 4
2679error "No, in FreeBSD 4.0 recursive mutexes actually don't work."
2680#else
2681int x = (int)PTHREAD_MUTEX_RECURSIVE;
2682return !x;
2683#endif],
2684      [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1],
2685         [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])])
2686  fi
2687  gl_PREREQ_LOCK
2688])
2689
2690# Prerequisites of lib/lock.c.
2691AC_DEFUN([gl_PREREQ_LOCK], [
2692  AC_REQUIRE([AC_C_INLINE])
2693])
2694
2695# longlong.m4 serial 14
2696dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc.
2697dnl This file is free software; the Free Software Foundation
2698dnl gives unlimited permission to copy and/or distribute it,
2699dnl with or without modifications, as long as this notice is preserved.
2700
2701dnl From Paul Eggert.
2702
2703# Define HAVE_LONG_LONG_INT if 'long long int' works.
2704# This fixes a bug in Autoconf 2.61, but can be removed once we
2705# assume 2.62 everywhere.
2706
2707# Note: If the type 'long long int' exists but is only 32 bits large
2708# (as on some very old compilers), HAVE_LONG_LONG_INT will not be
2709# defined. In this case you can treat 'long long int' like 'long int'.
2710
2711AC_DEFUN([AC_TYPE_LONG_LONG_INT],
2712[
2713  AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
2714    [AC_LINK_IFELSE(
2715       [_AC_TYPE_LONG_LONG_SNIPPET],
2716       [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
2717        dnl If cross compiling, assume the bug isn't important, since
2718        dnl nobody cross compiles for this platform as far as we know.
2719        AC_RUN_IFELSE(
2720          [AC_LANG_PROGRAM(
2721             [[@%:@include <limits.h>
2722               @%:@ifndef LLONG_MAX
2723               @%:@ define HALF \
2724                        (1LL << (sizeof (long long int) * CHAR_BIT - 2))
2725               @%:@ define LLONG_MAX (HALF - 1 + HALF)
2726               @%:@endif]],
2727             [[long long int n = 1;
2728               int i;
2729               for (i = 0; ; i++)
2730                 {
2731                   long long int m = n << i;
2732                   if (m >> i != n)
2733                     return 1;
2734                   if (LLONG_MAX / 2 < m)
2735                     break;
2736                 }
2737               return 0;]])],
2738          [ac_cv_type_long_long_int=yes],
2739          [ac_cv_type_long_long_int=no],
2740          [ac_cv_type_long_long_int=yes])],
2741       [ac_cv_type_long_long_int=no])])
2742  if test $ac_cv_type_long_long_int = yes; then
2743    AC_DEFINE([HAVE_LONG_LONG_INT], [1],
2744      [Define to 1 if the system has the type `long long int'.])
2745  fi
2746])
2747
2748# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
2749# This fixes a bug in Autoconf 2.61, but can be removed once we
2750# assume 2.62 everywhere.
2751
2752# Note: If the type 'unsigned long long int' exists but is only 32 bits
2753# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
2754# will not be defined. In this case you can treat 'unsigned long long int'
2755# like 'unsigned long int'.
2756
2757AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
2758[
2759  AC_CACHE_CHECK([for unsigned long long int],
2760    [ac_cv_type_unsigned_long_long_int],
2761    [AC_LINK_IFELSE(
2762       [_AC_TYPE_LONG_LONG_SNIPPET],
2763       [ac_cv_type_unsigned_long_long_int=yes],
2764       [ac_cv_type_unsigned_long_long_int=no])])
2765  if test $ac_cv_type_unsigned_long_long_int = yes; then
2766    AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
2767      [Define to 1 if the system has the type `unsigned long long int'.])
2768  fi
2769])
2770
2771# Expands to a C program that can be used to test for simultaneous support
2772# of 'long long' and 'unsigned long long'. We don't want to say that
2773# 'long long' is available if 'unsigned long long' is not, or vice versa,
2774# because too many programs rely on the symmetry between signed and unsigned
2775# integer types (excluding 'bool').
2776AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
2777[
2778  AC_LANG_PROGRAM(
2779    [[/* For now, do not test the preprocessor; as of 2007 there are too many
2780         implementations with broken preprocessors.  Perhaps this can
2781         be revisited in 2012.  In the meantime, code should not expect
2782         #if to work with literals wider than 32 bits.  */
2783      /* Test literals.  */
2784      long long int ll = 9223372036854775807ll;
2785      long long int nll = -9223372036854775807LL;
2786      unsigned long long int ull = 18446744073709551615ULL;
2787      /* Test constant expressions.   */
2788      typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
2789                     ? 1 : -1)];
2790      typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
2791                     ? 1 : -1)];
2792      int i = 63;]],
2793    [[/* Test availability of runtime routines for shift and division.  */
2794      long long int llmax = 9223372036854775807ll;
2795      unsigned long long int ullmax = 18446744073709551615ull;
2796      return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
2797              | (llmax / ll) | (llmax % ll)
2798              | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
2799              | (ullmax / ull) | (ullmax % ull));]])
2800])
2801
2802# nls.m4 serial 5 (gettext-0.18)
2803dnl Copyright (C) 1995-2003, 2005-2006, 2008-2010 Free Software Foundation,
2804dnl Inc.
2805dnl This file is free software; the Free Software Foundation
2806dnl gives unlimited permission to copy and/or distribute it,
2807dnl with or without modifications, as long as this notice is preserved.
2808dnl
2809dnl This file can can be used in projects which are not available under
2810dnl the GNU General Public License or the GNU Library General Public
2811dnl License but which still want to provide support for the GNU gettext
2812dnl functionality.
2813dnl Please note that the actual code of the GNU gettext library is covered
2814dnl by the GNU Library General Public License, and the rest of the GNU
2815dnl gettext package package is covered by the GNU General Public License.
2816dnl They are *not* in the public domain.
2817
2818dnl Authors:
2819dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2820dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2821
2822AC_PREREQ([2.50])
2823
2824AC_DEFUN([AM_NLS],
2825[
2826  AC_MSG_CHECKING([whether NLS is requested])
2827  dnl Default is enabled NLS
2828  AC_ARG_ENABLE([nls],
2829    [  --disable-nls           do not use Native Language Support],
2830    USE_NLS=$enableval, USE_NLS=yes)
2831  AC_MSG_RESULT([$USE_NLS])
2832  AC_SUBST([USE_NLS])
2833])
2834
2835# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
2836# serial 1 (pkg-config-0.24)
2837#
2838# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
2839#
2840# This program is free software; you can redistribute it and/or modify
2841# it under the terms of the GNU General Public License as published by
2842# the Free Software Foundation; either version 2 of the License, or
2843# (at your option) any later version.
2844#
2845# This program is distributed in the hope that it will be useful, but
2846# WITHOUT ANY WARRANTY; without even the implied warranty of
2847# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2848# General Public License for more details.
2849#
2850# You should have received a copy of the GNU General Public License
2851# along with this program; if not, write to the Free Software
2852# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2853#
2854# As a special exception to the GNU General Public License, if you
2855# distribute this file as part of a program that contains a
2856# configuration script generated by Autoconf, you may include it under
2857# the same distribution terms that you use for the rest of that program.
2858
2859# PKG_PROG_PKG_CONFIG([MIN-VERSION])
2860# ----------------------------------
2861AC_DEFUN([PKG_PROG_PKG_CONFIG],
2862[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
2863m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
2864AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
2865AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
2866AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
2867
2868if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
2869	AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
2870fi
2871if test -n "$PKG_CONFIG"; then
2872	_pkg_min_version=m4_default([$1], [0.9.0])
2873	AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
2874	if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
2875		AC_MSG_RESULT([yes])
2876	else
2877		AC_MSG_RESULT([no])
2878		PKG_CONFIG=""
2879	fi
2880fi[]dnl
2881])# PKG_PROG_PKG_CONFIG
2882
2883# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
2884#
2885# Check to see whether a particular set of modules exists.  Similar
2886# to PKG_CHECK_MODULES(), but does not set variables or print errors.
2887#
2888# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2889# only at the first occurence in configure.ac, so if the first place
2890# it's called might be skipped (such as if it is within an "if", you
2891# have to call PKG_CHECK_EXISTS manually
2892# --------------------------------------------------------------
2893AC_DEFUN([PKG_CHECK_EXISTS],
2894[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2895if test -n "$PKG_CONFIG" && \
2896    AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
2897  m4_default([$2], [:])
2898m4_ifvaln([$3], [else
2899  $3])dnl
2900fi])
2901
2902# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
2903# ---------------------------------------------
2904m4_define([_PKG_CONFIG],
2905[if test -n "$$1"; then
2906    pkg_cv_[]$1="$$1"
2907 elif test -n "$PKG_CONFIG"; then
2908    PKG_CHECK_EXISTS([$3],
2909                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
2910		     [pkg_failed=yes])
2911 else
2912    pkg_failed=untried
2913fi[]dnl
2914])# _PKG_CONFIG
2915
2916# _PKG_SHORT_ERRORS_SUPPORTED
2917# -----------------------------
2918AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
2919[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
2920if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
2921        _pkg_short_errors_supported=yes
2922else
2923        _pkg_short_errors_supported=no
2924fi[]dnl
2925])# _PKG_SHORT_ERRORS_SUPPORTED
2926
2927
2928# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
2929# [ACTION-IF-NOT-FOUND])
2930#
2931#
2932# Note that if there is a possibility the first call to
2933# PKG_CHECK_MODULES might not happen, you should be sure to include an
2934# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
2935#
2936#
2937# --------------------------------------------------------------
2938AC_DEFUN([PKG_CHECK_MODULES],
2939[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
2940AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
2941AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
2942
2943pkg_failed=no
2944AC_MSG_CHECKING([for $1])
2945
2946_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
2947_PKG_CONFIG([$1][_LIBS], [libs], [$2])
2948
2949m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
2950and $1[]_LIBS to avoid the need to call pkg-config.
2951See the pkg-config man page for more details.])
2952
2953if test $pkg_failed = yes; then
2954   	AC_MSG_RESULT([no])
2955        _PKG_SHORT_ERRORS_SUPPORTED
2956        if test $_pkg_short_errors_supported = yes; then
2957	        $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
2958        else
2959	        $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
2960        fi
2961	# Put the nasty error message in config.log where it belongs
2962	echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
2963
2964	m4_default([$4], [AC_MSG_ERROR(
2965[Package requirements ($2) were not met:
2966
2967$$1_PKG_ERRORS
2968
2969Consider adjusting the PKG_CONFIG_PATH environment variable if you
2970installed software in a non-standard prefix.
2971
2972_PKG_TEXT])dnl
2973        ])
2974elif test $pkg_failed = untried; then
2975     	AC_MSG_RESULT([no])
2976	m4_default([$4], [AC_MSG_FAILURE(
2977[The pkg-config script could not be found or is too old.  Make sure it
2978is in your PATH or set the PKG_CONFIG environment variable to the full
2979path to pkg-config.
2980
2981_PKG_TEXT
2982
2983To get pkg-config, see <http://pkg-config.freedesktop.org/>.])dnl
2984        ])
2985else
2986	$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
2987	$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
2988        AC_MSG_RESULT([yes])
2989	$3
2990fi[]dnl
2991])# PKG_CHECK_MODULES
2992
2993# po.m4 serial 17 (gettext-0.18)
2994dnl Copyright (C) 1995-2010 Free Software Foundation, Inc.
2995dnl This file is free software; the Free Software Foundation
2996dnl gives unlimited permission to copy and/or distribute it,
2997dnl with or without modifications, as long as this notice is preserved.
2998dnl
2999dnl This file can can be used in projects which are not available under
3000dnl the GNU General Public License or the GNU Library General Public
3001dnl License but which still want to provide support for the GNU gettext
3002dnl functionality.
3003dnl Please note that the actual code of the GNU gettext library is covered
3004dnl by the GNU Library General Public License, and the rest of the GNU
3005dnl gettext package package is covered by the GNU General Public License.
3006dnl They are *not* in the public domain.
3007
3008dnl Authors:
3009dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3010dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3011
3012AC_PREREQ([2.50])
3013
3014dnl Checks for all prerequisites of the po subdirectory.
3015AC_DEFUN([AM_PO_SUBDIRS],
3016[
3017  AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3018  AC_REQUIRE([AC_PROG_INSTALL])dnl
3019  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
3020  AC_REQUIRE([AM_NLS])dnl
3021
3022  dnl Release version of the gettext macros. This is used to ensure that
3023  dnl the gettext macros and po/Makefile.in.in are in sync.
3024  AC_SUBST([GETTEXT_MACRO_VERSION], [0.18])
3025
3026  dnl Perform the following tests also if --disable-nls has been given,
3027  dnl because they are needed for "make dist" to work.
3028
3029  dnl Search for GNU msgfmt in the PATH.
3030  dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
3031  dnl The second test excludes FreeBSD msgfmt.
3032  AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
3033    [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
3034     (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3035    :)
3036  AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT])
3037
3038  dnl Test whether it is GNU msgfmt >= 0.15.
3039changequote(,)dnl
3040  case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
3041    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;;
3042    *) MSGFMT_015=$MSGFMT ;;
3043  esac
3044changequote([,])dnl
3045  AC_SUBST([MSGFMT_015])
3046changequote(,)dnl
3047  case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
3048    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;;
3049    *) GMSGFMT_015=$GMSGFMT ;;
3050  esac
3051changequote([,])dnl
3052  AC_SUBST([GMSGFMT_015])
3053
3054  dnl Search for GNU xgettext 0.12 or newer in the PATH.
3055  dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
3056  dnl The second test excludes FreeBSD xgettext.
3057  AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
3058    [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 &&
3059     (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)],
3060    :)
3061  dnl Remove leftover from FreeBSD xgettext call.
3062  rm -f messages.po
3063
3064  dnl Test whether it is GNU xgettext >= 0.15.
3065changequote(,)dnl
3066  case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in
3067    '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;;
3068    *) XGETTEXT_015=$XGETTEXT ;;
3069  esac
3070changequote([,])dnl
3071  AC_SUBST([XGETTEXT_015])
3072
3073  dnl Search for GNU msgmerge 0.11 or newer in the PATH.
3074  AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
3075    [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :)
3076
3077  dnl Installation directories.
3078  dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we
3079  dnl have to define it here, so that it can be used in po/Makefile.
3080  test -n "$localedir" || localedir='${datadir}/locale'
3081  AC_SUBST([localedir])
3082
3083  dnl Support for AM_XGETTEXT_OPTION.
3084  test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS=
3085  AC_SUBST([XGETTEXT_EXTRA_OPTIONS])
3086
3087  AC_CONFIG_COMMANDS([po-directories], [[
3088    for ac_file in $CONFIG_FILES; do
3089      # Support "outfile[:infile[:infile...]]"
3090      case "$ac_file" in
3091        *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3092      esac
3093      # PO directories have a Makefile.in generated from Makefile.in.in.
3094      case "$ac_file" in */Makefile.in)
3095        # Adjust a relative srcdir.
3096        ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3097        ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
3098        ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3099        # In autoconf-2.13 it is called $ac_given_srcdir.
3100        # In autoconf-2.50 it is called $srcdir.
3101        test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3102        case "$ac_given_srcdir" in
3103          .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3104          /*) top_srcdir="$ac_given_srcdir" ;;
3105          *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
3106        esac
3107        # Treat a directory as a PO directory if and only if it has a
3108        # POTFILES.in file. This allows packages to have multiple PO
3109        # directories under different names or in different locations.
3110        if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
3111          rm -f "$ac_dir/POTFILES"
3112          test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
3113          cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ 	]*\$/d" -e "s,.*,     $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
3114          POMAKEFILEDEPS="POTFILES.in"
3115          # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend
3116          # on $ac_dir but don't depend on user-specified configuration
3117          # parameters.
3118          if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3119            # The LINGUAS file contains the set of available languages.
3120            if test -n "$OBSOLETE_ALL_LINGUAS"; then
3121              test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3122            fi
3123            ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3124            # Hide the ALL_LINGUAS assigment from automake < 1.5.
3125            eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
3126            POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3127          else
3128            # The set of available languages was given in configure.in.
3129            # Hide the ALL_LINGUAS assigment from automake < 1.5.
3130            eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
3131          fi
3132          # Compute POFILES
3133          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
3134          # Compute UPDATEPOFILES
3135          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
3136          # Compute DUMMYPOFILES
3137          # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
3138          # Compute GMOFILES
3139          # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
3140          case "$ac_given_srcdir" in
3141            .) srcdirpre= ;;
3142            *) srcdirpre='$(srcdir)/' ;;
3143          esac
3144          POFILES=
3145          UPDATEPOFILES=
3146          DUMMYPOFILES=
3147          GMOFILES=
3148          for lang in $ALL_LINGUAS; do
3149            POFILES="$POFILES $srcdirpre$lang.po"
3150            UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3151            DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3152            GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3153          done
3154          # CATALOGS depends on both $ac_dir and the user's LINGUAS
3155          # environment variable.
3156          INST_LINGUAS=
3157          if test -n "$ALL_LINGUAS"; then
3158            for presentlang in $ALL_LINGUAS; do
3159              useit=no
3160              if test "%UNSET%" != "$LINGUAS"; then
3161                desiredlanguages="$LINGUAS"
3162              else
3163                desiredlanguages="$ALL_LINGUAS"
3164              fi
3165              for desiredlang in $desiredlanguages; do
3166                # Use the presentlang catalog if desiredlang is
3167                #   a. equal to presentlang, or
3168                #   b. a variant of presentlang (because in this case,
3169                #      presentlang can be used as a fallback for messages
3170                #      which are not translated in the desiredlang catalog).
3171                case "$desiredlang" in
3172                  "$presentlang"*) useit=yes;;
3173                esac
3174              done
3175              if test $useit = yes; then
3176                INST_LINGUAS="$INST_LINGUAS $presentlang"
3177              fi
3178            done
3179          fi
3180          CATALOGS=
3181          if test -n "$INST_LINGUAS"; then
3182            for lang in $INST_LINGUAS; do
3183              CATALOGS="$CATALOGS $lang.gmo"
3184            done
3185          fi
3186          test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
3187          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"
3188          for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
3189            if test -f "$f"; then
3190              case "$f" in
3191                *.orig | *.bak | *~) ;;
3192                *) cat "$f" >> "$ac_dir/Makefile" ;;
3193              esac
3194            fi
3195          done
3196        fi
3197        ;;
3198      esac
3199    done]],
3200   [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
3201    # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it
3202    # from automake < 1.5.
3203    eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
3204    # Capture the value of LINGUAS because we need it to compute CATALOGS.
3205    LINGUAS="${LINGUAS-%UNSET%}"
3206   ])
3207])
3208
3209dnl Postprocesses a Makefile in a directory containing PO files.
3210AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE],
3211[
3212  # When this code is run, in config.status, two variables have already been
3213  # set:
3214  # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in,
3215  # - LINGUAS is the value of the environment variable LINGUAS at configure
3216  #   time.
3217
3218changequote(,)dnl
3219  # Adjust a relative srcdir.
3220  ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3221  ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
3222  ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3223  # In autoconf-2.13 it is called $ac_given_srcdir.
3224  # In autoconf-2.50 it is called $srcdir.
3225  test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3226  case "$ac_given_srcdir" in
3227    .)  top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3228    /*) top_srcdir="$ac_given_srcdir" ;;
3229    *)  top_srcdir="$ac_dots$ac_given_srcdir" ;;
3230  esac
3231
3232  # Find a way to echo strings without interpreting backslash.
3233  if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
3234    gt_echo='echo'
3235  else
3236    if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
3237      gt_echo='printf %s\n'
3238    else
3239      echo_func () {
3240        cat <<EOT
3241$*
3242EOT
3243      }
3244      gt_echo='echo_func'
3245    fi
3246  fi
3247
3248  # A sed script that extracts the value of VARIABLE from a Makefile.
3249  sed_x_variable='
3250# Test if the hold space is empty.
3251x
3252s/P/P/
3253x
3254ta
3255# Yes it was empty. Look if we have the expected variable definition.
3256/^[	 ]*VARIABLE[	 ]*=/{
3257  # Seen the first line of the variable definition.
3258  s/^[	 ]*VARIABLE[	 ]*=//
3259  ba
3260}
3261bd
3262:a
3263# Here we are processing a line from the variable definition.
3264# Remove comment, more precisely replace it with a space.
3265s/#.*$/ /
3266# See if the line ends in a backslash.
3267tb
3268:b
3269s/\\$//
3270# Print the line, without the trailing backslash.
3271p
3272tc
3273# There was no trailing backslash. The end of the variable definition is
3274# reached. Clear the hold space.
3275s/^.*$//
3276x
3277bd
3278:c
3279# A trailing backslash means that the variable definition continues in the
3280# next line. Put a nonempty string into the hold space to indicate this.
3281s/^.*$/P/
3282x
3283:d
3284'
3285changequote([,])dnl
3286
3287  # Set POTFILES to the value of the Makefile variable POTFILES.
3288  sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'`
3289  POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"`
3290  # Compute POTFILES_DEPS as
3291  #   $(foreach file, $(POTFILES), $(top_srcdir)/$(file))
3292  POTFILES_DEPS=
3293  for file in $POTFILES; do
3294    POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file"
3295  done
3296  POMAKEFILEDEPS=""
3297
3298  if test -n "$OBSOLETE_ALL_LINGUAS"; then
3299    test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3300  fi
3301  if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3302    # The LINGUAS file contains the set of available languages.
3303    ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3304    POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3305  else
3306    # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS.
3307    sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'`
3308    ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"`
3309  fi
3310  # Hide the ALL_LINGUAS assigment from automake < 1.5.
3311  eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
3312  # Compute POFILES
3313  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po)
3314  # Compute UPDATEPOFILES
3315  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).po-update)
3316  # Compute DUMMYPOFILES
3317  # as      $(foreach lang, $(ALL_LINGUAS), $(lang).nop)
3318  # Compute GMOFILES
3319  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo)
3320  # Compute PROPERTIESFILES
3321  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties)
3322  # Compute CLASSFILES
3323  # as      $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class)
3324  # Compute QMFILES
3325  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm)
3326  # Compute MSGFILES
3327  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg)
3328  # Compute RESOURCESDLLFILES
3329  # as      $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll)
3330  case "$ac_given_srcdir" in
3331    .) srcdirpre= ;;
3332    *) srcdirpre='$(srcdir)/' ;;
3333  esac
3334  POFILES=
3335  UPDATEPOFILES=
3336  DUMMYPOFILES=
3337  GMOFILES=
3338  PROPERTIESFILES=
3339  CLASSFILES=
3340  QMFILES=
3341  MSGFILES=
3342  RESOURCESDLLFILES=
3343  for lang in $ALL_LINGUAS; do
3344    POFILES="$POFILES $srcdirpre$lang.po"
3345    UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3346    DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3347    GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3348    PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties"
3349    CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class"
3350    QMFILES="$QMFILES $srcdirpre$lang.qm"
3351    frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
3352    MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg"
3353    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/'`
3354    RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll"
3355  done
3356  # CATALOGS depends on both $ac_dir and the user's LINGUAS
3357  # environment variable.
3358  INST_LINGUAS=
3359  if test -n "$ALL_LINGUAS"; then
3360    for presentlang in $ALL_LINGUAS; do
3361      useit=no
3362      if test "%UNSET%" != "$LINGUAS"; then
3363        desiredlanguages="$LINGUAS"
3364      else
3365        desiredlanguages="$ALL_LINGUAS"
3366      fi
3367      for desiredlang in $desiredlanguages; do
3368        # Use the presentlang catalog if desiredlang is
3369        #   a. equal to presentlang, or
3370        #   b. a variant of presentlang (because in this case,
3371        #      presentlang can be used as a fallback for messages
3372        #      which are not translated in the desiredlang catalog).
3373        case "$desiredlang" in
3374          "$presentlang"*) useit=yes;;
3375        esac
3376      done
3377      if test $useit = yes; then
3378        INST_LINGUAS="$INST_LINGUAS $presentlang"
3379      fi
3380    done
3381  fi
3382  CATALOGS=
3383  JAVACATALOGS=
3384  QTCATALOGS=
3385  TCLCATALOGS=
3386  CSHARPCATALOGS=
3387  if test -n "$INST_LINGUAS"; then
3388    for lang in $INST_LINGUAS; do
3389      CATALOGS="$CATALOGS $lang.gmo"
3390      JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties"
3391      QTCATALOGS="$QTCATALOGS $lang.qm"
3392      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
3393      TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg"
3394      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/'`
3395      CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll"
3396    done
3397  fi
3398
3399  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"
3400  if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then
3401    # Add dependencies that cannot be formulated as a simple suffix rule.
3402    for lang in $ALL_LINGUAS; do
3403      frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'`
3404      cat >> "$ac_file.tmp" <<EOF
3405$frobbedlang.msg: $lang.po
3406	@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \
3407	\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
3408EOF
3409    done
3410  fi
3411  if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then
3412    # Add dependencies that cannot be formulated as a simple suffix rule.
3413    for lang in $ALL_LINGUAS; do
3414      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/'`
3415      cat >> "$ac_file.tmp" <<EOF
3416$frobbedlang/\$(DOMAIN).resources.dll: $lang.po
3417	@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \
3418	\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; }
3419EOF
3420    done
3421  fi
3422  if test -n "$POMAKEFILEDEPS"; then
3423    cat >> "$ac_file.tmp" <<EOF
3424Makefile: $POMAKEFILEDEPS
3425EOF
3426  fi
3427  mv "$ac_file.tmp" "$ac_file"
3428])
3429
3430dnl Initializes the accumulator used by AM_XGETTEXT_OPTION.
3431AC_DEFUN([AM_XGETTEXT_OPTION_INIT],
3432[
3433  XGETTEXT_EXTRA_OPTIONS=
3434])
3435
3436dnl Registers an option to be passed to xgettext in the po subdirectory.
3437AC_DEFUN([AM_XGETTEXT_OPTION],
3438[
3439  AC_REQUIRE([AM_XGETTEXT_OPTION_INIT])
3440  XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1"
3441])
3442
3443# printf-posix.m4 serial 5 (gettext-0.18)
3444dnl Copyright (C) 2003, 2007, 2009-2010 Free Software Foundation, Inc.
3445dnl This file is free software; the Free Software Foundation
3446dnl gives unlimited permission to copy and/or distribute it,
3447dnl with or without modifications, as long as this notice is preserved.
3448
3449dnl From Bruno Haible.
3450dnl Test whether the printf() function supports POSIX/XSI format strings with
3451dnl positions.
3452
3453AC_DEFUN([gt_PRINTF_POSIX],
3454[
3455  AC_REQUIRE([AC_PROG_CC])
3456  AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings],
3457    gt_cv_func_printf_posix,
3458    [
3459      AC_TRY_RUN([
3460#include <stdio.h>
3461#include <string.h>
3462/* The string "%2$d %1$d", with dollar characters protected from the shell's
3463   dollar expansion (possibly an autoconf bug).  */
3464static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' };
3465static char buf[100];
3466int main ()
3467{
3468  sprintf (buf, format, 33, 55);
3469  return (strcmp (buf, "55 33") != 0);
3470}], gt_cv_func_printf_posix=yes, gt_cv_func_printf_posix=no,
3471      [
3472        AC_EGREP_CPP([notposix], [
3473#if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__
3474  notposix
3475#endif
3476          ],
3477          [gt_cv_func_printf_posix="guessing no"],
3478          [gt_cv_func_printf_posix="guessing yes"])
3479      ])
3480    ])
3481  case $gt_cv_func_printf_posix in
3482    *yes)
3483      AC_DEFINE([HAVE_POSIX_PRINTF], [1],
3484        [Define if your printf() function supports format strings with positions.])
3485      ;;
3486  esac
3487])
3488
3489# progtest.m4 serial 6 (gettext-0.18)
3490dnl Copyright (C) 1996-2003, 2005, 2008-2010 Free Software Foundation, Inc.
3491dnl This file is free software; the Free Software Foundation
3492dnl gives unlimited permission to copy and/or distribute it,
3493dnl with or without modifications, as long as this notice is preserved.
3494dnl
3495dnl This file can can be used in projects which are not available under
3496dnl the GNU General Public License or the GNU Library General Public
3497dnl License but which still want to provide support for the GNU gettext
3498dnl functionality.
3499dnl Please note that the actual code of the GNU gettext library is covered
3500dnl by the GNU Library General Public License, and the rest of the GNU
3501dnl gettext package package is covered by the GNU General Public License.
3502dnl They are *not* in the public domain.
3503
3504dnl Authors:
3505dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
3506
3507AC_PREREQ([2.50])
3508
3509# Search path for a program which passes the given test.
3510
3511dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
3512dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3513AC_DEFUN([AM_PATH_PROG_WITH_TEST],
3514[
3515# Prepare PATH_SEPARATOR.
3516# The user is always right.
3517if test "${PATH_SEPARATOR+set}" != set; then
3518  echo "#! /bin/sh" >conf$$.sh
3519  echo  "exit 0"   >>conf$$.sh
3520  chmod +x conf$$.sh
3521  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3522    PATH_SEPARATOR=';'
3523  else
3524    PATH_SEPARATOR=:
3525  fi
3526  rm -f conf$$.sh
3527fi
3528
3529# Find out how to test for executable files. Don't use a zero-byte file,
3530# as systems may use methods other than mode bits to determine executability.
3531cat >conf$$.file <<_ASEOF
3532#! /bin/sh
3533exit 0
3534_ASEOF
3535chmod +x conf$$.file
3536if test -x conf$$.file >/dev/null 2>&1; then
3537  ac_executable_p="test -x"
3538else
3539  ac_executable_p="test -f"
3540fi
3541rm -f conf$$.file
3542
3543# Extract the first word of "$2", so it can be a program name with args.
3544set dummy $2; ac_word=[$]2
3545AC_MSG_CHECKING([for $ac_word])
3546AC_CACHE_VAL([ac_cv_path_$1],
3547[case "[$]$1" in
3548  [[\\/]]* | ?:[[\\/]]*)
3549    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3550    ;;
3551  *)
3552    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
3553    for ac_dir in ifelse([$5], , $PATH, [$5]); do
3554      IFS="$ac_save_IFS"
3555      test -z "$ac_dir" && ac_dir=.
3556      for ac_exec_ext in '' $ac_executable_extensions; do
3557        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
3558          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
3559          if [$3]; then
3560            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
3561            break 2
3562          fi
3563        fi
3564      done
3565    done
3566    IFS="$ac_save_IFS"
3567dnl If no 4th arg is given, leave the cache variable unset,
3568dnl so AC_PATH_PROGS will keep looking.
3569ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3570])dnl
3571    ;;
3572esac])dnl
3573$1="$ac_cv_path_$1"
3574if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
3575  AC_MSG_RESULT([$][$1])
3576else
3577  AC_MSG_RESULT([no])
3578fi
3579AC_SUBST([$1])dnl
3580])
3581
3582# size_max.m4 serial 9
3583dnl Copyright (C) 2003, 2005-2006, 2008-2010 Free Software Foundation, Inc.
3584dnl This file is free software; the Free Software Foundation
3585dnl gives unlimited permission to copy and/or distribute it,
3586dnl with or without modifications, as long as this notice is preserved.
3587
3588dnl From Bruno Haible.
3589
3590AC_DEFUN([gl_SIZE_MAX],
3591[
3592  AC_CHECK_HEADERS([stdint.h])
3593  dnl First test whether the system already has SIZE_MAX.
3594  AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [
3595    gl_cv_size_max=
3596    AC_EGREP_CPP([Found it], [
3597#include <limits.h>
3598#if HAVE_STDINT_H
3599#include <stdint.h>
3600#endif
3601#ifdef SIZE_MAX
3602Found it
3603#endif
3604], [gl_cv_size_max=yes])
3605    if test -z "$gl_cv_size_max"; then
3606      dnl Define it ourselves. Here we assume that the type 'size_t' is not wider
3607      dnl than the type 'unsigned long'. Try hard to find a definition that can
3608      dnl be used in a preprocessor #if, i.e. doesn't contain a cast.
3609      AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1],
3610        [#include <stddef.h>
3611#include <limits.h>], [size_t_bits_minus_1=])
3612      AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)],
3613        [#include <stddef.h>], [fits_in_uint=])
3614      if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then
3615        if test $fits_in_uint = 1; then
3616          dnl Even though SIZE_MAX fits in an unsigned int, it must be of type
3617          dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'.
3618          AC_TRY_COMPILE([#include <stddef.h>
3619            extern size_t foo;
3620            extern unsigned long foo;
3621            ], [], [fits_in_uint=0])
3622        fi
3623        dnl We cannot use 'expr' to simplify this expression, because 'expr'
3624        dnl works only with 'long' integers in the host environment, while we
3625        dnl might be cross-compiling from a 32-bit platform to a 64-bit platform.
3626        if test $fits_in_uint = 1; then
3627          gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)"
3628        else
3629          gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)"
3630        fi
3631      else
3632        dnl Shouldn't happen, but who knows...
3633        gl_cv_size_max='((size_t)~(size_t)0)'
3634      fi
3635    fi
3636  ])
3637  if test "$gl_cv_size_max" != yes; then
3638    AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max],
3639      [Define as the maximum value of type 'size_t', if the system doesn't define it.])
3640  fi
3641  dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after
3642  dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with
3643  dnl #define by AC_DEFINE_UNQUOTED.
3644  AH_VERBATIM([SIZE_MAX],
3645[/* Define as the maximum value of type 'size_t', if the system doesn't define
3646   it. */
3647#ifndef SIZE_MAX
3648# undef SIZE_MAX
3649#endif])
3650])
3651
3652dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
3653dnl Remove this when we can assume autoconf >= 2.61.
3654m4_ifdef([AC_COMPUTE_INT], [], [
3655  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
3656])
3657
3658# stdint_h.m4 serial 8
3659dnl Copyright (C) 1997-2004, 2006, 2008-2010 Free Software Foundation, Inc.
3660dnl This file is free software; the Free Software Foundation
3661dnl gives unlimited permission to copy and/or distribute it,
3662dnl with or without modifications, as long as this notice is preserved.
3663
3664dnl From Paul Eggert.
3665
3666# Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3667# doesn't clash with <sys/types.h>, and declares uintmax_t.
3668
3669AC_DEFUN([gl_AC_HEADER_STDINT_H],
3670[
3671  AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h],
3672  [AC_TRY_COMPILE(
3673    [#include <sys/types.h>
3674#include <stdint.h>],
3675    [uintmax_t i = (uintmax_t) -1; return !i;],
3676    [gl_cv_header_stdint_h=yes],
3677    [gl_cv_header_stdint_h=no])])
3678  if test $gl_cv_header_stdint_h = yes; then
3679    AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1],
3680      [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3681       and declares uintmax_t. ])
3682  fi
3683])
3684
3685# threadlib.m4 serial 5 (gettext-0.18)
3686dnl Copyright (C) 2005-2010 Free Software Foundation, Inc.
3687dnl This file is free software; the Free Software Foundation
3688dnl gives unlimited permission to copy and/or distribute it,
3689dnl with or without modifications, as long as this notice is preserved.
3690
3691dnl From Bruno Haible.
3692
3693dnl gl_THREADLIB
3694dnl ------------
3695dnl Tests for a multithreading library to be used.
3696dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS,
3697dnl USE_PTH_THREADS, USE_WIN32_THREADS
3698dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use
3699dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with
3700dnl libtool).
3701dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for
3702dnl programs that really need multithread functionality. The difference
3703dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak
3704dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread".
3705dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for
3706dnl multithread-safe programs.
3707
3708AC_DEFUN([gl_THREADLIB_EARLY],
3709[
3710  AC_REQUIRE([gl_THREADLIB_EARLY_BODY])
3711])
3712
3713dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once.
3714
3715AC_DEFUN([gl_THREADLIB_EARLY_BODY],
3716[
3717  dnl Ordering constraints: This macro modifies CPPFLAGS in a way that
3718  dnl influences the result of the autoconf tests that test for *_unlocked
3719  dnl declarations, on AIX 5 at least. Therefore it must come early.
3720  AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl
3721  AC_BEFORE([$0], [gl_ARGP])dnl
3722
3723  AC_REQUIRE([AC_CANONICAL_HOST])
3724  dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems.
3725  dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes
3726  dnl AC_GNU_SOURCE.
3727  m4_ifdef([AC_USE_SYSTEM_EXTENSIONS],
3728    [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])],
3729    [AC_REQUIRE([AC_GNU_SOURCE])])
3730  dnl Check for multithreading.
3731  m4_divert_text([DEFAULTS], [gl_use_threads_default=])
3732  AC_ARG_ENABLE([threads],
3733AC_HELP_STRING([--enable-threads={posix|solaris|pth|win32}], [specify multithreading API])
3734AC_HELP_STRING([--disable-threads], [build without multithread safety]),
3735    [gl_use_threads=$enableval],
3736    [if test -n "$gl_use_threads_default"; then
3737       gl_use_threads="$gl_use_threads_default"
3738     else
3739changequote(,)dnl
3740       case "$host_os" in
3741         dnl Disable multithreading by default on OSF/1, because it interferes
3742         dnl with fork()/exec(): When msgexec is linked with -lpthread, its
3743         dnl child process gets an endless segmentation fault inside execvp().
3744         dnl Disable multithreading by default on Cygwin 1.5.x, because it has
3745         dnl bugs that lead to endless loops or crashes. See
3746         dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>.
3747         osf*) gl_use_threads=no ;;
3748         cygwin*)
3749               case `uname -r` in
3750                 1.[0-5].*) gl_use_threads=no ;;
3751                 *)         gl_use_threads=yes ;;
3752               esac
3753               ;;
3754         *)    gl_use_threads=yes ;;
3755       esac
3756changequote([,])dnl
3757     fi
3758    ])
3759  if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
3760    # For using <pthread.h>:
3761    case "$host_os" in
3762      osf*)
3763        # On OSF/1, the compiler needs the flag -D_REENTRANT so that it
3764        # groks <pthread.h>. cc also understands the flag -pthread, but
3765        # we don't use it because 1. gcc-2.95 doesn't understand -pthread,
3766        # 2. putting a flag into CPPFLAGS that has an effect on the linker
3767        # causes the AC_TRY_LINK test below to succeed unexpectedly,
3768        # leading to wrong values of LIBTHREAD and LTLIBTHREAD.
3769        CPPFLAGS="$CPPFLAGS -D_REENTRANT"
3770        ;;
3771    esac
3772    # Some systems optimize for single-threaded programs by default, and
3773    # need special flags to disable these optimizations. For example, the
3774    # definition of 'errno' in <errno.h>.
3775    case "$host_os" in
3776      aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;;
3777      solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;;
3778    esac
3779  fi
3780])
3781
3782dnl The guts of gl_THREADLIB. Needs to be expanded only once.
3783
3784AC_DEFUN([gl_THREADLIB_BODY],
3785[
3786  AC_REQUIRE([gl_THREADLIB_EARLY_BODY])
3787  gl_threads_api=none
3788  LIBTHREAD=
3789  LTLIBTHREAD=
3790  LIBMULTITHREAD=
3791  LTLIBMULTITHREAD=
3792  if test "$gl_use_threads" != no; then
3793    dnl Check whether the compiler and linker support weak declarations.
3794    AC_CACHE_CHECK([whether imported symbols can be declared weak],
3795      [gl_cv_have_weak],
3796      [gl_cv_have_weak=no
3797       dnl First, test whether the compiler accepts it syntactically.
3798       AC_TRY_LINK([extern void xyzzy ();
3799#pragma weak xyzzy], [xyzzy();], [gl_cv_have_weak=maybe])
3800       if test $gl_cv_have_weak = maybe; then
3801         dnl Second, test whether it actually works. On Cygwin 1.7.2, with
3802         dnl gcc 4.3, symbols declared weak always evaluate to the address 0.
3803         AC_TRY_RUN([
3804#include <stdio.h>
3805#pragma weak fputs
3806int main ()
3807{
3808  return (fputs == NULL);
3809}], [gl_cv_have_weak=yes], [gl_cv_have_weak=no],
3810           [dnl When cross-compiling, assume that only ELF platforms support
3811            dnl weak symbols.
3812            AC_EGREP_CPP([Extensible Linking Format],
3813              [#ifdef __ELF__
3814               Extensible Linking Format
3815               #endif
3816              ],
3817              [gl_cv_have_weak="guessing yes"],
3818              [gl_cv_have_weak="guessing no"])
3819           ])
3820       fi
3821      ])
3822    if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then
3823      # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that
3824      # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY.
3825      AC_CHECK_HEADER([pthread.h],
3826        [gl_have_pthread_h=yes], [gl_have_pthread_h=no])
3827      if test "$gl_have_pthread_h" = yes; then
3828        # Other possible tests:
3829        #   -lpthreads (FSU threads, PCthreads)
3830        #   -lgthreads
3831        gl_have_pthread=
3832        # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist
3833        # in libc. IRIX 6.5 has the first one in both libc and libpthread, but
3834        # the second one only in libpthread, and lock.c needs it.
3835        AC_TRY_LINK([#include <pthread.h>],
3836          [pthread_mutex_lock((pthread_mutex_t*)0);
3837           pthread_mutexattr_init((pthread_mutexattr_t*)0);],
3838          [gl_have_pthread=yes])
3839        # Test for libpthread by looking for pthread_kill. (Not pthread_self,
3840        # since it is defined as a macro on OSF/1.)
3841        if test -n "$gl_have_pthread"; then
3842          # The program links fine without libpthread. But it may actually
3843          # need to link with libpthread in order to create multiple threads.
3844          AC_CHECK_LIB([pthread], [pthread_kill],
3845            [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread
3846             # On Solaris and HP-UX, most pthread functions exist also in libc.
3847             # Therefore pthread_in_use() needs to actually try to create a
3848             # thread: pthread_create from libc will fail, whereas
3849             # pthread_create will actually create a thread.
3850             case "$host_os" in
3851               solaris* | hpux*)
3852                 AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1],
3853                   [Define if the pthread_in_use() detection is hard.])
3854             esac
3855            ])
3856        else
3857          # Some library is needed. Try libpthread and libc_r.
3858          AC_CHECK_LIB([pthread], [pthread_kill],
3859            [gl_have_pthread=yes
3860             LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread
3861             LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread])
3862          if test -z "$gl_have_pthread"; then
3863            # For FreeBSD 4.
3864            AC_CHECK_LIB([c_r], [pthread_kill],
3865              [gl_have_pthread=yes
3866               LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r
3867               LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r])
3868          fi
3869        fi
3870        if test -n "$gl_have_pthread"; then
3871          gl_threads_api=posix
3872          AC_DEFINE([USE_POSIX_THREADS], [1],
3873            [Define if the POSIX multithreading library can be used.])
3874          if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
3875            if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
3876              AC_DEFINE([USE_POSIX_THREADS_WEAK], [1],
3877                [Define if references to the POSIX multithreading library should be made weak.])
3878              LIBTHREAD=
3879              LTLIBTHREAD=
3880            fi
3881          fi
3882        fi
3883      fi
3884    fi
3885    if test -z "$gl_have_pthread"; then
3886      if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then
3887        gl_have_solaristhread=
3888        gl_save_LIBS="$LIBS"
3889        LIBS="$LIBS -lthread"
3890        AC_TRY_LINK([#include <thread.h>
3891#include <synch.h>],
3892          [thr_self();],
3893          [gl_have_solaristhread=yes])
3894        LIBS="$gl_save_LIBS"
3895        if test -n "$gl_have_solaristhread"; then
3896          gl_threads_api=solaris
3897          LIBTHREAD=-lthread
3898          LTLIBTHREAD=-lthread
3899          LIBMULTITHREAD="$LIBTHREAD"
3900          LTLIBMULTITHREAD="$LTLIBTHREAD"
3901          AC_DEFINE([USE_SOLARIS_THREADS], [1],
3902            [Define if the old Solaris multithreading library can be used.])
3903          if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
3904            AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1],
3905              [Define if references to the old Solaris multithreading library should be made weak.])
3906            LIBTHREAD=
3907            LTLIBTHREAD=
3908          fi
3909        fi
3910      fi
3911    fi
3912    if test "$gl_use_threads" = pth; then
3913      gl_save_CPPFLAGS="$CPPFLAGS"
3914      AC_LIB_LINKFLAGS([pth])
3915      gl_have_pth=
3916      gl_save_LIBS="$LIBS"
3917      LIBS="$LIBS -lpth"
3918      AC_TRY_LINK([#include <pth.h>], [pth_self();], [gl_have_pth=yes])
3919      LIBS="$gl_save_LIBS"
3920      if test -n "$gl_have_pth"; then
3921        gl_threads_api=pth
3922        LIBTHREAD="$LIBPTH"
3923        LTLIBTHREAD="$LTLIBPTH"
3924        LIBMULTITHREAD="$LIBTHREAD"
3925        LTLIBMULTITHREAD="$LTLIBTHREAD"
3926        AC_DEFINE([USE_PTH_THREADS], [1],
3927          [Define if the GNU Pth multithreading library can be used.])
3928        if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then
3929          if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then
3930            AC_DEFINE([USE_PTH_THREADS_WEAK], [1],
3931              [Define if references to the GNU Pth multithreading library should be made weak.])
3932            LIBTHREAD=
3933            LTLIBTHREAD=
3934          fi
3935        fi
3936      else
3937        CPPFLAGS="$gl_save_CPPFLAGS"
3938      fi
3939    fi
3940    if test -z "$gl_have_pthread"; then
3941      if test "$gl_use_threads" = yes || test "$gl_use_threads" = win32; then
3942        if { case "$host_os" in
3943               mingw*) true;;
3944               *) false;;
3945             esac
3946           }; then
3947          gl_threads_api=win32
3948          AC_DEFINE([USE_WIN32_THREADS], [1],
3949            [Define if the Win32 multithreading API can be used.])
3950        fi
3951      fi
3952    fi
3953  fi
3954  AC_MSG_CHECKING([for multithread API to use])
3955  AC_MSG_RESULT([$gl_threads_api])
3956  AC_SUBST([LIBTHREAD])
3957  AC_SUBST([LTLIBTHREAD])
3958  AC_SUBST([LIBMULTITHREAD])
3959  AC_SUBST([LTLIBMULTITHREAD])
3960])
3961
3962AC_DEFUN([gl_THREADLIB],
3963[
3964  AC_REQUIRE([gl_THREADLIB_EARLY])
3965  AC_REQUIRE([gl_THREADLIB_BODY])
3966])
3967
3968
3969dnl gl_DISABLE_THREADS
3970dnl ------------------
3971dnl Sets the gl_THREADLIB default so that threads are not used by default.
3972dnl The user can still override it at installation time, by using the
3973dnl configure option '--enable-threads'.
3974
3975AC_DEFUN([gl_DISABLE_THREADS], [
3976  m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no])
3977])
3978
3979
3980dnl Survey of platforms:
3981dnl
3982dnl Platform          Available   Compiler    Supports   test-lock
3983dnl                   flavours    option      weak       result
3984dnl ---------------   ---------   ---------   --------   ---------
3985dnl Linux 2.4/glibc   posix       -lpthread       Y      OK
3986dnl
3987dnl GNU Hurd/glibc    posix
3988dnl
3989dnl FreeBSD 5.3       posix       -lc_r           Y
3990dnl                   posix       -lkse ?         Y
3991dnl                   posix       -lpthread ?     Y
3992dnl                   posix       -lthr           Y
3993dnl
3994dnl FreeBSD 5.2       posix       -lc_r           Y
3995dnl                   posix       -lkse           Y
3996dnl                   posix       -lthr           Y
3997dnl
3998dnl FreeBSD 4.0,4.10  posix       -lc_r           Y      OK
3999dnl
4000dnl NetBSD 1.6        --
4001dnl
4002dnl OpenBSD 3.4       posix       -lpthread       Y      OK
4003dnl
4004dnl MacOS X 10.[123]  posix       -lpthread       Y      OK
4005dnl
4006dnl Solaris 7,8,9     posix       -lpthread       Y      Sol 7,8: 0.0; Sol 9: OK
4007dnl                   solaris     -lthread        Y      Sol 7,8: 0.0; Sol 9: OK
4008dnl
4009dnl HP-UX 11          posix       -lpthread       N (cc) OK
4010dnl                                               Y (gcc)
4011dnl
4012dnl IRIX 6.5          posix       -lpthread       Y      0.5
4013dnl
4014dnl AIX 4.3,5.1       posix       -lpthread       N      AIX 4: 0.5; AIX 5: OK
4015dnl
4016dnl OSF/1 4.0,5.1     posix       -pthread (cc)   N      OK
4017dnl                               -lpthread (gcc) Y
4018dnl
4019dnl Cygwin            posix       -lpthread       Y      OK
4020dnl
4021dnl Any of the above  pth         -lpth                  0.0
4022dnl
4023dnl Mingw             win32                       N      OK
4024dnl
4025dnl BeOS 5            --
4026dnl
4027dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is
4028dnl turned off:
4029dnl   OK if all three tests terminate OK,
4030dnl   0.5 if the first test terminates OK but the second one loops endlessly,
4031dnl   0.0 if the first test already loops endlessly.
4032
4033# uintmax_t.m4 serial 12
4034dnl Copyright (C) 1997-2004, 2007-2010 Free Software Foundation, Inc.
4035dnl This file is free software; the Free Software Foundation
4036dnl gives unlimited permission to copy and/or distribute it,
4037dnl with or without modifications, as long as this notice is preserved.
4038
4039dnl From Paul Eggert.
4040
4041AC_PREREQ([2.13])
4042
4043# Define uintmax_t to 'unsigned long' or 'unsigned long long'
4044# if it is not already defined in <stdint.h> or <inttypes.h>.
4045
4046AC_DEFUN([gl_AC_TYPE_UINTMAX_T],
4047[
4048  AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
4049  AC_REQUIRE([gl_AC_HEADER_STDINT_H])
4050  if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then
4051    AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
4052    test $ac_cv_type_unsigned_long_long_int = yes \
4053      && ac_type='unsigned long long' \
4054      || ac_type='unsigned long'
4055    AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type],
4056      [Define to unsigned long or unsigned long long
4057       if <stdint.h> and <inttypes.h> don't define.])
4058  else
4059    AC_DEFINE([HAVE_UINTMAX_T], [1],
4060      [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
4061  fi
4062])
4063
4064# visibility.m4 serial 3 (gettext-0.18)
4065dnl Copyright (C) 2005, 2008-2010 Free Software Foundation, Inc.
4066dnl This file is free software; the Free Software Foundation
4067dnl gives unlimited permission to copy and/or distribute it,
4068dnl with or without modifications, as long as this notice is preserved.
4069
4070dnl From Bruno Haible.
4071
4072dnl Tests whether the compiler supports the command-line option
4073dnl -fvisibility=hidden and the function and variable attributes
4074dnl __attribute__((__visibility__("hidden"))) and
4075dnl __attribute__((__visibility__("default"))).
4076dnl Does *not* test for __visibility__("protected") - which has tricky
4077dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on
4078dnl MacOS X.
4079dnl Does *not* test for __visibility__("internal") - which has processor
4080dnl dependent semantics.
4081dnl Does *not* test for #pragma GCC visibility push(hidden) - which is
4082dnl "really only recommended for legacy code".
4083dnl Set the variable CFLAG_VISIBILITY.
4084dnl Defines and sets the variable HAVE_VISIBILITY.
4085
4086AC_DEFUN([gl_VISIBILITY],
4087[
4088  AC_REQUIRE([AC_PROG_CC])
4089  CFLAG_VISIBILITY=
4090  HAVE_VISIBILITY=0
4091  if test -n "$GCC"; then
4092    dnl First, check whether -Werror can be added to the command line, or
4093    dnl whether it leads to an error because of some other option that the
4094    dnl user has put into $CC $CFLAGS $CPPFLAGS.
4095    AC_MSG_CHECKING([whether the -Werror option is usable])
4096    AC_CACHE_VAL([gl_cv_cc_vis_werror], [
4097      gl_save_CFLAGS="$CFLAGS"
4098      CFLAGS="$CFLAGS -Werror"
4099      AC_TRY_COMPILE([], [],
4100        [gl_cv_cc_vis_werror=yes],
4101        [gl_cv_cc_vis_werror=no])
4102      CFLAGS="$gl_save_CFLAGS"])
4103    AC_MSG_RESULT([$gl_cv_cc_vis_werror])
4104    dnl Now check whether visibility declarations are supported.
4105    AC_MSG_CHECKING([for simple visibility declarations])
4106    AC_CACHE_VAL([gl_cv_cc_visibility], [
4107      gl_save_CFLAGS="$CFLAGS"
4108      CFLAGS="$CFLAGS -fvisibility=hidden"
4109      dnl We use the option -Werror and a function dummyfunc, because on some
4110      dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning
4111      dnl "visibility attribute not supported in this configuration; ignored"
4112      dnl at the first function definition in every compilation unit, and we
4113      dnl don't want to use the option in this case.
4114      if test $gl_cv_cc_vis_werror = yes; then
4115        CFLAGS="$CFLAGS -Werror"
4116      fi
4117      AC_TRY_COMPILE(
4118        [extern __attribute__((__visibility__("hidden"))) int hiddenvar;
4119         extern __attribute__((__visibility__("default"))) int exportedvar;
4120         extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void);
4121         extern __attribute__((__visibility__("default"))) int exportedfunc (void);
4122         void dummyfunc (void) {}],
4123        [],
4124        [gl_cv_cc_visibility=yes],
4125        [gl_cv_cc_visibility=no])
4126      CFLAGS="$gl_save_CFLAGS"])
4127    AC_MSG_RESULT([$gl_cv_cc_visibility])
4128    if test $gl_cv_cc_visibility = yes; then
4129      CFLAG_VISIBILITY="-fvisibility=hidden"
4130      HAVE_VISIBILITY=1
4131    fi
4132  fi
4133  AC_SUBST([CFLAG_VISIBILITY])
4134  AC_SUBST([HAVE_VISIBILITY])
4135  AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY],
4136    [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.])
4137])
4138
4139# wchar_t.m4 serial 3 (gettext-0.18)
4140dnl Copyright (C) 2002-2003, 2008-2010 Free Software Foundation, Inc.
4141dnl This file is free software; the Free Software Foundation
4142dnl gives unlimited permission to copy and/or distribute it,
4143dnl with or without modifications, as long as this notice is preserved.
4144
4145dnl From Bruno Haible.
4146dnl Test whether <stddef.h> has the 'wchar_t' type.
4147dnl Prerequisite: AC_PROG_CC
4148
4149AC_DEFUN([gt_TYPE_WCHAR_T],
4150[
4151  AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t],
4152    [AC_TRY_COMPILE([#include <stddef.h>
4153       wchar_t foo = (wchar_t)'\0';], ,
4154       [gt_cv_c_wchar_t=yes], [gt_cv_c_wchar_t=no])])
4155  if test $gt_cv_c_wchar_t = yes; then
4156    AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.])
4157  fi
4158])
4159
4160# wint_t.m4 serial 4 (gettext-0.18)
4161dnl Copyright (C) 2003, 2007-2010 Free Software Foundation, Inc.
4162dnl This file is free software; the Free Software Foundation
4163dnl gives unlimited permission to copy and/or distribute it,
4164dnl with or without modifications, as long as this notice is preserved.
4165
4166dnl From Bruno Haible.
4167dnl Test whether <wchar.h> has the 'wint_t' type.
4168dnl Prerequisite: AC_PROG_CC
4169
4170AC_DEFUN([gt_TYPE_WINT_T],
4171[
4172  AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t],
4173    [AC_TRY_COMPILE([
4174/* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
4175   <wchar.h>.
4176   BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included
4177   before <wchar.h>.  */
4178#include <stddef.h>
4179#include <stdio.h>
4180#include <time.h>
4181#include <wchar.h>
4182       wint_t foo = (wchar_t)'\0';], ,
4183       [gt_cv_c_wint_t=yes], [gt_cv_c_wint_t=no])])
4184  if test $gt_cv_c_wint_t = yes; then
4185    AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.])
4186  fi
4187])
4188
4189# xsize.m4 serial 4
4190dnl Copyright (C) 2003-2004, 2008-2010 Free Software Foundation, Inc.
4191dnl This file is free software; the Free Software Foundation
4192dnl gives unlimited permission to copy and/or distribute it,
4193dnl with or without modifications, as long as this notice is preserved.
4194
4195AC_DEFUN([gl_XSIZE],
4196[
4197  dnl Prerequisites of lib/xsize.h.
4198  AC_REQUIRE([gl_SIZE_MAX])
4199  AC_REQUIRE([AC_C_INLINE])
4200  AC_CHECK_HEADERS([stdint.h])
4201])
4202
4203# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
4204#
4205# This file is free software; the Free Software Foundation
4206# gives unlimited permission to copy and/or distribute it,
4207# with or without modifications, as long as this notice is preserved.
4208
4209# AM_AUTOMAKE_VERSION(VERSION)
4210# ----------------------------
4211# Automake X.Y traces this macro to ensure aclocal.m4 has been
4212# generated from the m4 files accompanying Automake X.Y.
4213# (This private macro should not be called outside this file.)
4214AC_DEFUN([AM_AUTOMAKE_VERSION],
4215[am__api_version='1.11'
4216dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
4217dnl require some minimum version.  Point them to the right macro.
4218m4_if([$1], [1.11.1], [],
4219      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
4220])
4221
4222# _AM_AUTOCONF_VERSION(VERSION)
4223# -----------------------------
4224# aclocal traces this macro to find the Autoconf version.
4225# This is a private macro too.  Using m4_define simplifies
4226# the logic in aclocal, which can simply ignore this definition.
4227m4_define([_AM_AUTOCONF_VERSION], [])
4228
4229# AM_SET_CURRENT_AUTOMAKE_VERSION
4230# -------------------------------
4231# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
4232# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
4233AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
4234[AM_AUTOMAKE_VERSION([1.11.1])dnl
4235m4_ifndef([AC_AUTOCONF_VERSION],
4236  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
4237_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
4238
4239# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
4240
4241# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
4242#
4243# This file is free software; the Free Software Foundation
4244# gives unlimited permission to copy and/or distribute it,
4245# with or without modifications, as long as this notice is preserved.
4246
4247# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
4248# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
4249# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
4250#
4251# Of course, Automake must honor this variable whenever it calls a
4252# tool from the auxiliary directory.  The problem is that $srcdir (and
4253# therefore $ac_aux_dir as well) can be either absolute or relative,
4254# depending on how configure is run.  This is pretty annoying, since
4255# it makes $ac_aux_dir quite unusable in subdirectories: in the top
4256# source directory, any form will work fine, but in subdirectories a
4257# relative path needs to be adjusted first.
4258#
4259# $ac_aux_dir/missing
4260#    fails when called from a subdirectory if $ac_aux_dir is relative
4261# $top_srcdir/$ac_aux_dir/missing
4262#    fails if $ac_aux_dir is absolute,
4263#    fails when called from a subdirectory in a VPATH build with
4264#          a relative $ac_aux_dir
4265#
4266# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
4267# are both prefixed by $srcdir.  In an in-source build this is usually
4268# harmless because $srcdir is `.', but things will broke when you
4269# start a VPATH build or use an absolute $srcdir.
4270#
4271# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
4272# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
4273#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
4274# and then we would define $MISSING as
4275#   MISSING="\${SHELL} $am_aux_dir/missing"
4276# This will work as long as MISSING is not called from configure, because
4277# unfortunately $(top_srcdir) has no meaning in configure.
4278# However there are other variables, like CC, which are often used in
4279# configure, and could therefore not use this "fixed" $ac_aux_dir.
4280#
4281# Another solution, used here, is to always expand $ac_aux_dir to an
4282# absolute PATH.  The drawback is that using absolute paths prevent a
4283# configured tree to be moved without reconfiguration.
4284
4285AC_DEFUN([AM_AUX_DIR_EXPAND],
4286[dnl Rely on autoconf to set up CDPATH properly.
4287AC_PREREQ([2.50])dnl
4288# expand $ac_aux_dir to an absolute path
4289am_aux_dir=`cd $ac_aux_dir && pwd`
4290])
4291
4292# AM_CONDITIONAL                                            -*- Autoconf -*-
4293
4294# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
4295# Free Software Foundation, Inc.
4296#
4297# This file is free software; the Free Software Foundation
4298# gives unlimited permission to copy and/or distribute it,
4299# with or without modifications, as long as this notice is preserved.
4300
4301# serial 9
4302
4303# AM_CONDITIONAL(NAME, SHELL-CONDITION)
4304# -------------------------------------
4305# Define a conditional.
4306AC_DEFUN([AM_CONDITIONAL],
4307[AC_PREREQ(2.52)dnl
4308 ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
4309	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
4310AC_SUBST([$1_TRUE])dnl
4311AC_SUBST([$1_FALSE])dnl
4312_AM_SUBST_NOTMAKE([$1_TRUE])dnl
4313_AM_SUBST_NOTMAKE([$1_FALSE])dnl
4314m4_define([_AM_COND_VALUE_$1], [$2])dnl
4315if $2; then
4316  $1_TRUE=
4317  $1_FALSE='#'
4318else
4319  $1_TRUE='#'
4320  $1_FALSE=
4321fi
4322AC_CONFIG_COMMANDS_PRE(
4323[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
4324  AC_MSG_ERROR([[conditional "$1" was never defined.
4325Usually this means the macro was only invoked conditionally.]])
4326fi])])
4327
4328# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
4329# Free Software Foundation, Inc.
4330#
4331# This file is free software; the Free Software Foundation
4332# gives unlimited permission to copy and/or distribute it,
4333# with or without modifications, as long as this notice is preserved.
4334
4335# serial 10
4336
4337# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
4338# written in clear, in which case automake, when reading aclocal.m4,
4339# will think it sees a *use*, and therefore will trigger all it's
4340# C support machinery.  Also note that it means that autoscan, seeing
4341# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
4342
4343
4344# _AM_DEPENDENCIES(NAME)
4345# ----------------------
4346# See how the compiler implements dependency checking.
4347# NAME is "CC", "CXX", "GCJ", or "OBJC".
4348# We try a few techniques and use that to set a single cache variable.
4349#
4350# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
4351# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
4352# dependency, and given that the user is not expected to run this macro,
4353# just rely on AC_PROG_CC.
4354AC_DEFUN([_AM_DEPENDENCIES],
4355[AC_REQUIRE([AM_SET_DEPDIR])dnl
4356AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
4357AC_REQUIRE([AM_MAKE_INCLUDE])dnl
4358AC_REQUIRE([AM_DEP_TRACK])dnl
4359
4360ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
4361       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
4362       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
4363       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
4364       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
4365                   [depcc="$$1"   am_compiler_list=])
4366
4367AC_CACHE_CHECK([dependency style of $depcc],
4368               [am_cv_$1_dependencies_compiler_type],
4369[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4370  # We make a subdir and do the tests there.  Otherwise we can end up
4371  # making bogus files that we don't know about and never remove.  For
4372  # instance it was reported that on HP-UX the gcc test will end up
4373  # making a dummy file named `D' -- because `-MD' means `put the output
4374  # in D'.
4375  mkdir conftest.dir
4376  # Copy depcomp to subdir because otherwise we won't find it if we're
4377  # using a relative directory.
4378  cp "$am_depcomp" conftest.dir
4379  cd conftest.dir
4380  # We will build objects and dependencies in a subdirectory because
4381  # it helps to detect inapplicable dependency modes.  For instance
4382  # both Tru64's cc and ICC support -MD to output dependencies as a
4383  # side effect of compilation, but ICC will put the dependencies in
4384  # the current directory while Tru64 will put them in the object
4385  # directory.
4386  mkdir sub
4387
4388  am_cv_$1_dependencies_compiler_type=none
4389  if test "$am_compiler_list" = ""; then
4390     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
4391  fi
4392  am__universal=false
4393  m4_case([$1], [CC],
4394    [case " $depcc " in #(
4395     *\ -arch\ *\ -arch\ *) am__universal=true ;;
4396     esac],
4397    [CXX],
4398    [case " $depcc " in #(
4399     *\ -arch\ *\ -arch\ *) am__universal=true ;;
4400     esac])
4401
4402  for depmode in $am_compiler_list; do
4403    # Setup a source with many dependencies, because some compilers
4404    # like to wrap large dependency lists on column 80 (with \), and
4405    # we should not choose a depcomp mode which is confused by this.
4406    #
4407    # We need to recreate these files for each test, as the compiler may
4408    # overwrite some of them when testing with obscure command lines.
4409    # This happens at least with the AIX C compiler.
4410    : > sub/conftest.c
4411    for i in 1 2 3 4 5 6; do
4412      echo '#include "conftst'$i'.h"' >> sub/conftest.c
4413      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
4414      # Solaris 8's {/usr,}/bin/sh.
4415      touch sub/conftst$i.h
4416    done
4417    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
4418
4419    # We check with `-c' and `-o' for the sake of the "dashmstdout"
4420    # mode.  It turns out that the SunPro C++ compiler does not properly
4421    # handle `-M -o', and we need to detect this.  Also, some Intel
4422    # versions had trouble with output in subdirs
4423    am__obj=sub/conftest.${OBJEXT-o}
4424    am__minus_obj="-o $am__obj"
4425    case $depmode in
4426    gcc)
4427      # This depmode causes a compiler race in universal mode.
4428      test "$am__universal" = false || continue
4429      ;;
4430    nosideeffect)
4431      # after this tag, mechanisms are not by side-effect, so they'll
4432      # only be used when explicitly requested
4433      if test "x$enable_dependency_tracking" = xyes; then
4434	continue
4435      else
4436	break
4437      fi
4438      ;;
4439    msvisualcpp | msvcmsys)
4440      # This compiler won't grok `-c -o', but also, the minuso test has
4441      # not run yet.  These depmodes are late enough in the game, and
4442      # so weak that their functioning should not be impacted.
4443      am__obj=conftest.${OBJEXT-o}
4444      am__minus_obj=
4445      ;;
4446    none) break ;;
4447    esac
4448    if depmode=$depmode \
4449       source=sub/conftest.c object=$am__obj \
4450       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
4451       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
4452         >/dev/null 2>conftest.err &&
4453       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
4454       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
4455       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
4456       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
4457      # icc doesn't choke on unknown options, it will just issue warnings
4458      # or remarks (even with -Werror).  So we grep stderr for any message
4459      # that says an option was ignored or not supported.
4460      # When given -MP, icc 7.0 and 7.1 complain thusly:
4461      #   icc: Command line warning: ignoring option '-M'; no argument required
4462      # The diagnosis changed in icc 8.0:
4463      #   icc: Command line remark: option '-MP' not supported
4464      if (grep 'ignoring option' conftest.err ||
4465          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
4466        am_cv_$1_dependencies_compiler_type=$depmode
4467        break
4468      fi
4469    fi
4470  done
4471
4472  cd ..
4473  rm -rf conftest.dir
4474else
4475  am_cv_$1_dependencies_compiler_type=none
4476fi
4477])
4478AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
4479AM_CONDITIONAL([am__fastdep$1], [
4480  test "x$enable_dependency_tracking" != xno \
4481  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
4482])
4483
4484
4485# AM_SET_DEPDIR
4486# -------------
4487# Choose a directory name for dependency files.
4488# This macro is AC_REQUIREd in _AM_DEPENDENCIES
4489AC_DEFUN([AM_SET_DEPDIR],
4490[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
4491AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
4492])
4493
4494
4495# AM_DEP_TRACK
4496# ------------
4497AC_DEFUN([AM_DEP_TRACK],
4498[AC_ARG_ENABLE(dependency-tracking,
4499[  --disable-dependency-tracking  speeds up one-time build
4500  --enable-dependency-tracking   do not reject slow dependency extractors])
4501if test "x$enable_dependency_tracking" != xno; then
4502  am_depcomp="$ac_aux_dir/depcomp"
4503  AMDEPBACKSLASH='\'
4504fi
4505AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
4506AC_SUBST([AMDEPBACKSLASH])dnl
4507_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
4508])
4509
4510# Generate code to set up dependency tracking.              -*- Autoconf -*-
4511
4512# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
4513# Free Software Foundation, Inc.
4514#
4515# This file is free software; the Free Software Foundation
4516# gives unlimited permission to copy and/or distribute it,
4517# with or without modifications, as long as this notice is preserved.
4518
4519#serial 5
4520
4521# _AM_OUTPUT_DEPENDENCY_COMMANDS
4522# ------------------------------
4523AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
4524[{
4525  # Autoconf 2.62 quotes --file arguments for eval, but not when files
4526  # are listed without --file.  Let's play safe and only enable the eval
4527  # if we detect the quoting.
4528  case $CONFIG_FILES in
4529  *\'*) eval set x "$CONFIG_FILES" ;;
4530  *)   set x $CONFIG_FILES ;;
4531  esac
4532  shift
4533  for mf
4534  do
4535    # Strip MF so we end up with the name of the file.
4536    mf=`echo "$mf" | sed -e 's/:.*$//'`
4537    # Check whether this is an Automake generated Makefile or not.
4538    # We used to match only the files named `Makefile.in', but
4539    # some people rename them; so instead we look at the file content.
4540    # Grep'ing the first line is not enough: some people post-process
4541    # each Makefile.in and add a new line on top of each file to say so.
4542    # Grep'ing the whole file is not good either: AIX grep has a line
4543    # limit of 2048, but all sed's we know have understand at least 4000.
4544    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
4545      dirpart=`AS_DIRNAME("$mf")`
4546    else
4547      continue
4548    fi
4549    # Extract the definition of DEPDIR, am__include, and am__quote
4550    # from the Makefile without running `make'.
4551    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
4552    test -z "$DEPDIR" && continue
4553    am__include=`sed -n 's/^am__include = //p' < "$mf"`
4554    test -z "am__include" && continue
4555    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
4556    # When using ansi2knr, U may be empty or an underscore; expand it
4557    U=`sed -n 's/^U = //p' < "$mf"`
4558    # Find all dependency output files, they are included files with
4559    # $(DEPDIR) in their names.  We invoke sed twice because it is the
4560    # simplest approach to changing $(DEPDIR) to its actual value in the
4561    # expansion.
4562    for file in `sed -n "
4563      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
4564	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
4565      # Make sure the directory exists.
4566      test -f "$dirpart/$file" && continue
4567      fdir=`AS_DIRNAME(["$file"])`
4568      AS_MKDIR_P([$dirpart/$fdir])
4569      # echo "creating $dirpart/$file"
4570      echo '# dummy' > "$dirpart/$file"
4571    done
4572  done
4573}
4574])# _AM_OUTPUT_DEPENDENCY_COMMANDS
4575
4576
4577# AM_OUTPUT_DEPENDENCY_COMMANDS
4578# -----------------------------
4579# This macro should only be invoked once -- use via AC_REQUIRE.
4580#
4581# This code is only required when automatic dependency tracking
4582# is enabled.  FIXME.  This creates each `.P' file that we will
4583# need in order to bootstrap the dependency handling code.
4584AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
4585[AC_CONFIG_COMMANDS([depfiles],
4586     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
4587     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
4588])
4589
4590# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
4591# Free Software Foundation, Inc.
4592#
4593# This file is free software; the Free Software Foundation
4594# gives unlimited permission to copy and/or distribute it,
4595# with or without modifications, as long as this notice is preserved.
4596
4597# serial 8
4598
4599# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
4600AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
4601
4602# Do all the work for Automake.                             -*- Autoconf -*-
4603
4604# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4605# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
4606#
4607# This file is free software; the Free Software Foundation
4608# gives unlimited permission to copy and/or distribute it,
4609# with or without modifications, as long as this notice is preserved.
4610
4611# serial 16
4612
4613# This macro actually does too much.  Some checks are only needed if
4614# your package does certain things.  But this isn't really a big deal.
4615
4616# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
4617# AM_INIT_AUTOMAKE([OPTIONS])
4618# -----------------------------------------------
4619# The call with PACKAGE and VERSION arguments is the old style
4620# call (pre autoconf-2.50), which is being phased out.  PACKAGE
4621# and VERSION should now be passed to AC_INIT and removed from
4622# the call to AM_INIT_AUTOMAKE.
4623# We support both call styles for the transition.  After
4624# the next Automake release, Autoconf can make the AC_INIT
4625# arguments mandatory, and then we can depend on a new Autoconf
4626# release and drop the old call support.
4627AC_DEFUN([AM_INIT_AUTOMAKE],
4628[AC_PREREQ([2.62])dnl
4629dnl Autoconf wants to disallow AM_ names.  We explicitly allow
4630dnl the ones we care about.
4631m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
4632AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
4633AC_REQUIRE([AC_PROG_INSTALL])dnl
4634if test "`cd $srcdir && pwd`" != "`pwd`"; then
4635  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
4636  # is not polluted with repeated "-I."
4637  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
4638  # test to see if srcdir already configured
4639  if test -f $srcdir/config.status; then
4640    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
4641  fi
4642fi
4643
4644# test whether we have cygpath
4645if test -z "$CYGPATH_W"; then
4646  if (cygpath --version) >/dev/null 2>/dev/null; then
4647    CYGPATH_W='cygpath -w'
4648  else
4649    CYGPATH_W=echo
4650  fi
4651fi
4652AC_SUBST([CYGPATH_W])
4653
4654# Define the identity of the package.
4655dnl Distinguish between old-style and new-style calls.
4656m4_ifval([$2],
4657[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
4658 AC_SUBST([PACKAGE], [$1])dnl
4659 AC_SUBST([VERSION], [$2])],
4660[_AM_SET_OPTIONS([$1])dnl
4661dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
4662m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
4663  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
4664 AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
4665 AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
4666
4667_AM_IF_OPTION([no-define],,
4668[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
4669 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
4670
4671# Some tools Automake needs.
4672AC_REQUIRE([AM_SANITY_CHECK])dnl
4673AC_REQUIRE([AC_ARG_PROGRAM])dnl
4674AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
4675AM_MISSING_PROG(AUTOCONF, autoconf)
4676AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
4677AM_MISSING_PROG(AUTOHEADER, autoheader)
4678AM_MISSING_PROG(MAKEINFO, makeinfo)
4679AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
4680AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
4681AC_REQUIRE([AM_PROG_MKDIR_P])dnl
4682# We need awk for the "check" target.  The system "awk" is bad on
4683# some platforms.
4684AC_REQUIRE([AC_PROG_AWK])dnl
4685AC_REQUIRE([AC_PROG_MAKE_SET])dnl
4686AC_REQUIRE([AM_SET_LEADING_DOT])dnl
4687_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
4688	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
4689			     [_AM_PROG_TAR([v7])])])
4690_AM_IF_OPTION([no-dependencies],,
4691[AC_PROVIDE_IFELSE([AC_PROG_CC],
4692		  [_AM_DEPENDENCIES(CC)],
4693		  [define([AC_PROG_CC],
4694			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
4695AC_PROVIDE_IFELSE([AC_PROG_CXX],
4696		  [_AM_DEPENDENCIES(CXX)],
4697		  [define([AC_PROG_CXX],
4698			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
4699AC_PROVIDE_IFELSE([AC_PROG_OBJC],
4700		  [_AM_DEPENDENCIES(OBJC)],
4701		  [define([AC_PROG_OBJC],
4702			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
4703])
4704_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
4705dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
4706dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
4707dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
4708AC_CONFIG_COMMANDS_PRE(dnl
4709[m4_provide_if([_AM_COMPILER_EXEEXT],
4710  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
4711])
4712
4713dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
4714dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
4715dnl mangled by Autoconf and run in a shell conditional statement.
4716m4_define([_AC_COMPILER_EXEEXT],
4717m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
4718
4719
4720# When config.status generates a header, we must update the stamp-h file.
4721# This file resides in the same directory as the config header
4722# that is generated.  The stamp files are numbered to have different names.
4723
4724# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
4725# loop where config.status creates the headers, so we can generate
4726# our stamp files there.
4727AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
4728[# Compute $1's index in $config_headers.
4729_am_arg=$1
4730_am_stamp_count=1
4731for _am_header in $config_headers :; do
4732  case $_am_header in
4733    $_am_arg | $_am_arg:* )
4734      break ;;
4735    * )
4736      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
4737  esac
4738done
4739echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
4740
4741# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
4742#
4743# This file is free software; the Free Software Foundation
4744# gives unlimited permission to copy and/or distribute it,
4745# with or without modifications, as long as this notice is preserved.
4746
4747# AM_PROG_INSTALL_SH
4748# ------------------
4749# Define $install_sh.
4750AC_DEFUN([AM_PROG_INSTALL_SH],
4751[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4752if test x"${install_sh}" != xset; then
4753  case $am_aux_dir in
4754  *\ * | *\	*)
4755    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
4756  *)
4757    install_sh="\${SHELL} $am_aux_dir/install-sh"
4758  esac
4759fi
4760AC_SUBST(install_sh)])
4761
4762# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
4763#
4764# This file is free software; the Free Software Foundation
4765# gives unlimited permission to copy and/or distribute it,
4766# with or without modifications, as long as this notice is preserved.
4767
4768# serial 2
4769
4770# Check whether the underlying file-system supports filenames
4771# with a leading dot.  For instance MS-DOS doesn't.
4772AC_DEFUN([AM_SET_LEADING_DOT],
4773[rm -rf .tst 2>/dev/null
4774mkdir .tst 2>/dev/null
4775if test -d .tst; then
4776  am__leading_dot=.
4777else
4778  am__leading_dot=_
4779fi
4780rmdir .tst 2>/dev/null
4781AC_SUBST([am__leading_dot])])
4782
4783# Check to see how 'make' treats includes.	            -*- Autoconf -*-
4784
4785# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
4786#
4787# This file is free software; the Free Software Foundation
4788# gives unlimited permission to copy and/or distribute it,
4789# with or without modifications, as long as this notice is preserved.
4790
4791# serial 4
4792
4793# AM_MAKE_INCLUDE()
4794# -----------------
4795# Check to see how make treats includes.
4796AC_DEFUN([AM_MAKE_INCLUDE],
4797[am_make=${MAKE-make}
4798cat > confinc << 'END'
4799am__doit:
4800	@echo this is the am__doit target
4801.PHONY: am__doit
4802END
4803# If we don't find an include directive, just comment out the code.
4804AC_MSG_CHECKING([for style of include used by $am_make])
4805am__include="#"
4806am__quote=
4807_am_result=none
4808# First try GNU make style include.
4809echo "include confinc" > confmf
4810# Ignore all kinds of additional output from `make'.
4811case `$am_make -s -f confmf 2> /dev/null` in #(
4812*the\ am__doit\ target*)
4813  am__include=include
4814  am__quote=
4815  _am_result=GNU
4816  ;;
4817esac
4818# Now try BSD make style include.
4819if test "$am__include" = "#"; then
4820   echo '.include "confinc"' > confmf
4821   case `$am_make -s -f confmf 2> /dev/null` in #(
4822   *the\ am__doit\ target*)
4823     am__include=.include
4824     am__quote="\""
4825     _am_result=BSD
4826     ;;
4827   esac
4828fi
4829AC_SUBST([am__include])
4830AC_SUBST([am__quote])
4831AC_MSG_RESULT([$_am_result])
4832rm -f confinc confmf
4833])
4834
4835# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
4836
4837# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
4838# Free Software Foundation, Inc.
4839#
4840# This file is free software; the Free Software Foundation
4841# gives unlimited permission to copy and/or distribute it,
4842# with or without modifications, as long as this notice is preserved.
4843
4844# serial 6
4845
4846# AM_MISSING_PROG(NAME, PROGRAM)
4847# ------------------------------
4848AC_DEFUN([AM_MISSING_PROG],
4849[AC_REQUIRE([AM_MISSING_HAS_RUN])
4850$1=${$1-"${am_missing_run}$2"}
4851AC_SUBST($1)])
4852
4853
4854# AM_MISSING_HAS_RUN
4855# ------------------
4856# Define MISSING if not defined so far and test if it supports --run.
4857# If it does, set am_missing_run to use it, otherwise, to nothing.
4858AC_DEFUN([AM_MISSING_HAS_RUN],
4859[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
4860AC_REQUIRE_AUX_FILE([missing])dnl
4861if test x"${MISSING+set}" != xset; then
4862  case $am_aux_dir in
4863  *\ * | *\	*)
4864    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
4865  *)
4866    MISSING="\${SHELL} $am_aux_dir/missing" ;;
4867  esac
4868fi
4869# Use eval to expand $SHELL
4870if eval "$MISSING --run true"; then
4871  am_missing_run="$MISSING --run "
4872else
4873  am_missing_run=
4874  AC_MSG_WARN([`missing' script is too old or missing])
4875fi
4876])
4877
4878# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
4879#
4880# This file is free software; the Free Software Foundation
4881# gives unlimited permission to copy and/or distribute it,
4882# with or without modifications, as long as this notice is preserved.
4883
4884# AM_PROG_MKDIR_P
4885# ---------------
4886# Check for `mkdir -p'.
4887AC_DEFUN([AM_PROG_MKDIR_P],
4888[AC_PREREQ([2.60])dnl
4889AC_REQUIRE([AC_PROG_MKDIR_P])dnl
4890dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
4891dnl while keeping a definition of mkdir_p for backward compatibility.
4892dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
4893dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
4894dnl Makefile.ins that do not define MKDIR_P, so we do our own
4895dnl adjustment using top_builddir (which is defined more often than
4896dnl MKDIR_P).
4897AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
4898case $mkdir_p in
4899  [[\\/$]]* | ?:[[\\/]]*) ;;
4900  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
4901esac
4902])
4903
4904# Helper functions for option handling.                     -*- Autoconf -*-
4905
4906# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
4907#
4908# This file is free software; the Free Software Foundation
4909# gives unlimited permission to copy and/or distribute it,
4910# with or without modifications, as long as this notice is preserved.
4911
4912# serial 4
4913
4914# _AM_MANGLE_OPTION(NAME)
4915# -----------------------
4916AC_DEFUN([_AM_MANGLE_OPTION],
4917[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
4918
4919# _AM_SET_OPTION(NAME)
4920# ------------------------------
4921# Set option NAME.  Presently that only means defining a flag for this option.
4922AC_DEFUN([_AM_SET_OPTION],
4923[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
4924
4925# _AM_SET_OPTIONS(OPTIONS)
4926# ----------------------------------
4927# OPTIONS is a space-separated list of Automake options.
4928AC_DEFUN([_AM_SET_OPTIONS],
4929[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
4930
4931# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
4932# -------------------------------------------
4933# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
4934AC_DEFUN([_AM_IF_OPTION],
4935[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
4936
4937# Check to make sure that the build environment is sane.    -*- Autoconf -*-
4938
4939# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
4940# Free Software Foundation, Inc.
4941#
4942# This file is free software; the Free Software Foundation
4943# gives unlimited permission to copy and/or distribute it,
4944# with or without modifications, as long as this notice is preserved.
4945
4946# serial 5
4947
4948# AM_SANITY_CHECK
4949# ---------------
4950AC_DEFUN([AM_SANITY_CHECK],
4951[AC_MSG_CHECKING([whether build environment is sane])
4952# Just in case
4953sleep 1
4954echo timestamp > conftest.file
4955# Reject unsafe characters in $srcdir or the absolute working directory
4956# name.  Accept space and tab only in the latter.
4957am_lf='
4958'
4959case `pwd` in
4960  *[[\\\"\#\$\&\'\`$am_lf]]*)
4961    AC_MSG_ERROR([unsafe absolute working directory name]);;
4962esac
4963case $srcdir in
4964  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
4965    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
4966esac
4967
4968# Do `set' in a subshell so we don't clobber the current shell's
4969# arguments.  Must try -L first in case configure is actually a
4970# symlink; some systems play weird games with the mod time of symlinks
4971# (eg FreeBSD returns the mod time of the symlink's containing
4972# directory).
4973if (
4974   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
4975   if test "$[*]" = "X"; then
4976      # -L didn't work.
4977      set X `ls -t "$srcdir/configure" conftest.file`
4978   fi
4979   rm -f conftest.file
4980   if test "$[*]" != "X $srcdir/configure conftest.file" \
4981      && test "$[*]" != "X conftest.file $srcdir/configure"; then
4982
4983      # If neither matched, then we have a broken ls.  This can happen
4984      # if, for instance, CONFIG_SHELL is bash and it inherits a
4985      # broken ls alias from the environment.  This has actually
4986      # happened.  Such a system could not be considered "sane".
4987      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
4988alias in your environment])
4989   fi
4990
4991   test "$[2]" = conftest.file
4992   )
4993then
4994   # Ok.
4995   :
4996else
4997   AC_MSG_ERROR([newly created file is older than distributed files!
4998Check your system clock])
4999fi
5000AC_MSG_RESULT(yes)])
5001
5002# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
5003#
5004# This file is free software; the Free Software Foundation
5005# gives unlimited permission to copy and/or distribute it,
5006# with or without modifications, as long as this notice is preserved.
5007
5008# AM_PROG_INSTALL_STRIP
5009# ---------------------
5010# One issue with vendor `install' (even GNU) is that you can't
5011# specify the program used to strip binaries.  This is especially
5012# annoying in cross-compiling environments, where the build's strip
5013# is unlikely to handle the host's binaries.
5014# Fortunately install-sh will honor a STRIPPROG variable, so we
5015# always use install-sh in `make install-strip', and initialize
5016# STRIPPROG with the value of the STRIP variable (set by the user).
5017AC_DEFUN([AM_PROG_INSTALL_STRIP],
5018[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
5019# Installed binaries are usually stripped using `strip' when the user
5020# run `make install-strip'.  However `strip' might not be the right
5021# tool to use in cross-compilation environments, therefore Automake
5022# will honor the `STRIP' environment variable to overrule this program.
5023dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
5024if test "$cross_compiling" != no; then
5025  AC_CHECK_TOOL([STRIP], [strip], :)
5026fi
5027INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
5028AC_SUBST([INSTALL_STRIP_PROGRAM])])
5029
5030# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
5031#
5032# This file is free software; the Free Software Foundation
5033# gives unlimited permission to copy and/or distribute it,
5034# with or without modifications, as long as this notice is preserved.
5035
5036# serial 2
5037
5038# _AM_SUBST_NOTMAKE(VARIABLE)
5039# ---------------------------
5040# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
5041# This macro is traced by Automake.
5042AC_DEFUN([_AM_SUBST_NOTMAKE])
5043
5044# AM_SUBST_NOTMAKE(VARIABLE)
5045# ---------------------------
5046# Public sister of _AM_SUBST_NOTMAKE.
5047AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
5048
5049# Check how to create a tarball.                            -*- Autoconf -*-
5050
5051# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
5052#
5053# This file is free software; the Free Software Foundation
5054# gives unlimited permission to copy and/or distribute it,
5055# with or without modifications, as long as this notice is preserved.
5056
5057# serial 2
5058
5059# _AM_PROG_TAR(FORMAT)
5060# --------------------
5061# Check how to create a tarball in format FORMAT.
5062# FORMAT should be one of `v7', `ustar', or `pax'.
5063#
5064# Substitute a variable $(am__tar) that is a command
5065# writing to stdout a FORMAT-tarball containing the directory
5066# $tardir.
5067#     tardir=directory && $(am__tar) > result.tar
5068#
5069# Substitute a variable $(am__untar) that extract such
5070# a tarball read from stdin.
5071#     $(am__untar) < result.tar
5072AC_DEFUN([_AM_PROG_TAR],
5073[# Always define AMTAR for backward compatibility.
5074AM_MISSING_PROG([AMTAR], [tar])
5075m4_if([$1], [v7],
5076     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
5077     [m4_case([$1], [ustar],, [pax],,
5078              [m4_fatal([Unknown tar format])])
5079AC_MSG_CHECKING([how to create a $1 tar archive])
5080# Loop over all known methods to create a tar archive until one works.
5081_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
5082_am_tools=${am_cv_prog_tar_$1-$_am_tools}
5083# Do not fold the above two line into one, because Tru64 sh and
5084# Solaris sh will not grok spaces in the rhs of `-'.
5085for _am_tool in $_am_tools
5086do
5087  case $_am_tool in
5088  gnutar)
5089    for _am_tar in tar gnutar gtar;
5090    do
5091      AM_RUN_LOG([$_am_tar --version]) && break
5092    done
5093    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
5094    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
5095    am__untar="$_am_tar -xf -"
5096    ;;
5097  plaintar)
5098    # Must skip GNU tar: if it does not support --format= it doesn't create
5099    # ustar tarball either.
5100    (tar --version) >/dev/null 2>&1 && continue
5101    am__tar='tar chf - "$$tardir"'
5102    am__tar_='tar chf - "$tardir"'
5103    am__untar='tar xf -'
5104    ;;
5105  pax)
5106    am__tar='pax -L -x $1 -w "$$tardir"'
5107    am__tar_='pax -L -x $1 -w "$tardir"'
5108    am__untar='pax -r'
5109    ;;
5110  cpio)
5111    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
5112    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
5113    am__untar='cpio -i -H $1 -d'
5114    ;;
5115  none)
5116    am__tar=false
5117    am__tar_=false
5118    am__untar=false
5119    ;;
5120  esac
5121
5122  # If the value was cached, stop now.  We just wanted to have am__tar
5123  # and am__untar set.
5124  test -n "${am_cv_prog_tar_$1}" && break
5125
5126  # tar/untar a dummy directory, and stop if the command works
5127  rm -rf conftest.dir
5128  mkdir conftest.dir
5129  echo GrepMe > conftest.dir/file
5130  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
5131  rm -rf conftest.dir
5132  if test -s conftest.tar; then
5133    AM_RUN_LOG([$am__untar <conftest.tar])
5134    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
5135  fi
5136done
5137rm -rf conftest.dir
5138
5139AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
5140AC_MSG_RESULT([$am_cv_prog_tar_$1])])
5141AC_SUBST([am__tar])
5142AC_SUBST([am__untar])
5143]) # _AM_PROG_TAR
5144
5145