diff options
Diffstat (limited to 'm4/gettext.m4')
-rw-r--r-- | m4/gettext.m4 | 304 |
1 files changed, 186 insertions, 118 deletions
diff --git a/m4/gettext.m4 b/m4/gettext.m4 index 91c345e9..a374f03f 100644 --- a/m4/gettext.m4 +++ b/m4/gettext.m4 | |||
@@ -1,8 +1,10 @@ | |||
1 | # gettext.m4 serial 59 (gettext-0.16.1) | 1 | # gettext.m4 serial 28 (gettext-0.13) |
2 | dnl Copyright (C) 1995-2006 Free Software Foundation, Inc. | 2 | dnl Copyright (C) 1995-2003 Free Software Foundation, Inc. |
3 | dnl This file is free software; the Free Software Foundation | 3 | dnl This file is free software, distributed under the terms of the GNU |
4 | dnl gives unlimited permission to copy and/or distribute it, | 4 | dnl General Public License. As a special exception to the GNU General |
5 | dnl with or without modifications, as long as this notice is preserved. | 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. | ||
6 | dnl | 8 | dnl |
7 | dnl This file can can be used in projects which are not available under | 9 | 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 | 10 | dnl the GNU General Public License or the GNU Library General Public |
@@ -15,7 +17,7 @@ dnl They are *not* in the public domain. | |||
15 | 17 | ||
16 | dnl Authors: | 18 | dnl Authors: |
17 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | 19 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. |
18 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006. | 20 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. |
19 | 21 | ||
20 | dnl Macro to add for using GNU gettext. | 22 | dnl Macro to add for using GNU gettext. |
21 | 23 | ||
@@ -63,13 +65,8 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
63 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , | 65 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , |
64 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT | 66 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT |
65 | ])])])]) | 67 | ])])])]) |
66 | define([gt_included_intl], | 68 | define(gt_included_intl, ifelse([$1], [external], [no], [yes])) |
67 | ifelse([$1], [external], | 69 | define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) |
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]) | ||
73 | 70 | ||
74 | AC_REQUIRE([AM_PO_SUBDIRS])dnl | 71 | AC_REQUIRE([AM_PO_SUBDIRS])dnl |
75 | ifelse(gt_included_intl, yes, [ | 72 | ifelse(gt_included_intl, yes, [ |
@@ -83,7 +80,7 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
83 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | 80 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
84 | dnl Ideally we would do this search only after the | 81 | dnl Ideally we would do this search only after the |
85 | dnl if test "$USE_NLS" = "yes"; then | 82 | dnl if test "$USE_NLS" = "yes"; then |
86 | dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then | 83 | dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then |
87 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT | 84 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT |
88 | dnl the configure script would need to contain the same shell code | 85 | dnl the configure script would need to contain the same shell code |
89 | dnl again, outside any 'if'. There are two solutions: | 86 | dnl again, outside any 'if'. There are two solutions: |
@@ -95,11 +92,8 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
95 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | 92 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) |
96 | ]) | 93 | ]) |
97 | 94 | ||
98 | dnl Sometimes, on MacOS X, libintl requires linking with CoreFoundation. | ||
99 | gt_INTL_MACOSX | ||
100 | |||
101 | dnl Set USE_NLS. | 95 | dnl Set USE_NLS. |
102 | AC_REQUIRE([AM_NLS]) | 96 | AM_NLS |
103 | 97 | ||
104 | ifelse(gt_included_intl, yes, [ | 98 | ifelse(gt_included_intl, yes, [ |
105 | BUILD_INCLUDED_LIBINTL=no | 99 | BUILD_INCLUDED_LIBINTL=no |
@@ -109,15 +103,6 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
109 | LTLIBINTL= | 103 | LTLIBINTL= |
110 | POSUB= | 104 | POSUB= |
111 | 105 | ||
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 | |||
121 | dnl If we use NLS figure out what method | 106 | dnl If we use NLS figure out what method |
122 | if test "$USE_NLS" = "yes"; then | 107 | if test "$USE_NLS" = "yes"; then |
123 | gt_use_preinstalled_gnugettext=no | 108 | gt_use_preinstalled_gnugettext=no |
@@ -136,35 +121,28 @@ AC_DEFUN([AM_GNU_GETTEXT], | |||
136 | dnl to use. If GNU gettext is available we use this. Else we have | 121 | dnl to use. If GNU gettext is available we use this. Else we have |
137 | dnl to fall back to GNU NLS library. | 122 | dnl to fall back to GNU NLS library. |
138 | 123 | ||
139 | if test $gt_api_version -ge 3; then | 124 | dnl Add a version number to the cache macros. |
140 | gt_revision_test_code=' | 125 | define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1))) |
141 | #ifndef __GNU_GETTEXT_SUPPORTED_REVISION | 126 | define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) |
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 | ||
142 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) | 133 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) |
143 | #endif | 134 | #endif |
144 | changequote(,)dnl | 135 | changequote(,)dnl |
145 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | 136 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; |
146 | changequote([,])dnl | 137 | changequote([,])dnl |
147 | ' | 138 | ], [])[extern int _nl_msg_cat_cntr; |
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; | ||
161 | extern int *_nl_domain_bindings;], | 139 | extern int *_nl_domain_bindings;], |
162 | [bindtextdomain ("", ""); | 140 | [bindtextdomain ("", ""); |
163 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings], | 141 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], |
164 | [eval "$gt_func_gnugettext_libc=yes"], | 142 | gt_cv_func_gnugettext_libc=yes, |
165 | [eval "$gt_func_gnugettext_libc=no"])]) | 143 | gt_cv_func_gnugettext_libc=no)]) |
166 | 144 | ||
167 | if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then | 145 | if test "$gt_cv_func_gnugettext_libc" != "yes"; then |
168 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | 146 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
169 | ifelse(gt_included_intl, yes, , [ | 147 | ifelse(gt_included_intl, yes, , [ |
170 | AM_ICONV_LINK | 148 | AM_ICONV_LINK |
@@ -175,40 +153,52 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_b | |||
175 | dnl even if libiconv doesn't exist. | 153 | dnl even if libiconv doesn't exist. |
176 | AC_LIB_LINKFLAGS_BODY([intl]) | 154 | AC_LIB_LINKFLAGS_BODY([intl]) |
177 | AC_CACHE_CHECK([for GNU gettext in libintl], | 155 | AC_CACHE_CHECK([for GNU gettext in libintl], |
178 | [$gt_func_gnugettext_libintl], | 156 | gt_cv_func_gnugettext_libintl, |
179 | [gt_save_CPPFLAGS="$CPPFLAGS" | 157 | [gt_save_CPPFLAGS="$CPPFLAGS" |
180 | CPPFLAGS="$CPPFLAGS $INCINTL" | 158 | CPPFLAGS="$CPPFLAGS $INCINTL" |
181 | gt_save_LIBS="$LIBS" | 159 | gt_save_LIBS="$LIBS" |
182 | LIBS="$LIBS $LIBINTL" | 160 | LIBS="$LIBS $LIBINTL" |
183 | dnl Now see whether libintl exists and does not depend on libiconv. | 161 | dnl Now see whether libintl exists and does not depend on libiconv. |
184 | AC_TRY_LINK([#include <libintl.h> | 162 | AC_TRY_LINK([#include <libintl.h> |
185 | $gt_revision_test_code | 163 | ]ifelse([$2], [need-formatstring-macros], |
186 | extern int _nl_msg_cat_cntr; | 164 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
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; | ||
187 | extern | 171 | extern |
188 | #ifdef __cplusplus | 172 | #ifdef __cplusplus |
189 | "C" | 173 | "C" |
190 | #endif | 174 | #endif |
191 | const char *_nl_expand_alias (const char *);], | 175 | const char *_nl_expand_alias ();], |
192 | [bindtextdomain ("", ""); | 176 | [bindtextdomain ("", ""); |
193 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], | 177 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], |
194 | [eval "$gt_func_gnugettext_libintl=yes"], | 178 | gt_cv_func_gnugettext_libintl=yes, |
195 | [eval "$gt_func_gnugettext_libintl=no"]) | 179 | gt_cv_func_gnugettext_libintl=no) |
196 | dnl Now see whether libintl exists and depends on libiconv. | 180 | dnl Now see whether libintl exists and depends on libiconv. |
197 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then | 181 | if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then |
198 | LIBS="$LIBS $LIBICONV" | 182 | LIBS="$LIBS $LIBICONV" |
199 | AC_TRY_LINK([#include <libintl.h> | 183 | AC_TRY_LINK([#include <libintl.h> |
200 | $gt_revision_test_code | 184 | ]ifelse([$2], [need-formatstring-macros], |
201 | extern int _nl_msg_cat_cntr; | 185 | [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION |
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; | ||
202 | extern | 192 | extern |
203 | #ifdef __cplusplus | 193 | #ifdef __cplusplus |
204 | "C" | 194 | "C" |
205 | #endif | 195 | #endif |
206 | const char *_nl_expand_alias (const char *);], | 196 | const char *_nl_expand_alias ();], |
207 | [bindtextdomain ("", ""); | 197 | [bindtextdomain ("", ""); |
208 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("")], | 198 | return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], |
209 | [LIBINTL="$LIBINTL $LIBICONV" | 199 | [LIBINTL="$LIBINTL $LIBICONV" |
210 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" | 200 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" |
211 | eval "$gt_func_gnugettext_libintl=yes" | 201 | gt_cv_func_gnugettext_libintl=yes |
212 | ]) | 202 | ]) |
213 | fi | 203 | fi |
214 | CPPFLAGS="$gt_save_CPPFLAGS" | 204 | CPPFLAGS="$gt_save_CPPFLAGS" |
@@ -219,8 +209,8 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
219 | dnl use it. But if this macro is used in GNU gettext, and GNU | 209 | dnl use it. But if this macro is used in GNU gettext, and GNU |
220 | dnl gettext is already preinstalled in libintl, we update this | 210 | dnl gettext is already preinstalled in libintl, we update this |
221 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | 211 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) |
222 | if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ | 212 | if test "$gt_cv_func_gnugettext_libc" = "yes" \ |
223 | || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ | 213 | || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ |
224 | && test "$PACKAGE" != gettext-runtime \ | 214 | && test "$PACKAGE" != gettext-runtime \ |
225 | && test "$PACKAGE" != gettext-tools; }; then | 215 | && test "$PACKAGE" != gettext-tools; }; then |
226 | gt_use_preinstalled_gnugettext=yes | 216 | gt_use_preinstalled_gnugettext=yes |
@@ -243,12 +233,11 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
243 | dnl Mark actions used to generate GNU NLS library. | 233 | dnl Mark actions used to generate GNU NLS library. |
244 | BUILD_INCLUDED_LIBINTL=yes | 234 | BUILD_INCLUDED_LIBINTL=yes |
245 | USE_INCLUDED_LIBINTL=yes | 235 | USE_INCLUDED_LIBINTL=yes |
246 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" | 236 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" |
247 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" | 237 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" |
248 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` | 238 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` |
249 | fi | 239 | fi |
250 | 240 | ||
251 | CATOBJEXT= | ||
252 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | 241 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
253 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | 242 | || test "$nls_cv_use_gnu_gettext" = "yes"; then |
254 | dnl Mark actions to use GNU gettext tools. | 243 | dnl Mark actions to use GNU gettext tools. |
@@ -256,15 +245,6 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
256 | fi | 245 | fi |
257 | ]) | 246 | ]) |
258 | 247 | ||
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 | |||
268 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | 248 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
269 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | 249 | || test "$nls_cv_use_gnu_gettext" = "yes"; then |
270 | AC_DEFINE(ENABLE_NLS, 1, | 250 | AC_DEFINE(ENABLE_NLS, 1, |
@@ -280,7 +260,7 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
280 | if test "$USE_NLS" = "yes"; then | 260 | if test "$USE_NLS" = "yes"; then |
281 | AC_MSG_CHECKING([where the gettext function comes from]) | 261 | AC_MSG_CHECKING([where the gettext function comes from]) |
282 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | 262 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then |
283 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then | 263 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then |
284 | gt_source="external libintl" | 264 | gt_source="external libintl" |
285 | else | 265 | else |
286 | gt_source="libc" | 266 | gt_source="libc" |
@@ -294,7 +274,7 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
294 | if test "$USE_NLS" = "yes"; then | 274 | if test "$USE_NLS" = "yes"; then |
295 | 275 | ||
296 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | 276 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then |
297 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then | 277 | if test "$gt_cv_func_gnugettext_libintl" = "yes"; then |
298 | AC_MSG_CHECKING([how to link with libintl]) | 278 | AC_MSG_CHECKING([how to link with libintl]) |
299 | AC_MSG_RESULT([$LIBINTL]) | 279 | AC_MSG_RESULT([$LIBINTL]) |
300 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) | 280 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) |
@@ -340,7 +320,6 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
340 | AC_SUBST(GENCAT) | 320 | AC_SUBST(GENCAT) |
341 | 321 | ||
342 | dnl For backward compatibility. Some Makefiles may be using this. | 322 | dnl For backward compatibility. Some Makefiles may be using this. |
343 | INTLOBJS= | ||
344 | if test "$USE_INCLUDED_LIBINTL" = yes; then | 323 | if test "$USE_INCLUDED_LIBINTL" = yes; then |
345 | INTLOBJS="\$(GETTOBJS)" | 324 | INTLOBJS="\$(GETTOBJS)" |
346 | fi | 325 | fi |
@@ -362,56 +341,145 @@ return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_a | |||
362 | ]) | 341 | ]) |
363 | 342 | ||
364 | 343 | ||
365 | dnl Checks for special options needed on MacOS X. | 344 | dnl Checks for all prerequisites of the intl subdirectory, |
366 | dnl Defines INTL_MACOSX_LIBS. | 345 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, |
367 | AC_DEFUN([gt_INTL_MACOSX], | 346 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. |
347 | AC_DEFUN([AM_INTL_SUBDIR], | ||
368 | [ | 348 | [ |
369 | dnl Check for API introduced in MacOS X 10.2. | 349 | AC_REQUIRE([AC_PROG_INSTALL])dnl |
370 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], | 350 | AC_REQUIRE([AM_MKINSTALLDIRS])dnl |
371 | gt_cv_func_CFPreferencesCopyAppValue, | 351 | AC_REQUIRE([AC_PROG_CC])dnl |
372 | [gt_save_LIBS="$LIBS" | 352 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
373 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" | 353 | AC_REQUIRE([AC_PROG_RANLIB])dnl |
374 | AC_TRY_LINK([#include <CoreFoundation/CFPreferences.h>], | 354 | AC_REQUIRE([AC_ISC_POSIX])dnl |
375 | [CFPreferencesCopyAppValue(NULL, NULL)], | 355 | AC_REQUIRE([AC_HEADER_STDC])dnl |
376 | [gt_cv_func_CFPreferencesCopyAppValue=yes], | 356 | AC_REQUIRE([AC_C_CONST])dnl |
377 | [gt_cv_func_CFPreferencesCopyAppValue=no]) | 357 | AC_REQUIRE([bh_C_SIGNED])dnl |
378 | LIBS="$gt_save_LIBS"]) | 358 | AC_REQUIRE([AC_C_INLINE])dnl |
379 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then | 359 | AC_REQUIRE([AC_TYPE_OFF_T])dnl |
380 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], 1, | 360 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl |
381 | [Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) | 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 | ||
382 | fi | 412 | fi |
383 | dnl Check for API introduced in MacOS X 10.3. | 413 | AC_SUBST([HAVE_ASPRINTF]) |
384 | AC_CACHE_CHECK([for CFLocaleCopyCurrent], gt_cv_func_CFLocaleCopyCurrent, | 414 | if test "$ac_cv_func_snprintf" = yes; then |
385 | [gt_save_LIBS="$LIBS" | 415 | HAVE_SNPRINTF=1 |
386 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" | 416 | else |
387 | AC_TRY_LINK([#include <CoreFoundation/CFLocale.h>], [CFLocaleCopyCurrent();], | 417 | HAVE_SNPRINTF=0 |
388 | [gt_cv_func_CFLocaleCopyCurrent=yes], | ||
389 | [gt_cv_func_CFLocaleCopyCurrent=no]) | ||
390 | LIBS="$gt_save_LIBS"]) | ||
391 | if test $gt_cv_func_CFLocaleCopyCurrent = yes; then | ||
392 | AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], 1, | ||
393 | [Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) | ||
394 | fi | 418 | fi |
395 | INTL_MACOSX_LIBS= | 419 | AC_SUBST([HAVE_SNPRINTF]) |
396 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then | 420 | if test "$ac_cv_func_wprintf" = yes; then |
397 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | 421 | HAVE_WPRINTF=1 |
422 | else | ||
423 | HAVE_WPRINTF=0 | ||
398 | fi | 424 | fi |
399 | AC_SUBST([INTL_MACOSX_LIBS]) | 425 | AC_SUBST([HAVE_WPRINTF]) |
400 | ]) | ||
401 | 426 | ||
427 | AM_ICONV | ||
428 | AM_LANGINFO_CODESET | ||
429 | if test $ac_cv_header_locale_h = yes; then | ||
430 | AM_LC_MESSAGES | ||
431 | fi | ||
402 | 432 | ||
403 | dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. | 433 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, |
404 | m4_define([gt_NEEDS_INIT], | 434 | dnl because plural.y uses bison specific features. It requires at least |
405 | [ | 435 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't |
406 | m4_divert_text([DEFAULTS], [gt_needs=]) | 436 | dnl compile. |
407 | m4_define([gt_NEEDS_INIT], []) | 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 | ||
408 | ]) | 463 | ]) |
409 | 464 | ||
410 | 465 | ||
411 | dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) | 466 | dnl gt_CHECK_DECL(FUNC, INCLUDES) |
412 | AC_DEFUN([AM_GNU_GETTEXT_NEED], | 467 | dnl Check whether a function is declared. |
468 | AC_DEFUN([gt_CHECK_DECL], | ||
413 | [ | 469 | [ |
414 | m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) | 470 | AC_CACHE_CHECK([whether $1 is declared], ac_cv_have_decl_$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.]) | ||
415 | ]) | 483 | ]) |
416 | 484 | ||
417 | 485 | ||