ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/m4/gettext.m4
Revision: 1.1
Committed: 2005-07-01T05:54:20Z (19 years ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-19, nigel-build-17, HEAD
Log Message:
Import m4 macros for external packages in case one would want to regenerate
a configure script without having those installed (e.g. on MacOS X).

File Contents

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