diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-17 07:40:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-17 07:40:35 +0000 |
commit | 59b43b4b7398858b220c55b1b38101428f8a2c0b (patch) | |
tree | b823a3c787c452ba70124cfb219e9c1bf759c171 /m4/gettext.m4 | |
parent | a0677cf8ba5ccf83f2a01fa831415717b6b4c244 (diff) | |
download | gnunet-gtk-59b43b4b7398858b220c55b1b38101428f8a2c0b.tar.gz gnunet-gtk-59b43b4b7398858b220c55b1b38101428f8a2c0b.zip |
importing 0.9.x gnunet-gtk branch
Diffstat (limited to 'm4/gettext.m4')
-rw-r--r-- | m4/gettext.m4 | 276 |
1 files changed, 85 insertions, 191 deletions
diff --git a/m4/gettext.m4 b/m4/gettext.m4 index a374f03f..c9ae1f7d 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 | |||
@@ -1,10 +1,8 @@ | |||
1 | # gettext.m4 serial 28 (gettext-0.13) | 1 | # gettext.m4 serial 60 (gettext-0.17) |
2 | dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1995-2007 Free Software Foundation, Inc. |
3 | dnl This file is free software, distributed under the terms of the GNU | 3 | dnl This file is free software; the Free Software Foundation |
4 | dnl General Public License. As a special exception to the GNU General | 4 | dnl gives unlimited permission to copy and/or distribute it, |
5 | dnl Public License, this file may be distributed as part of a program | 5 | dnl with or without modifications, as long as this notice is preserved. |
6 | dnl that contains a configuration script generated by Autoconf, under | ||
7 | dnl the same distribution terms as the rest of that program. | ||
8 | dnl | 6 | dnl |
9 | dnl This file can can be used in projects which are not available under | 7 | dnl This file can can be used in projects which are not available under |
10 | dnl the GNU General Public License or the GNU Library General Public | 8 | dnl the GNU General Public License or the GNU Library General Public |
@@ -17,7 +15,7 @@ dnl They are *not* in the public domain. | |||
17 | 15 | ||
18 | dnl Authors: | 16 | dnl Authors: |
19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | 17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. |
20 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. | 18 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006. |
21 | 19 | ||
22 | dnl Macro to add for using GNU gettext. | 20 | dnl Macro to add for using GNU gettext. |
23 | 21 | ||
@@ -65,8 +63,13 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
65 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , | 63 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , |
66 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT | 64 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT |
67 | ])])])]) | 65 | ])])])]) |
68 | define(gt_included_intl, ifelse([$1], [external], [no], [yes])) | 66 | define([gt_included_intl], |
69 | define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) | 67 | ifelse([$1], [external], |
68 | ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), | ||
69 | [yes])) | ||
70 | define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) | ||
71 | gt_NEEDS_INIT | ||
72 | AM_GNU_GETTEXT_NEED([$2]) | ||
70 | 73 | ||
71 | AC_REQUIRE([AM_PO_SUBDIRS])dnl | 74 | AC_REQUIRE([AM_PO_SUBDIRS])dnl |
72 | ifelse(gt_included_intl, yes, [ | 75 | ifelse(gt_included_intl, yes, [ |
@@ -80,7 +83,7 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
80 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | 83 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
81 | dnl Ideally we would do this search only after the | 84 | dnl Ideally we would do this search only after the |
82 | dnl if test "$USE_NLS" = "yes"; then | 85 | dnl if test "$USE_NLS" = "yes"; then |
83 | dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then | 86 | dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then |
84 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT | 87 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT |
85 | dnl the configure script would need to contain the same shell code | 88 | dnl the configure script would need to contain the same shell code |
86 | dnl again, outside any 'if'. There are two solutions: | 89 | dnl again, outside any 'if'. There are two solutions: |
@@ -92,8 +95,11 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
92 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | 95 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
93 | ]) | 96 | ]) |
94 | 97 | ||
98 | dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. | ||
99 | gt_INTL_MACOSX | ||
100 | |||
95 | dnl Set USE_NLS. | 101 | dnl Set USE_NLS. |
96 | AM_NLS | 102 | AC_REQUIRE([AM_NLS]) |
97 | 103 | ||
98 | ifelse(gt_included_intl, yes, [ | 104 | ifelse(gt_included_intl, yes, [ |
99 | BUILD_INCLUDED_LIBINTL=no | 105 | BUILD_INCLUDED_LIBINTL=no |
@@ -103,6 +109,15 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
103 | LTLIBINTL= | 109 | LTLIBINTL= |
104 | POSUB= | 110 | POSUB= |
105 | 111 | ||
112 | dnl Add a version number to the cache macros. | ||
113 | case " $gt_needs " in | ||
114 | *" need-formatstring-macros "*) gt_api_version=3 ;; | ||
115 | *" need-ngettext "*) gt_api_version=2 ;; | ||
116 | *) gt_api_version=1 ;; | ||
117 | esac | ||
118 | gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" | ||
119 | gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" | ||
120 | |||
106 | dnl If we use NLS figure out what method | 121 | dnl If we use NLS figure out what method |
107 | if test "$USE_NLS" = "yes"; then | 122 | if test "$USE_NLS" = "yes"; then |
108 | gt_use_preinstalled_gnugettext=no | 123 | gt_use_preinstalled_gnugettext=no |
@@ -121,28 +136,35 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
121 | dnl to use. If GNU gettext is available we use this. Else we have | 136 | dnl to use. If GNU gettext is available we use this. Else we have |
122 | dnl to fall back to GNU NLS library. | 137 | dnl to fall back to GNU NLS library. |
123 | 138 | ||
124 | dnl Add a version number to the cache macros. | 139 | if test $gt_api_version -ge 3; then |
125 | define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) | 140 | gt_revision_test_code=' |
126 | define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) | 141 | #ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
127 | define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) | ||
128 | |||
129 | AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, | ||
130 | [AC_TRY_LINK([#include <libintl.h> | ||
131 | ]ifelse([$2], [need-formatstring-macros], | ||
132 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION | ||
133 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | 142 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) |
134 | #endif | 143 | #endif |
135 | changequote(,)dnl | 144 | changequote(,)dnl |
136 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | 145 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; |
137 | changequote([,])dnl | 146 | changequote([,])dnl |
138 | ], [])[extern int _nl_msg_cat_cntr; | 147 | ' |
148 | else | ||
149 | gt_revision_test_code= | ||
150 | fi | ||
151 | if test $gt_api_version -ge 2; then | ||
152 | gt_expression_test_code=' + * ngettext ("", "", 0)' | ||
153 | else | ||
154 | gt_expression_test_code= | ||
155 | fi | ||
156 | |||
157 | AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], | ||
158 | [AC_TRY_LINK([#include <libintl.h> | ||
159 | $gt_revision_test_code | ||
160 | extern int _nl_msg_cat_cntr; | ||
139 | extern int *_nl_domain_bindings;], | 161 | extern int *_nl_domain_bindings;], |
140 | [bindtextdomain ("", ""); | 162 | [bindtextdomain ("", ""); |
141 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], | 163 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], |
142 | gt_cv_func_gnugettext_libc=yes, | 164 | [eval "$gt_func_gnugettext_libc=yes"], |
143 | gt_cv_func_gnugettext_libc=no)]) | 165 | [eval "$gt_func_gnugettext_libc=no"])]) |
144 | 166 | ||
145 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then | 167 | if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then |
146 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | 168 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
147 | ifelse(gt_included_intl, yes, , [ | 169 | ifelse(gt_included_intl, yes, , [ |
148 | AM_ICONV_LINK | 170 | AM_ICONV_LINK |
@@ -153,52 +175,40 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
153 | dnl even if libiconv doesn't exist. | 175 | dnl even if libiconv doesn't exist. |
154 | AC_LIB_LINKFLAGS_BODY([intl]) | 176 | AC_LIB_LINKFLAGS_BODY([intl]) |
155 | AC_CACHE_CHECK([for GNU gettext in libintl], | 177 | AC_CACHE_CHECK([for GNU gettext in libintl], |
156 | gt_cv_func_gnugettext_libintl, | 178 | [$gt_func_gnugettext_libintl], |
157 | [gt_save_CPPFLAGS="$CPPFLAGS" | 179 | [gt_save_CPPFLAGS="$CPPFLAGS" |
158 | CPPFLAGS="$CPPFLAGS $INCINTL" | 180 | CPPFLAGS="$CPPFLAGS $INCINTL" |
159 | gt_save_LIBS="$LIBS" | 181 | gt_save_LIBS="$LIBS" |
160 | LIBS="$LIBS $LIBINTL" | 182 | LIBS="$LIBS $LIBINTL" |
161 | dnl Now see whether libintl exists and does not depend on libiconv. | 183 | dnl Now see whether libintl exists and does not depend on libiconv. |
162 | AC_TRY_LINK([#include <libintl.h> | 184 | AC_TRY_LINK([#include <libintl.h> |
163 | ]ifelse([$2], [need-formatstring-macros], | 185 | $gt_revision_test_code |
164 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION | 186 | extern int _nl_msg_cat_cntr; |
165 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | ||
166 | #endif | ||
167 | changequote(,)dnl | ||
168 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | ||
169 | changequote([,])dnl | ||
170 | ], [])[extern int _nl_msg_cat_cntr; | ||
171 | extern | 187 | extern |
172 | #ifdef __cplusplus | 188 | #ifdef __cplusplus |
173 | "C" | 189 | "C" |
174 | #endif | 190 | #endif |
175 | const char *_nl_expand_alias ();], | 191 | const char *_nl_expand_alias (const char *);], |
176 | [bindtextdomain ("", ""); | 192 | [bindtextdomain ("", ""); |
177 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], | 193 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], |
178 | gt_cv_func_gnugettext_libintl=yes, | 194 | [eval "$gt_func_gnugettext_libintl=yes"], |
179 | gt_cv_func_gnugettext_libintl=no) | 195 | [eval "$gt_func_gnugettext_libintl=no"]) |
180 | dnl Now see whether libintl exists and depends on libiconv. | 196 | dnl Now see whether libintl exists and depends on libiconv. |
181 | if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then | 197 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then |
182 | LIBS="$LIBS $LIBICONV" | 198 | LIBS="$LIBS $LIBICONV" |
183 | AC_TRY_LINK([#include <libintl.h> | 199 | AC_TRY_LINK([#include <libintl.h> |
184 | ]ifelse([$2], [need-formatstring-macros], | 200 | $gt_revision_test_code |
185 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION | 201 | extern int _nl_msg_cat_cntr; |
186 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | ||
187 | #endif | ||
188 | changequote(,)dnl | ||
189 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | ||
190 | changequote([,])dnl | ||
191 | ], [])[extern int _nl_msg_cat_cntr; | ||
192 | extern | 202 | extern |
193 | #ifdef __cplusplus | 203 | #ifdef __cplusplus |
194 | "C" | 204 | "C" |
195 | #endif | 205 | #endif |
196 | const char *_nl_expand_alias ();], | 206 | const char *_nl_expand_alias (const char *);], |
197 | [bindtextdomain ("", ""); | 207 | [bindtextdomain ("", ""); |
198 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], | 208 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], |
199 | [LIBINTL="$LIBINTL $LIBICONV" | 209 | [LIBINTL="$LIBINTL $LIBICONV" |
200 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" | 210 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" |
201 | gt_cv_func_gnugettext_libintl=yes | 211 | eval "$gt_func_gnugettext_libintl=yes" |
202 | ]) | 212 | ]) |
203 | fi | 213 | fi |
204 | CPPFLAGS="$gt_save_CPPFLAGS" | 214 | CPPFLAGS="$gt_save_CPPFLAGS" |
@@ -209,8 +219,8 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
209 | dnl use it. But if this macro is used in GNU gettext, and GNU | 219 | dnl use it. But if this macro is used in GNU gettext, and GNU |
210 | dnl gettext is already preinstalled in libintl, we update this | 220 | dnl gettext is already preinstalled in libintl, we update this |
211 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | 221 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) |
212 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ | 222 | if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ |
213 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ | 223 | || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ |
214 | && test "$PACKAGE" != gettext-runtime \ | 224 | && test "$PACKAGE" != gettext-runtime \ |
215 | && test "$PACKAGE" != gettext-tools; }; then | 225 | && test "$PACKAGE" != gettext-tools; }; then |
216 | gt_use_preinstalled_gnugettext=yes | 226 | gt_use_preinstalled_gnugettext=yes |
@@ -233,11 +243,12 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
233 | dnl Mark actions used to generate GNU NLS library. | 243 | dnl Mark actions used to generate GNU NLS library. |
234 | BUILD_INCLUDED_LIBINTL=yes | 244 | BUILD_INCLUDED_LIBINTL=yes |
235 | USE_INCLUDED_LIBINTL=yes | 245 | USE_INCLUDED_LIBINTL=yes |
236 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" | 246 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" |
237 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" | 247 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" |
238 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | 248 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` |
239 | fi | 249 | fi |
240 | 250 | ||
251 | CATOBJEXT= | ||
241 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | 252 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
242 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | 253 | || test "$nls_cv_use_gnu_gettext" = "yes"; then |
243 | dnl Mark actions to use GNU gettext tools. | 254 | dnl Mark actions to use GNU gettext tools. |
@@ -245,6 +256,15 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
245 | fi | 256 | fi |
246 | ]) | 257 | ]) |
247 | 258 | ||
259 | if test -n "$INTL_MACOSX_LIBS"; then | ||
260 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | ||
261 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | ||
262 | dnl Some extra flags are needed during linking. | ||
263 | LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" | ||
264 | LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" | ||
265 | fi | ||
266 | fi | ||
267 | |||
248 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | 268 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
249 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | 269 | || test "$nls_cv_use_gnu_gettext" = "yes"; then |
250 | AC_DEFINE(ENABLE_NLS, 1, | 270 | AC_DEFINE(ENABLE_NLS, 1, |
@@ -260,7 +280,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
260 | if test "$USE_NLS" = "yes"; then | 280 | if test "$USE_NLS" = "yes"; then |
261 | AC_MSG_CHECKING([where the gettext function comes from]) | 281 | AC_MSG_CHECKING([where the gettext function comes from]) |
262 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | 282 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then |
263 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then | 283 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then |
264 | gt_source="external libintl" | 284 | gt_source="external libintl" |
265 | else | 285 | else |
266 | gt_source="libc" | 286 | gt_source="libc" |
@@ -274,7 +294,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
274 | if test "$USE_NLS" = "yes"; then | 294 | if test "$USE_NLS" = "yes"; then |
275 | 295 | ||
276 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | 296 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then |
277 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then | 297 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then |
278 | AC_MSG_CHECKING([how to link with libintl]) | 298 | AC_MSG_CHECKING([how to link with libintl]) |
279 | AC_MSG_RESULT([$LIBINTL]) | 299 | AC_MSG_RESULT([$LIBINTL]) |
280 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) | 300 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) |
@@ -320,6 +340,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
320 | AC_SUBST(GENCAT) | 340 | AC_SUBST(GENCAT) |
321 | 341 | ||
322 | dnl For backward compatibility. Some Makefiles may be using this. | 342 | dnl For backward compatibility. Some Makefiles may be using this. |
343 | INTLOBJS= | ||
323 | if test "$USE_INCLUDED_LIBINTL" = yes; then | 344 | if test "$USE_INCLUDED_LIBINTL" = yes; then |
324 | INTLOBJS="\$(GETTOBJS)" | 345 | INTLOBJS="\$(GETTOBJS)" |
325 | fi | 346 | fi |
@@ -341,145 +362,18 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", | |||
341 | ]) | 362 | ]) |
342 | 363 | ||
343 | 364 | ||
344 | dnl Checks for all prerequisites of the intl subdirectory, | 365 | dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. |
345 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, | 366 | m4_define([gt_NEEDS_INIT], |
346 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. | ||
347 | AC_DEFUN([AM_INTL_SUBDIR], | ||
348 | [ | 367 | [ |
349 | AC_REQUIRE([AC_PROG_INSTALL])dnl | 368 | m4_divert_text([DEFAULTS], [gt_needs=]) |
350 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl | 369 | m4_define([gt_NEEDS_INIT], []) |
351 | AC_REQUIRE([AC_PROG_CC])dnl | ||
352 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | ||
353 | AC_REQUIRE([AC_PROG_RANLIB])dnl | ||
354 | AC_REQUIRE([AC_ISC_POSIX])dnl | ||
355 | AC_REQUIRE([AC_HEADER_STDC])dnl | ||
356 | AC_REQUIRE([AC_C_CONST])dnl | ||
357 | AC_REQUIRE([bh_C_SIGNED])dnl | ||
358 | AC_REQUIRE([AC_C_INLINE])dnl | ||
359 | AC_REQUIRE([AC_TYPE_OFF_T])dnl | ||
360 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | ||
361 | AC_REQUIRE([jm_AC_TYPE_LONG_LONG])dnl | ||
362 | AC_REQUIRE([gt_TYPE_LONGDOUBLE])dnl | ||
363 | AC_REQUIRE([gt_TYPE_WCHAR_T])dnl | ||
364 | AC_REQUIRE([gt_TYPE_WINT_T])dnl | ||
365 | AC_REQUIRE([jm_AC_HEADER_INTTYPES_H]) | ||
366 | AC_REQUIRE([jm_AC_HEADER_STDINT_H]) | ||
367 | AC_REQUIRE([gt_TYPE_INTMAX_T]) | ||
368 | AC_REQUIRE([gt_PRINTF_POSIX]) | ||
369 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | ||
370 | AC_REQUIRE([AC_FUNC_MMAP])dnl | ||
371 | AC_REQUIRE([jm_GLIBC21])dnl | ||
372 | AC_REQUIRE([gt_INTDIV0])dnl | ||
373 | AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl | ||
374 | AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl | ||
375 | AC_REQUIRE([gt_INTTYPES_PRI])dnl | ||
376 | AC_REQUIRE([gl_XSIZE])dnl | ||
377 | |||
378 | AC_CHECK_TYPE([ptrdiff_t], , | ||
379 | [AC_DEFINE([ptrdiff_t], [long], | ||
380 | [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) | ||
381 | ]) | ||
382 | AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ | ||
383 | stdlib.h string.h unistd.h sys/param.h]) | ||
384 | AC_CHECK_FUNCS([asprintf fwprintf getcwd getegid geteuid getgid getuid \ | ||
385 | mempcpy munmap putenv setenv setlocale snprintf stpcpy strcasecmp strdup \ | ||
386 | strtoul tsearch wcslen __argz_count __argz_stringify __argz_next \ | ||
387 | __fsetlocking]) | ||
388 | |||
389 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | ||
390 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | ||
391 | gt_CHECK_DECL(_snprintf, [#include <stdio.h>]) | ||
392 | gt_CHECK_DECL(_snwprintf, [#include <stdio.h>]) | ||
393 | |||
394 | dnl Use the *_unlocked functions only if they are declared. | ||
395 | dnl (because some of them were defined without being declared in Solaris | ||
396 | dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built | ||
397 | dnl on Solaris 2.5.1 to run on Solaris 2.6). | ||
398 | dnl Don't use AC_CHECK_DECLS because it isn't supported in autoconf-2.13. | ||
399 | gt_CHECK_DECL(feof_unlocked, [#include <stdio.h>]) | ||
400 | gt_CHECK_DECL(fgets_unlocked, [#include <stdio.h>]) | ||
401 | gt_CHECK_DECL(getc_unlocked, [#include <stdio.h>]) | ||
402 | |||
403 | case $gt_cv_func_printf_posix in | ||
404 | *yes) HAVE_POSIX_PRINTF=1 ;; | ||
405 | *) HAVE_POSIX_PRINTF=0 ;; | ||
406 | esac | ||
407 | AC_SUBST([HAVE_POSIX_PRINTF]) | ||
408 | if test "$ac_cv_func_asprintf" = yes; then | ||
409 | HAVE_ASPRINTF=1 | ||
410 | else | ||
411 | HAVE_ASPRINTF=0 | ||
412 | fi | ||
413 | AC_SUBST([HAVE_ASPRINTF]) | ||
414 | if test "$ac_cv_func_snprintf" = yes; then | ||
415 | HAVE_SNPRINTF=1 | ||
416 | else | ||
417 | HAVE_SNPRINTF=0 | ||
418 | fi | ||
419 | AC_SUBST([HAVE_SNPRINTF]) | ||
420 | if test "$ac_cv_func_wprintf" = yes; then | ||
421 | HAVE_WPRINTF=1 | ||
422 | else | ||
423 | HAVE_WPRINTF=0 | ||
424 | fi | ||
425 | AC_SUBST([HAVE_WPRINTF]) | ||
426 | |||
427 | AM_ICONV | ||
428 | AM_LANGINFO_CODESET | ||
429 | if test $ac_cv_header_locale_h = yes; then | ||
430 | AM_LC_MESSAGES | ||
431 | fi | ||
432 | |||
433 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | ||
434 | dnl because plural.y uses bison specific features. It requires at least | ||
435 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't | ||
436 | dnl compile. | ||
437 | dnl bison is only needed for the maintainer (who touches plural.y). But in | ||
438 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put | ||
439 | dnl the rule in general Makefile. Now, some people carelessly touch the | ||
440 | dnl files or have a broken "make" program, hence the plural.c rule will | ||
441 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not | ||
442 | dnl present or too old. | ||
443 | AC_CHECK_PROGS([INTLBISON], [bison]) | ||
444 | if test -z "$INTLBISON"; then | ||
445 | ac_verc_fail=yes | ||
446 | else | ||
447 | dnl Found it, now check the version. | ||
448 | AC_MSG_CHECKING([version of bison]) | ||
449 | changequote(<<,>>)dnl | ||
450 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` | ||
451 | case $ac_prog_version in | ||
452 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; | ||
453 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) | ||
454 | changequote([,])dnl | ||
455 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; | ||
456 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; | ||
457 | esac | ||
458 | AC_MSG_RESULT([$ac_prog_version]) | ||
459 | fi | ||
460 | if test $ac_verc_fail = yes; then | ||
461 | INTLBISON=: | ||
462 | fi | ||
463 | ]) | 370 | ]) |
464 | 371 | ||
465 | 372 | ||
466 | dnl gt_CHECK_DECL(FUNC, INCLUDES) | 373 | dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) |
467 | dnl Check whether a function is declared. | 374 | AC_DEFUN([AM_GNU_GETTEXT_NEED], |
468 | AC_DEFUN([gt_CHECK_DECL], | ||
469 | [ | 375 | [ |
470 | AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$1, | 376 | m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) |
471 | [AC_TRY_COMPILE([$2], [ | ||
472 | #ifndef $1 | ||
473 | char *p = (char *) $1; | ||
474 | #endif | ||
475 | ], ac_cv_have_decl_$1=yes, ac_cv_have_decl_$1=no)]) | ||
476 | if test $ac_cv_have_decl_$1 = yes; then | ||
477 | gt_value=1 | ||
478 | else | ||
479 | gt_value=0 | ||
480 | fi | ||
481 | AC_DEFINE_UNQUOTED([HAVE_DECL_]translit($1, [a-z], [A-Z]), [$gt_value], | ||
482 | [Define to 1 if you have the declaration of `$1', and to 0 if you don't.]) | ||
483 | ]) | 377 | ]) |
484 | 378 | ||
485 | 379 | ||