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