Update from GNU gettext 0.14.2.
[pspp] / m4 / gettext.m4
1 # gettext.m4 serial 34 (gettext-0.14.2)
2 dnl Copyright (C) 1995-2005 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6 dnl
7 dnl This file can can be used in projects which are not available under
8 dnl the GNU General Public License or the GNU Library General Public
9 dnl License but which still want to provide support for the GNU gettext
10 dnl functionality.
11 dnl Please note that the actual code of the GNU gettext library is covered
12 dnl by the GNU Library General Public License, and the rest of the GNU
13 dnl gettext package package is covered by the GNU General Public License.
14 dnl They are *not* in the public domain.
15
16 dnl Authors:
17 dnl   Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
18 dnl   Bruno Haible <haible@clisp.cons.org>, 2000-2003.
19
20 dnl Macro to add for using GNU gettext.
21
22 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
23 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
24 dnl    default (if it is not specified or empty) is 'no-libtool'.
25 dnl    INTLSYMBOL should be 'external' for packages with no intl directory,
26 dnl    and 'no-libtool' or 'use-libtool' for packages with an intl directory.
27 dnl    If INTLSYMBOL is 'use-libtool', then a libtool library
28 dnl    $(top_builddir)/intl/libintl.la will be created (shared and/or static,
29 dnl    depending on --{enable,disable}-{shared,static} and on the presence of
30 dnl    AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
31 dnl    $(top_builddir)/intl/libintl.a will be created.
32 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
33 dnl    implementations (in libc or libintl) without the ngettext() function
34 dnl    will be ignored.  If NEEDSYMBOL is specified and is
35 dnl    'need-formatstring-macros', then GNU gettext implementations that don't
36 dnl    support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
37 dnl INTLDIR is used to find the intl libraries.  If empty,
38 dnl    the value `$(top_builddir)/intl/' is used.
39 dnl
40 dnl The result of the configuration is one of three cases:
41 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
42 dnl    and used.
43 dnl    Catalog format: GNU --> install in $(datadir)
44 dnl    Catalog extension: .mo after installation, .gmo in source tree
45 dnl 2) GNU gettext has been found in the system's C library.
46 dnl    Catalog format: GNU --> install in $(datadir)
47 dnl    Catalog extension: .mo after installation, .gmo in source tree
48 dnl 3) No internationalization, always use English msgid.
49 dnl    Catalog format: none
50 dnl    Catalog extension: none
51 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
52 dnl The use of .gmo is historical (it was needed to avoid overwriting the
53 dnl GNU format catalogs when building on a platform with an X/Open gettext),
54 dnl but we keep it in order not to force irrelevant filename changes on the
55 dnl maintainers.
56 dnl
57 AC_DEFUN([AM_GNU_GETTEXT],
58 [
59   dnl Argument checking.
60   ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
61     [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
62 ])])])])])
63   ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
64     [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
65 ])])])])
66   define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
67   define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
68
69   AC_REQUIRE([AM_PO_SUBDIRS])dnl
70   ifelse(gt_included_intl, yes, [
71     AC_REQUIRE([AM_INTL_SUBDIR])dnl
72   ])
73
74   dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
75   AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
76   AC_REQUIRE([AC_LIB_RPATH])
77
78   dnl Sometimes libintl requires libiconv, so first search for libiconv.
79   dnl Ideally we would do this search only after the
80   dnl      if test "$USE_NLS" = "yes"; then
81   dnl        if test "$gt_cv_func_gnugettext_libc" != "yes"; then
82   dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
83   dnl the configure script would need to contain the same shell code
84   dnl again, outside any 'if'. There are two solutions:
85   dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
86   dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
87   dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
88   dnl documented, we avoid it.
89   ifelse(gt_included_intl, yes, , [
90     AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
91   ])
92
93   dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation.
94   gt_INTL_MACOSX
95
96   dnl Set USE_NLS.
97   AM_NLS
98
99   ifelse(gt_included_intl, yes, [
100     BUILD_INCLUDED_LIBINTL=no
101     USE_INCLUDED_LIBINTL=no
102   ])
103   LIBINTL=
104   LTLIBINTL=
105   POSUB=
106
107   dnl If we use NLS figure out what method
108   if test "$USE_NLS" = "yes"; then
109     gt_use_preinstalled_gnugettext=no
110     ifelse(gt_included_intl, yes, [
111       AC_MSG_CHECKING([whether included gettext is requested])
112       AC_ARG_WITH(included-gettext,
113         [  --with-included-gettext use the GNU gettext library included here],
114         nls_cv_force_use_gnu_gettext=$withval,
115         nls_cv_force_use_gnu_gettext=no)
116       AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
117
118       nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
119       if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
120     ])
121         dnl User does not insist on using GNU NLS library.  Figure out what
122         dnl to use.  If GNU gettext is available we use this.  Else we have
123         dnl to fall back to GNU NLS library.
124
125         dnl Add a version number to the cache macros.
126         define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
127         define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
128         define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
129
130         AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
131          [AC_TRY_LINK([#include <libintl.h>
132 ]ifelse([$2], [need-formatstring-macros],
133 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
134 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
135 #endif
136 changequote(,)dnl
137 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
138 changequote([,])dnl
139 ], [])[extern int _nl_msg_cat_cntr;
140 extern int *_nl_domain_bindings;],
141             [bindtextdomain ("", "");
142 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
143             gt_cv_func_gnugettext_libc=yes,
144             gt_cv_func_gnugettext_libc=no)])
145
146         if test "$gt_cv_func_gnugettext_libc" != "yes"; then
147           dnl Sometimes libintl requires libiconv, so first search for libiconv.
148           ifelse(gt_included_intl, yes, , [
149             AM_ICONV_LINK
150           ])
151           dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
152           dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
153           dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
154           dnl even if libiconv doesn't exist.
155           AC_LIB_LINKFLAGS_BODY([intl])
156           AC_CACHE_CHECK([for GNU gettext in libintl],
157             gt_cv_func_gnugettext_libintl,
158            [gt_save_CPPFLAGS="$CPPFLAGS"
159             CPPFLAGS="$CPPFLAGS $INCINTL"
160             gt_save_LIBS="$LIBS"
161             LIBS="$LIBS $LIBINTL"
162             dnl Now see whether libintl exists and does not depend on libiconv.
163             AC_TRY_LINK([#include <libintl.h>
164 ]ifelse([$2], [need-formatstring-macros],
165 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
166 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
167 #endif
168 changequote(,)dnl
169 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
170 changequote([,])dnl
171 ], [])[extern int _nl_msg_cat_cntr;
172 extern
173 #ifdef __cplusplus
174 "C"
175 #endif
176 const char *_nl_expand_alias (const char *);],
177               [bindtextdomain ("", "");
178 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
179               gt_cv_func_gnugettext_libintl=yes,
180               gt_cv_func_gnugettext_libintl=no)
181             dnl Now see whether libintl exists and depends on libiconv.
182             if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
183               LIBS="$LIBS $LIBICONV"
184               AC_TRY_LINK([#include <libintl.h>
185 ]ifelse([$2], [need-formatstring-macros],
186 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
187 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
188 #endif
189 changequote(,)dnl
190 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
191 changequote([,])dnl
192 ], [])[extern int _nl_msg_cat_cntr;
193 extern
194 #ifdef __cplusplus
195 "C"
196 #endif
197 const char *_nl_expand_alias (const char *);],
198                 [bindtextdomain ("", "");
199 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias ("")],
200                [LIBINTL="$LIBINTL $LIBICONV"
201                 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
202                 gt_cv_func_gnugettext_libintl=yes
203                ])
204             fi
205             CPPFLAGS="$gt_save_CPPFLAGS"
206             LIBS="$gt_save_LIBS"])
207         fi
208
209         dnl If an already present or preinstalled GNU gettext() is found,
210         dnl use it.  But if this macro is used in GNU gettext, and GNU
211         dnl gettext is already preinstalled in libintl, we update this
212         dnl libintl.  (Cf. the install rule in intl/Makefile.in.)
213         if test "$gt_cv_func_gnugettext_libc" = "yes" \
214            || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
215                 && test "$PACKAGE" != gettext-runtime \
216                 && test "$PACKAGE" != gettext-tools; }; then
217           gt_use_preinstalled_gnugettext=yes
218         else
219           dnl Reset the values set by searching for libintl.
220           LIBINTL=
221           LTLIBINTL=
222           INCINTL=
223         fi
224
225     ifelse(gt_included_intl, yes, [
226         if test "$gt_use_preinstalled_gnugettext" != "yes"; then
227           dnl GNU gettext is not found in the C library.
228           dnl Fall back on included GNU gettext library.
229           nls_cv_use_gnu_gettext=yes
230         fi
231       fi
232
233       if test "$nls_cv_use_gnu_gettext" = "yes"; then
234         dnl Mark actions used to generate GNU NLS library.
235         BUILD_INCLUDED_LIBINTL=yes
236         USE_INCLUDED_LIBINTL=yes
237         LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
238         LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
239         LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
240       fi
241
242       if test "$gt_use_preinstalled_gnugettext" = "yes" \
243          || test "$nls_cv_use_gnu_gettext" = "yes"; then
244         dnl Mark actions to use GNU gettext tools.
245         CATOBJEXT=.gmo
246       fi
247     ])
248
249     if test -n "$INTL_MACOSX_LIBS"; then
250       if test "$gt_use_preinstalled_gnugettext" = "yes" \
251          || test "$nls_cv_use_gnu_gettext" = "yes"; then
252         dnl Some extra flags are needed during linking.
253         LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
254         LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
255       fi
256     fi
257
258     if test "$gt_use_preinstalled_gnugettext" = "yes" \
259        || test "$nls_cv_use_gnu_gettext" = "yes"; then
260       AC_DEFINE(ENABLE_NLS, 1,
261         [Define to 1 if translation of program messages to the user's native language
262    is requested.])
263     else
264       USE_NLS=no
265     fi
266   fi
267
268   AC_MSG_CHECKING([whether to use NLS])
269   AC_MSG_RESULT([$USE_NLS])
270   if test "$USE_NLS" = "yes"; then
271     AC_MSG_CHECKING([where the gettext function comes from])
272     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
273       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
274         gt_source="external libintl"
275       else
276         gt_source="libc"
277       fi
278     else
279       gt_source="included intl directory"
280     fi
281     AC_MSG_RESULT([$gt_source])
282   fi
283
284   if test "$USE_NLS" = "yes"; then
285
286     if test "$gt_use_preinstalled_gnugettext" = "yes"; then
287       if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
288         AC_MSG_CHECKING([how to link with libintl])
289         AC_MSG_RESULT([$LIBINTL])
290         AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
291       fi
292
293       dnl For backward compatibility. Some packages may be using this.
294       AC_DEFINE(HAVE_GETTEXT, 1,
295        [Define if the GNU gettext() function is already present or preinstalled.])
296       AC_DEFINE(HAVE_DCGETTEXT, 1,
297        [Define if the GNU dcgettext() function is already present or preinstalled.])
298     fi
299
300     dnl We need to process the po/ directory.
301     POSUB=po
302   fi
303
304   ifelse(gt_included_intl, yes, [
305     dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
306     dnl to 'yes' because some of the testsuite requires it.
307     if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
308       BUILD_INCLUDED_LIBINTL=yes
309     fi
310
311     dnl Make all variables we use known to autoconf.
312     AC_SUBST(BUILD_INCLUDED_LIBINTL)
313     AC_SUBST(USE_INCLUDED_LIBINTL)
314     AC_SUBST(CATOBJEXT)
315
316     dnl For backward compatibility. Some configure.ins may be using this.
317     nls_cv_header_intl=
318     nls_cv_header_libgt=
319
320     dnl For backward compatibility. Some Makefiles may be using this.
321     DATADIRNAME=share
322     AC_SUBST(DATADIRNAME)
323
324     dnl For backward compatibility. Some Makefiles may be using this.
325     INSTOBJEXT=.mo
326     AC_SUBST(INSTOBJEXT)
327
328     dnl For backward compatibility. Some Makefiles may be using this.
329     GENCAT=gencat
330     AC_SUBST(GENCAT)
331
332     dnl For backward compatibility. Some Makefiles may be using this.
333     if test "$USE_INCLUDED_LIBINTL" = yes; then
334       INTLOBJS="\$(GETTOBJS)"
335     fi
336     AC_SUBST(INTLOBJS)
337
338     dnl Enable libtool support if the surrounding package wishes it.
339     INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
340     AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
341   ])
342
343   dnl For backward compatibility. Some Makefiles may be using this.
344   INTLLIBS="$LIBINTL"
345   AC_SUBST(INTLLIBS)
346
347   dnl Make all documented variables known to autoconf.
348   AC_SUBST(LIBINTL)
349   AC_SUBST(LTLIBINTL)
350   AC_SUBST(POSUB)
351 ])
352
353
354 dnl Checks for all prerequisites of the intl subdirectory,
355 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
356 dnl            USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
357 AC_DEFUN([AM_INTL_SUBDIR],
358 [
359   AC_REQUIRE([AC_PROG_INSTALL])dnl
360   AC_REQUIRE([AM_MKINSTALLDIRS])dnl
361   AC_REQUIRE([AC_PROG_CC])dnl
362   AC_REQUIRE([AC_CANONICAL_HOST])dnl
363   AC_REQUIRE([gt_GLIBC2])dnl
364   AC_REQUIRE([AC_PROG_RANLIB])dnl
365   AC_REQUIRE([AC_ISC_POSIX])dnl
366   AC_REQUIRE([AC_HEADER_STDC])dnl
367   AC_REQUIRE([AC_C_CONST])dnl
368   AC_REQUIRE([bh_C_SIGNED])dnl
369   AC_REQUIRE([AC_C_INLINE])dnl
370   AC_REQUIRE([AC_TYPE_OFF_T])dnl
371   AC_REQUIRE([AC_TYPE_SIZE_T])dnl
372   AC_REQUIRE([gl_AC_TYPE_LONG_LONG])dnl
373   AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl
374   AC_REQUIRE([gt_TYPE_WCHAR_T])dnl
375   AC_REQUIRE([gt_TYPE_WINT_T])dnl
376   AC_REQUIRE([gl_AC_HEADER_INTTYPES_H])
377   AC_REQUIRE([gl_AC_HEADER_STDINT_H])
378   AC_REQUIRE([gt_TYPE_INTMAX_T])
379   AC_REQUIRE([gt_PRINTF_POSIX])
380   AC_REQUIRE([AC_FUNC_ALLOCA])dnl
381   AC_REQUIRE([AC_FUNC_MMAP])dnl
382   AC_REQUIRE([gl_GLIBC21])dnl
383   AC_REQUIRE([gt_INTDIV0])dnl
384   AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl
385   AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
386   AC_REQUIRE([gt_INTTYPES_PRI])dnl
387   AC_REQUIRE([gl_XSIZE])dnl
388   AC_REQUIRE([gt_INTL_MACOSX])dnl
389
390   AC_CHECK_TYPE([ptrdiff_t], ,
391     [AC_DEFINE([ptrdiff_t], [long],
392        [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
393     ])
394   AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
395 stdlib.h string.h unistd.h sys/param.h])
396   AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \
397 mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \
398 strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \
399 __fsetlocking])
400
401   dnl Use the _snprintf function only if it is declared (because on NetBSD it
402   dnl is defined as a weak alias of snprintf; we prefer to use the latter).
403   gt_CHECK_DECL(_snprintf, [#include <stdio.h>])
404   gt_CHECK_DECL(_snwprintf, [#include <stdio.h>])
405
406   dnl Use the *_unlocked functions only if they are declared.
407   dnl (because some of them were defined without being declared in Solaris
408   dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built
409   dnl on Solaris 2.5.1 to run on Solaris 2.6).
410   dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13.
411   gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>])
412   gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>])
413   gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>])
414
415   case $gt_cv_func_printf_posix in
416     *yes) HAVE_POSIX_PRINTF=1 ;;
417     *) HAVE_POSIX_PRINTF=0 ;;
418   esac
419   AC_SUBST([HAVE_POSIX_PRINTF])
420   if test "$ac_cv_func_asprintf" = yes; then
421     HAVE_ASPRINTF=1
422   else
423     HAVE_ASPRINTF=0
424   fi
425   AC_SUBST([HAVE_ASPRINTF])
426   if test "$ac_cv_func_snprintf" = yes; then
427     HAVE_SNPRINTF=1
428   else
429     HAVE_SNPRINTF=0
430   fi
431   AC_SUBST([HAVE_SNPRINTF])
432   if test "$ac_cv_func_wprintf" = yes; then
433     HAVE_WPRINTF=1
434   else
435     HAVE_WPRINTF=0
436   fi
437   AC_SUBST([HAVE_WPRINTF])
438
439   AM_ICONV
440   AM_LANGINFO_CODESET
441   if test $ac_cv_header_locale_h = yes; then
442     gt_LC_MESSAGES
443   fi
444
445   if test -n "$INTL_MACOSX_LIBS"; then
446     CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
447   fi
448
449   dnl intl/plural.c is generated from intl/plural.y. It requires bison,
450   dnl because plural.y uses bison specific features. It requires at least
451   dnl bison-1.26 because earlier versions generate a plural.c that doesn't
452   dnl compile.
453   dnl bison is only needed for the maintainer (who touches plural.y). But in
454   dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
455   dnl the rule in general Makefile. Now, some people carelessly touch the
456   dnl files or have a broken "make" program, hence the plural.c rule will
457   dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
458   dnl present or too old.
459   AC_CHECK_PROGS([INTLBISON], [bison])
460   if test -z "$INTLBISON"; then
461     ac_verc_fail=yes
462   else
463     dnl Found it, now check the version.
464     AC_MSG_CHECKING([version of bison])
465 changequote(<<,>>)dnl
466     ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
467     case $ac_prog_version in
468       '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
469       1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
470 changequote([,])dnl
471          ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
472       *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
473     esac
474     AC_MSG_RESULT([$ac_prog_version])
475   fi
476   if test $ac_verc_fail = yes; then
477     INTLBISON=:
478   fi
479 ])
480
481
482 dnl Checks for special options needed on MacOS X.
483 dnl Defines INTL_MACOSX_LIBS.
484 AC_DEFUN([gt_INTL_MACOSX],
485 [
486   dnl Check for API introduced in MacOS X 10.2.
487   AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
488     gt_cv_func_CFPreferencesCopyAppValue,
489     [gt_save_CPPFLAGS="$CPPFLAGS"
490      CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
491      gt_save_LIBS="$LIBS"
492      LIBS="$LIBS -framework CoreFoundation"
493      AC_TRY_LINK([#include <CFPreferences.h>],
494        [CFPreferencesCopyAppValue(NULL, NULL)],
495        [gt_cv_func_CFPreferencesCopyAppValue=yes],
496        [gt_cv_func_CFPreferencesCopyAppValue=no])
497      CPPFLAGS="$gt_save_CPPFLAGS"
498      LIBS="$gt_save_LIBS"])
499   if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
500     AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1,
501       [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
502   fi
503   dnl Check for API introduced in MacOS X 10.3.
504   AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent,
505     [gt_save_CPPFLAGS="$CPPFLAGS"
506      CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/CoreFoundation.framework/Headers"
507      gt_save_LIBS="$LIBS"
508      LIBS="$LIBS -framework CoreFoundation"
509      AC_TRY_LINK([#include <CFLocale.h>], [CFLocaleCopyCurrent();],
510        [gt_cv_func_CFLocaleCopyCurrent=yes],
511        [gt_cv_func_CFLocaleCopyCurrent=no])
512      CPPFLAGS="$gt_save_CPPFLAGS"
513      LIBS="$gt_save_LIBS"])
514   if test $gt_cv_func_CFLocaleCopyCurrent = yes; then
515     AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1,
516       [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.])
517   fi
518   INTL_MACOSX_LIBS=
519   if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then
520     INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
521   fi
522   AC_SUBST([INTL_MACOSX_LIBS])
523 ])
524
525
526 dnl gt_CHECK_DECL(FUNC, INCLUDES)
527 dnl Check whether a function is declared.
528 AC_DEFUN([gt_CHECK_DECL],
529 [
530   AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1,
531     [AC_TRY_COMPILE([$2], [
532 #ifndef $1
533   char *p = (char *) $1;
534 #endif
535 ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)])
536   if test $ac_cv_have_decl_$1 = yes; then
537     gt_value=1
538   else
539     gt_value=0
540   fi
541   AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value],
542     [Define to 1 if you have the declaration of `$1', and to 0 if you don't.])
543 ])
544
545
546 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
547 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])