]>
Commit | Line | Data |
---|---|---|
93613951 TT |
1 | # generated automatically by aclocal 1.14.1 -*- Autoconf -*- |
2 | ||
3 | # Copyright (C) 1996-2013 Free Software Foundation, Inc. | |
4 | ||
5 | # This file is free software; the Free Software Foundation | |
6 | # gives unlimited permission to copy and/or distribute it, | |
7 | # with or without modifications, as long as this notice is preserved. | |
8 | ||
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without | |
11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A | |
12 | # PARTICULAR PURPOSE. | |
13 | ||
14 | m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) | |
15 | # codeset.m4 serial 5 (gettext-0.18.2) | |
16 | dnl Copyright (C) 2000-2002, 2006, 2008-2013 Free Software Foundation, Inc. | |
17 | dnl This file is free software; the Free Software Foundation | |
18 | dnl gives unlimited permission to copy and/or distribute it, | |
19 | dnl with or without modifications, as long as this notice is preserved. | |
a64c9c13 | 20 | |
a04eba3f TT |
21 | dnl From Bruno Haible. |
22 | ||
23 | AC_DEFUN([AM_LANGINFO_CODESET], | |
24 | [ | |
93613951 TT |
25 | AC_CACHE_CHECK([for nl_langinfo and CODESET], [am_cv_langinfo_codeset], |
26 | [AC_LINK_IFELSE( | |
27 | [AC_LANG_PROGRAM( | |
28 | [[#include <langinfo.h>]], | |
29 | [[char* cs = nl_langinfo(CODESET); return !cs;]])], | |
30 | [am_cv_langinfo_codeset=yes], | |
31 | [am_cv_langinfo_codeset=no]) | |
a04eba3f TT |
32 | ]) |
33 | if test $am_cv_langinfo_codeset = yes; then | |
93613951 | 34 | AC_DEFINE([HAVE_LANGINFO_CODESET], [1], |
a04eba3f TT |
35 | [Define if you have <langinfo.h> and nl_langinfo(CODESET).]) |
36 | fi | |
37 | ]) | |
93613951 TT |
38 | |
39 | dnl 'extern inline' a la ISO C99. | |
40 | ||
41 | dnl Copyright 2012-2013 Free Software Foundation, Inc. | |
42 | dnl This file is free software; the Free Software Foundation | |
43 | dnl gives unlimited permission to copy and/or distribute it, | |
44 | dnl with or without modifications, as long as this notice is preserved. | |
45 | ||
46 | AC_DEFUN([gl_EXTERN_INLINE], | |
47 | [ | |
48 | AH_VERBATIM([extern_inline], | |
49 | [/* Please see the Gnulib manual for how to use these macros. | |
50 | ||
51 | Suppress extern inline with HP-UX cc, as it appears to be broken; see | |
52 | <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. | |
53 | ||
54 | Suppress extern inline with Sun C in standards-conformance mode, as it | |
55 | mishandles inline functions that call each other. E.g., for 'inline void f | |
56 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains | |
57 | 'reference to static identifier "f" in extern inline function'. | |
58 | This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. | |
59 | ||
60 | Suppress the use of extern inline on Apple's platforms, as Libc at least | |
61 | through Libc-825.26 (2013-04-09) is incompatible with it; see, e.g., | |
62 | <http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html>. | |
63 | Perhaps Apple will fix this some day. */ | |
64 | #if ((__GNUC__ \ | |
65 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | |
66 | : (199901L <= __STDC_VERSION__ \ | |
67 | && !defined __HP_cc \ | |
68 | && !(defined __SUNPRO_C && __STDC__))) \ | |
69 | && !defined __APPLE__) | |
70 | # define _GL_INLINE inline | |
71 | # define _GL_EXTERN_INLINE extern inline | |
72 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | |
73 | && !defined __APPLE__) | |
74 | # if __GNUC_GNU_INLINE__ | |
75 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | |
76 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) | |
77 | # else | |
78 | # define _GL_INLINE extern inline | |
79 | # endif | |
80 | # define _GL_EXTERN_INLINE extern | |
81 | #else | |
82 | # define _GL_INLINE static _GL_UNUSED | |
83 | # define _GL_EXTERN_INLINE static _GL_UNUSED | |
84 | #endif | |
85 | ||
86 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | |
87 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ | |
88 | # define _GL_INLINE_HEADER_CONST_PRAGMA | |
89 | # else | |
90 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ | |
91 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") | |
92 | # endif | |
93 | /* Suppress GCC's bogus "no previous prototype for 'FOO'" | |
94 | and "no previous declaration for 'FOO'" diagnostics, | |
95 | when FOO is an inline function in the header; see | |
96 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ | |
97 | # define _GL_INLINE_HEADER_BEGIN \ | |
98 | _Pragma ("GCC diagnostic push") \ | |
99 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | |
100 | _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ | |
101 | _GL_INLINE_HEADER_CONST_PRAGMA | |
102 | # define _GL_INLINE_HEADER_END \ | |
103 | _Pragma ("GCC diagnostic pop") | |
104 | #else | |
105 | # define _GL_INLINE_HEADER_BEGIN | |
106 | # define _GL_INLINE_HEADER_END | |
107 | #endif]) | |
108 | ]) | |
109 | ||
110 | # fcntl-o.m4 serial 4 | |
111 | dnl Copyright (C) 2006, 2009-2013 Free Software Foundation, Inc. | |
112 | dnl This file is free software; the Free Software Foundation | |
113 | dnl gives unlimited permission to copy and/or distribute it, | |
114 | dnl with or without modifications, as long as this notice is preserved. | |
115 | ||
116 | dnl Written by Paul Eggert. | |
117 | ||
118 | # Test whether the flags O_NOATIME and O_NOFOLLOW actually work. | |
119 | # Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. | |
120 | # Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. | |
121 | AC_DEFUN([gl_FCNTL_O_FLAGS], | |
122 | [ | |
123 | dnl Persuade glibc <fcntl.h> to define O_NOATIME and O_NOFOLLOW. | |
124 | dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes | |
125 | dnl AC_GNU_SOURCE. | |
126 | m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], | |
127 | [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], | |
128 | [AC_REQUIRE([AC_GNU_SOURCE])]) | |
129 | ||
130 | AC_CHECK_HEADERS_ONCE([unistd.h]) | |
131 | AC_CHECK_FUNCS_ONCE([symlink]) | |
132 | AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], | |
133 | [AC_RUN_IFELSE( | |
134 | [AC_LANG_PROGRAM( | |
135 | [[#include <sys/types.h> | |
136 | #include <sys/stat.h> | |
137 | #if HAVE_UNISTD_H | |
138 | # include <unistd.h> | |
139 | #else /* on Windows with MSVC */ | |
140 | # include <io.h> | |
141 | # include <stdlib.h> | |
142 | # defined sleep(n) _sleep ((n) * 1000) | |
143 | #endif | |
144 | #include <fcntl.h> | |
145 | #ifndef O_NOATIME | |
146 | #define O_NOATIME 0 | |
147 | #endif | |
148 | #ifndef O_NOFOLLOW | |
149 | #define O_NOFOLLOW 0 | |
150 | #endif | |
151 | static int const constants[] = | |
152 | { | |
153 | O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, | |
154 | O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY | |
155 | }; | |
156 | ]], | |
157 | [[ | |
158 | int result = !constants; | |
159 | #if HAVE_SYMLINK | |
160 | { | |
161 | static char const sym[] = "conftest.sym"; | |
162 | if (symlink ("/dev/null", sym) != 0) | |
163 | result |= 2; | |
164 | else | |
165 | { | |
166 | int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); | |
167 | if (fd >= 0) | |
168 | { | |
169 | close (fd); | |
170 | result |= 4; | |
171 | } | |
172 | } | |
173 | if (unlink (sym) != 0 || symlink (".", sym) != 0) | |
174 | result |= 2; | |
175 | else | |
176 | { | |
177 | int fd = open (sym, O_RDONLY | O_NOFOLLOW); | |
178 | if (fd >= 0) | |
179 | { | |
180 | close (fd); | |
181 | result |= 4; | |
182 | } | |
183 | } | |
184 | unlink (sym); | |
185 | } | |
186 | #endif | |
187 | { | |
188 | static char const file[] = "confdefs.h"; | |
189 | int fd = open (file, O_RDONLY | O_NOATIME); | |
190 | if (fd < 0) | |
191 | result |= 8; | |
192 | else | |
193 | { | |
194 | struct stat st0; | |
195 | if (fstat (fd, &st0) != 0) | |
196 | result |= 16; | |
197 | else | |
198 | { | |
199 | char c; | |
200 | sleep (1); | |
201 | if (read (fd, &c, 1) != 1) | |
202 | result |= 24; | |
203 | else | |
204 | { | |
205 | if (close (fd) != 0) | |
206 | result |= 32; | |
207 | else | |
208 | { | |
209 | struct stat st1; | |
210 | if (stat (file, &st1) != 0) | |
211 | result |= 40; | |
212 | else | |
213 | if (st0.st_atime != st1.st_atime) | |
214 | result |= 64; | |
215 | } | |
216 | } | |
217 | } | |
218 | } | |
219 | } | |
220 | return result;]])], | |
221 | [gl_cv_header_working_fcntl_h=yes], | |
222 | [case $? in #( | |
223 | 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( | |
224 | 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( | |
225 | 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( | |
226 | *) gl_cv_header_working_fcntl_h='no';; | |
227 | esac], | |
228 | [gl_cv_header_working_fcntl_h=cross-compiling])]) | |
229 | ||
230 | case $gl_cv_header_working_fcntl_h in #( | |
231 | *O_NOATIME* | no | cross-compiling) ac_val=0;; #( | |
232 | *) ac_val=1;; | |
233 | esac | |
234 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], | |
235 | [Define to 1 if O_NOATIME works.]) | |
236 | ||
237 | case $gl_cv_header_working_fcntl_h in #( | |
238 | *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( | |
239 | *) ac_val=1;; | |
240 | esac | |
241 | AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], | |
242 | [Define to 1 if O_NOFOLLOW works.]) | |
243 | ]) | |
244 | ||
245 | # gettext.m4 serial 66 (gettext-0.18.2) | |
246 | dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. | |
247 | dnl This file is free software; the Free Software Foundation | |
248 | dnl gives unlimited permission to copy and/or distribute it, | |
249 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
250 | dnl |
251 | dnl This file can can be used in projects which are not available under | |
252 | dnl the GNU General Public License or the GNU Library General Public | |
253 | dnl License but which still want to provide support for the GNU gettext | |
254 | dnl functionality. | |
255 | dnl Please note that the actual code of the GNU gettext library is covered | |
256 | dnl by the GNU Library General Public License, and the rest of the GNU | |
257 | dnl gettext package package is covered by the GNU General Public License. | |
258 | dnl They are *not* in the public domain. | |
259 | ||
260 | dnl Authors: | |
261 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | |
93613951 | 262 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010. |
a04eba3f TT |
263 | |
264 | dnl Macro to add for using GNU gettext. | |
265 | ||
266 | dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). | |
267 | dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The | |
268 | dnl default (if it is not specified or empty) is 'no-libtool'. | |
269 | dnl INTLSYMBOL should be 'external' for packages with no intl directory, | |
270 | dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. | |
271 | dnl If INTLSYMBOL is 'use-libtool', then a libtool library | |
272 | dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, | |
273 | dnl depending on --{enable,disable}-{shared,static} and on the presence of | |
274 | dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library | |
275 | dnl $(top_builddir)/intl/libintl.a will be created. | |
276 | dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext | |
277 | dnl implementations (in libc or libintl) without the ngettext() function | |
278 | dnl will be ignored. If NEEDSYMBOL is specified and is | |
279 | dnl 'need-formatstring-macros', then GNU gettext implementations that don't | |
280 | dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored. | |
281 | dnl INTLDIR is used to find the intl libraries. If empty, | |
93613951 | 282 | dnl the value '$(top_builddir)/intl/' is used. |
a04eba3f TT |
283 | dnl |
284 | dnl The result of the configuration is one of three cases: | |
285 | dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled | |
286 | dnl and used. | |
287 | dnl Catalog format: GNU --> install in $(datadir) | |
288 | dnl Catalog extension: .mo after installation, .gmo in source tree | |
289 | dnl 2) GNU gettext has been found in the system's C library. | |
290 | dnl Catalog format: GNU --> install in $(datadir) | |
291 | dnl Catalog extension: .mo after installation, .gmo in source tree | |
292 | dnl 3) No internationalization, always use English msgid. | |
293 | dnl Catalog format: none | |
294 | dnl Catalog extension: none | |
295 | dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. | |
296 | dnl The use of .gmo is historical (it was needed to avoid overwriting the | |
297 | dnl GNU format catalogs when building on a platform with an X/Open gettext), | |
298 | dnl but we keep it in order not to force irrelevant filename changes on the | |
299 | dnl maintainers. | |
300 | dnl | |
301 | AC_DEFUN([AM_GNU_GETTEXT], | |
302 | [ | |
303 | dnl Argument checking. | |
304 | ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , | |
305 | [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT | |
306 | ])])])])]) | |
93613951 TT |
307 | ifelse(ifelse([$1], [], [old])[]ifelse([$1], [no-libtool], [old]), [old], |
308 | [AC_DIAGNOSE([obsolete], [Use of AM_GNU_GETTEXT without [external] argument is deprecated.])]) | |
a04eba3f TT |
309 | ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], , |
310 | [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT | |
311 | ])])])]) | |
93613951 TT |
312 | define([gt_included_intl], |
313 | ifelse([$1], [external], | |
314 | ifdef([AM_GNU_GETTEXT_][INTL_SUBDIR], [yes], [no]), | |
315 | [yes])) | |
316 | define([gt_libtool_suffix_prefix], ifelse([$1], [use-libtool], [l], [])) | |
317 | gt_NEEDS_INIT | |
318 | AM_GNU_GETTEXT_NEED([$2]) | |
a04eba3f TT |
319 | |
320 | AC_REQUIRE([AM_PO_SUBDIRS])dnl | |
321 | ifelse(gt_included_intl, yes, [ | |
322 | AC_REQUIRE([AM_INTL_SUBDIR])dnl | |
323 | ]) | |
324 | ||
325 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. | |
326 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | |
327 | AC_REQUIRE([AC_LIB_RPATH]) | |
328 | ||
329 | dnl Sometimes libintl requires libiconv, so first search for libiconv. | |
330 | dnl Ideally we would do this search only after the | |
331 | dnl if test "$USE_NLS" = "yes"; then | |
93613951 | 332 | dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then |
a04eba3f TT |
333 | dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT |
334 | dnl the configure script would need to contain the same shell code | |
335 | dnl again, outside any 'if'. There are two solutions: | |
336 | dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. | |
337 | dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. | |
338 | dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not | |
339 | dnl documented, we avoid it. | |
340 | ifelse(gt_included_intl, yes, , [ | |
341 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | |
342 | ]) | |
343 | ||
93613951 TT |
344 | dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation. |
345 | gt_INTL_MACOSX | |
346 | ||
b0cacab0 | 347 | dnl Set USE_NLS. |
93613951 | 348 | AC_REQUIRE([AM_NLS]) |
a04eba3f TT |
349 | |
350 | ifelse(gt_included_intl, yes, [ | |
351 | BUILD_INCLUDED_LIBINTL=no | |
a64c9c13 | 352 | USE_INCLUDED_LIBINTL=no |
a04eba3f TT |
353 | ]) |
354 | LIBINTL= | |
355 | LTLIBINTL= | |
356 | POSUB= | |
a64c9c13 | 357 | |
93613951 TT |
358 | dnl Add a version number to the cache macros. |
359 | case " $gt_needs " in | |
360 | *" need-formatstring-macros "*) gt_api_version=3 ;; | |
361 | *" need-ngettext "*) gt_api_version=2 ;; | |
362 | *) gt_api_version=1 ;; | |
363 | esac | |
364 | gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" | |
365 | gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" | |
366 | ||
a04eba3f TT |
367 | dnl If we use NLS figure out what method |
368 | if test "$USE_NLS" = "yes"; then | |
369 | gt_use_preinstalled_gnugettext=no | |
370 | ifelse(gt_included_intl, yes, [ | |
a64c9c13 | 371 | AC_MSG_CHECKING([whether included gettext is requested]) |
93613951 | 372 | AC_ARG_WITH([included-gettext], |
a64c9c13 TT |
373 | [ --with-included-gettext use the GNU gettext library included here], |
374 | nls_cv_force_use_gnu_gettext=$withval, | |
375 | nls_cv_force_use_gnu_gettext=no) | |
93613951 | 376 | AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext]) |
a64c9c13 TT |
377 | |
378 | nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" | |
379 | if test "$nls_cv_force_use_gnu_gettext" != "yes"; then | |
a04eba3f | 380 | ]) |
a64c9c13 | 381 | dnl User does not insist on using GNU NLS library. Figure out what |
a04eba3f TT |
382 | dnl to use. If GNU gettext is available we use this. Else we have |
383 | dnl to fall back to GNU NLS library. | |
384 | ||
93613951 TT |
385 | if test $gt_api_version -ge 3; then |
386 | gt_revision_test_code=' | |
387 | #ifndef __GNU_GETTEXT_SUPPORTED_REVISION | |
a04eba3f TT |
388 | #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) |
389 | #endif | |
390 | changequote(,)dnl | |
391 | typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; | |
392 | changequote([,])dnl | |
93613951 TT |
393 | ' |
394 | else | |
395 | gt_revision_test_code= | |
396 | fi | |
397 | if test $gt_api_version -ge 2; then | |
398 | gt_expression_test_code=' + * ngettext ("", "", 0)' | |
399 | else | |
400 | gt_expression_test_code= | |
401 | fi | |
402 | ||
403 | AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc], | |
404 | [AC_LINK_IFELSE( | |
405 | [AC_LANG_PROGRAM( | |
406 | [[ | |
407 | #include <libintl.h> | |
408 | $gt_revision_test_code | |
409 | extern int _nl_msg_cat_cntr; | |
410 | extern int *_nl_domain_bindings; | |
411 | ]], | |
412 | [[ | |
413 | bindtextdomain ("", ""); | |
414 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings | |
415 | ]])], | |
416 | [eval "$gt_func_gnugettext_libc=yes"], | |
417 | [eval "$gt_func_gnugettext_libc=no"])]) | |
418 | ||
419 | if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then | |
a04eba3f TT |
420 | dnl Sometimes libintl requires libiconv, so first search for libiconv. |
421 | ifelse(gt_included_intl, yes, , [ | |
422 | AM_ICONV_LINK | |
423 | ]) | |
424 | dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL | |
425 | dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) | |
426 | dnl because that would add "-liconv" to LIBINTL and LTLIBINTL | |
427 | dnl even if libiconv doesn't exist. | |
428 | AC_LIB_LINKFLAGS_BODY([intl]) | |
429 | AC_CACHE_CHECK([for GNU gettext in libintl], | |
93613951 | 430 | [$gt_func_gnugettext_libintl], |
a04eba3f TT |
431 | [gt_save_CPPFLAGS="$CPPFLAGS" |
432 | CPPFLAGS="$CPPFLAGS $INCINTL" | |
433 | gt_save_LIBS="$LIBS" | |
434 | LIBS="$LIBS $LIBINTL" | |
435 | dnl Now see whether libintl exists and does not depend on libiconv. | |
93613951 TT |
436 | AC_LINK_IFELSE( |
437 | [AC_LANG_PROGRAM( | |
438 | [[ | |
439 | #include <libintl.h> | |
440 | $gt_revision_test_code | |
441 | extern int _nl_msg_cat_cntr; | |
a04eba3f TT |
442 | extern |
443 | #ifdef __cplusplus | |
444 | "C" | |
445 | #endif | |
93613951 TT |
446 | const char *_nl_expand_alias (const char *); |
447 | ]], | |
448 | [[ | |
449 | bindtextdomain ("", ""); | |
450 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") | |
451 | ]])], | |
452 | [eval "$gt_func_gnugettext_libintl=yes"], | |
453 | [eval "$gt_func_gnugettext_libintl=no"]) | |
a04eba3f | 454 | dnl Now see whether libintl exists and depends on libiconv. |
93613951 | 455 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then |
a04eba3f | 456 | LIBS="$LIBS $LIBICONV" |
93613951 TT |
457 | AC_LINK_IFELSE( |
458 | [AC_LANG_PROGRAM( | |
459 | [[ | |
460 | #include <libintl.h> | |
461 | $gt_revision_test_code | |
462 | extern int _nl_msg_cat_cntr; | |
a04eba3f TT |
463 | extern |
464 | #ifdef __cplusplus | |
465 | "C" | |
466 | #endif | |
93613951 TT |
467 | const char *_nl_expand_alias (const char *); |
468 | ]], | |
469 | [[ | |
470 | bindtextdomain ("", ""); | |
471 | return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") | |
472 | ]])], | |
473 | [LIBINTL="$LIBINTL $LIBICONV" | |
474 | LTLIBINTL="$LTLIBINTL $LTLIBICONV" | |
475 | eval "$gt_func_gnugettext_libintl=yes" | |
476 | ]) | |
a04eba3f TT |
477 | fi |
478 | CPPFLAGS="$gt_save_CPPFLAGS" | |
479 | LIBS="$gt_save_LIBS"]) | |
480 | fi | |
481 | ||
482 | dnl If an already present or preinstalled GNU gettext() is found, | |
483 | dnl use it. But if this macro is used in GNU gettext, and GNU | |
484 | dnl gettext is already preinstalled in libintl, we update this | |
485 | dnl libintl. (Cf. the install rule in intl/Makefile.in.) | |
93613951 TT |
486 | if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ |
487 | || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ | |
b0cacab0 TT |
488 | && test "$PACKAGE" != gettext-runtime \ |
489 | && test "$PACKAGE" != gettext-tools; }; then | |
a04eba3f TT |
490 | gt_use_preinstalled_gnugettext=yes |
491 | else | |
492 | dnl Reset the values set by searching for libintl. | |
493 | LIBINTL= | |
494 | LTLIBINTL= | |
495 | INCINTL= | |
a64c9c13 TT |
496 | fi |
497 | ||
a04eba3f TT |
498 | ifelse(gt_included_intl, yes, [ |
499 | if test "$gt_use_preinstalled_gnugettext" != "yes"; then | |
500 | dnl GNU gettext is not found in the C library. | |
501 | dnl Fall back on included GNU gettext library. | |
502 | nls_cv_use_gnu_gettext=yes | |
a64c9c13 TT |
503 | fi |
504 | fi | |
505 | ||
506 | if test "$nls_cv_use_gnu_gettext" = "yes"; then | |
507 | dnl Mark actions used to generate GNU NLS library. | |
a04eba3f TT |
508 | BUILD_INCLUDED_LIBINTL=yes |
509 | USE_INCLUDED_LIBINTL=yes | |
93613951 TT |
510 | LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV $LIBTHREAD" |
511 | LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV $LTLIBTHREAD" | |
a04eba3f | 512 | LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` |
a64c9c13 TT |
513 | fi |
514 | ||
93613951 | 515 | CATOBJEXT= |
a04eba3f TT |
516 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
517 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | |
518 | dnl Mark actions to use GNU gettext tools. | |
519 | CATOBJEXT=.gmo | |
a64c9c13 | 520 | fi |
a04eba3f | 521 | ]) |
a64c9c13 | 522 | |
93613951 TT |
523 | if test -n "$INTL_MACOSX_LIBS"; then |
524 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ | |
525 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | |
526 | dnl Some extra flags are needed during linking. | |
527 | LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" | |
528 | LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" | |
529 | fi | |
530 | fi | |
531 | ||
a04eba3f TT |
532 | if test "$gt_use_preinstalled_gnugettext" = "yes" \ |
533 | || test "$nls_cv_use_gnu_gettext" = "yes"; then | |
93613951 | 534 | AC_DEFINE([ENABLE_NLS], [1], |
a04eba3f TT |
535 | [Define to 1 if translation of program messages to the user's native language |
536 | is requested.]) | |
a64c9c13 | 537 | else |
a04eba3f | 538 | USE_NLS=no |
a64c9c13 | 539 | fi |
a04eba3f | 540 | fi |
a64c9c13 | 541 | |
b0cacab0 TT |
542 | AC_MSG_CHECKING([whether to use NLS]) |
543 | AC_MSG_RESULT([$USE_NLS]) | |
544 | if test "$USE_NLS" = "yes"; then | |
545 | AC_MSG_CHECKING([where the gettext function comes from]) | |
546 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then | |
93613951 | 547 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then |
b0cacab0 TT |
548 | gt_source="external libintl" |
549 | else | |
550 | gt_source="libc" | |
551 | fi | |
552 | else | |
553 | gt_source="included intl directory" | |
554 | fi | |
555 | AC_MSG_RESULT([$gt_source]) | |
556 | fi | |
557 | ||
a04eba3f | 558 | if test "$USE_NLS" = "yes"; then |
a64c9c13 | 559 | |
a04eba3f | 560 | if test "$gt_use_preinstalled_gnugettext" = "yes"; then |
93613951 | 561 | if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then |
a04eba3f TT |
562 | AC_MSG_CHECKING([how to link with libintl]) |
563 | AC_MSG_RESULT([$LIBINTL]) | |
564 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) | |
565 | fi | |
566 | ||
567 | dnl For backward compatibility. Some packages may be using this. | |
93613951 | 568 | AC_DEFINE([HAVE_GETTEXT], [1], |
a04eba3f | 569 | [Define if the GNU gettext() function is already present or preinstalled.]) |
93613951 | 570 | AC_DEFINE([HAVE_DCGETTEXT], [1], |
a04eba3f | 571 | [Define if the GNU dcgettext() function is already present or preinstalled.]) |
a64c9c13 TT |
572 | fi |
573 | ||
a04eba3f TT |
574 | dnl We need to process the po/ directory. |
575 | POSUB=po | |
576 | fi | |
577 | ||
578 | ifelse(gt_included_intl, yes, [ | |
579 | dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL | |
580 | dnl to 'yes' because some of the testsuite requires it. | |
b0cacab0 | 581 | if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then |
a04eba3f TT |
582 | BUILD_INCLUDED_LIBINTL=yes |
583 | fi | |
a64c9c13 TT |
584 | |
585 | dnl Make all variables we use known to autoconf. | |
93613951 TT |
586 | AC_SUBST([BUILD_INCLUDED_LIBINTL]) |
587 | AC_SUBST([USE_INCLUDED_LIBINTL]) | |
588 | AC_SUBST([CATOBJEXT]) | |
a04eba3f TT |
589 | |
590 | dnl For backward compatibility. Some configure.ins may be using this. | |
591 | nls_cv_header_intl= | |
592 | nls_cv_header_libgt= | |
593 | ||
594 | dnl For backward compatibility. Some Makefiles may be using this. | |
595 | DATADIRNAME=share | |
93613951 | 596 | AC_SUBST([DATADIRNAME]) |
a04eba3f TT |
597 | |
598 | dnl For backward compatibility. Some Makefiles may be using this. | |
599 | INSTOBJEXT=.mo | |
93613951 | 600 | AC_SUBST([INSTOBJEXT]) |
a04eba3f TT |
601 | |
602 | dnl For backward compatibility. Some Makefiles may be using this. | |
603 | GENCAT=gencat | |
93613951 | 604 | AC_SUBST([GENCAT]) |
a04eba3f | 605 | |
b0cacab0 | 606 | dnl For backward compatibility. Some Makefiles may be using this. |
93613951 | 607 | INTLOBJS= |
b0cacab0 TT |
608 | if test "$USE_INCLUDED_LIBINTL" = yes; then |
609 | INTLOBJS="\$(GETTOBJS)" | |
610 | fi | |
93613951 | 611 | AC_SUBST([INTLOBJS]) |
b0cacab0 | 612 | |
a04eba3f TT |
613 | dnl Enable libtool support if the surrounding package wishes it. |
614 | INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix | |
93613951 | 615 | AC_SUBST([INTL_LIBTOOL_SUFFIX_PREFIX]) |
a04eba3f TT |
616 | ]) |
617 | ||
618 | dnl For backward compatibility. Some Makefiles may be using this. | |
619 | INTLLIBS="$LIBINTL" | |
93613951 | 620 | AC_SUBST([INTLLIBS]) |
a04eba3f TT |
621 | |
622 | dnl Make all documented variables known to autoconf. | |
93613951 TT |
623 | AC_SUBST([LIBINTL]) |
624 | AC_SUBST([LTLIBINTL]) | |
625 | AC_SUBST([POSUB]) | |
a04eba3f TT |
626 | ]) |
627 | ||
628 | ||
93613951 TT |
629 | dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized. |
630 | m4_define([gt_NEEDS_INIT], | |
a04eba3f | 631 | [ |
93613951 TT |
632 | m4_divert_text([DEFAULTS], [gt_needs=]) |
633 | m4_define([gt_NEEDS_INIT], []) | |
a04eba3f TT |
634 | ]) |
635 | ||
636 | ||
93613951 TT |
637 | dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL]) |
638 | AC_DEFUN([AM_GNU_GETTEXT_NEED], | |
a04eba3f | 639 | [ |
93613951 | 640 | m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"]) |
a04eba3f TT |
641 | ]) |
642 | ||
643 | ||
644 | dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version]) | |
645 | AC_DEFUN([AM_GNU_GETTEXT_VERSION], []) | |
93613951 TT |
646 | |
647 | # glibc2.m4 serial 3 | |
648 | dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation, | |
649 | dnl Inc. | |
650 | dnl This file is free software; the Free Software Foundation | |
651 | dnl gives unlimited permission to copy and/or distribute it, | |
652 | dnl with or without modifications, as long as this notice is preserved. | |
653 | ||
654 | # Test for the GNU C Library, version 2.0 or newer. | |
a04eba3f TT |
655 | # From Bruno Haible. |
656 | ||
93613951 | 657 | AC_DEFUN([gt_GLIBC2], |
a04eba3f | 658 | [ |
93613951 TT |
659 | AC_CACHE_CHECK([whether we are using the GNU C Library 2 or newer], |
660 | [ac_cv_gnu_library_2], | |
a04eba3f | 661 | [AC_EGREP_CPP([Lucky GNU user], |
93613951 TT |
662 | [ |
663 | #include <features.h> | |
664 | #ifdef __GNU_LIBRARY__ | |
665 | #if (__GLIBC__ >= 2) && !defined __UCLIBC__ | |
666 | Lucky GNU user | |
667 | #endif | |
668 | #endif | |
669 | ], | |
670 | [ac_cv_gnu_library_2=yes], | |
671 | [ac_cv_gnu_library_2=no]) | |
672 | ] | |
673 | ) | |
674 | AC_SUBST([GLIBC2]) | |
675 | GLIBC2="$ac_cv_gnu_library_2" | |
676 | ] | |
677 | ) | |
678 | ||
679 | # glibc21.m4 serial 5 | |
680 | dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2013 Free Software Foundation, | |
681 | dnl Inc. | |
682 | dnl This file is free software; the Free Software Foundation | |
683 | dnl gives unlimited permission to copy and/or distribute it, | |
684 | dnl with or without modifications, as long as this notice is preserved. | |
685 | ||
686 | # Test for the GNU C Library, version 2.1 or newer, or uClibc. | |
687 | # From Bruno Haible. | |
688 | ||
689 | AC_DEFUN([gl_GLIBC21], | |
690 | [ | |
691 | AC_CACHE_CHECK([whether we are using the GNU C Library >= 2.1 or uClibc], | |
692 | [ac_cv_gnu_library_2_1], | |
693 | [AC_EGREP_CPP([Lucky], | |
694 | [ | |
a04eba3f TT |
695 | #include <features.h> |
696 | #ifdef __GNU_LIBRARY__ | |
697 | #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) | |
698 | Lucky GNU user | |
699 | #endif | |
700 | #endif | |
93613951 TT |
701 | #ifdef __UCLIBC__ |
702 | Lucky user | |
703 | #endif | |
704 | ], | |
705 | [ac_cv_gnu_library_2_1=yes], | |
706 | [ac_cv_gnu_library_2_1=no]) | |
a04eba3f TT |
707 | ] |
708 | ) | |
93613951 | 709 | AC_SUBST([GLIBC21]) |
a04eba3f TT |
710 | GLIBC21="$ac_cv_gnu_library_2_1" |
711 | ] | |
712 | ) | |
93613951 TT |
713 | |
714 | # iconv.m4 serial 18 (gettext-0.18.2) | |
715 | dnl Copyright (C) 2000-2002, 2007-2013 Free Software Foundation, Inc. | |
716 | dnl This file is free software; the Free Software Foundation | |
717 | dnl gives unlimited permission to copy and/or distribute it, | |
718 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
719 | |
720 | dnl From Bruno Haible. | |
721 | ||
722 | AC_DEFUN([AM_ICONV_LINKFLAGS_BODY], | |
723 | [ | |
724 | dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. | |
725 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | |
726 | AC_REQUIRE([AC_LIB_RPATH]) | |
727 | ||
728 | dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV | |
729 | dnl accordingly. | |
730 | AC_LIB_LINKFLAGS_BODY([iconv]) | |
731 | ]) | |
732 | ||
733 | AC_DEFUN([AM_ICONV_LINK], | |
734 | [ | |
735 | dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and | |
736 | dnl those with the standalone portable GNU libiconv installed). | |
93613951 | 737 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles |
a04eba3f TT |
738 | |
739 | dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV | |
740 | dnl accordingly. | |
741 | AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) | |
742 | ||
743 | dnl Add $INCICONV to CPPFLAGS before performing the following checks, | |
744 | dnl because if the user has installed libiconv and not disabled its use | |
745 | dnl via --without-libiconv-prefix, he wants to use it. The first | |
93613951 | 746 | dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed. |
a04eba3f TT |
747 | am_save_CPPFLAGS="$CPPFLAGS" |
748 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) | |
749 | ||
93613951 | 750 | AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [ |
a04eba3f TT |
751 | am_cv_func_iconv="no, consider installing GNU libiconv" |
752 | am_cv_lib_iconv=no | |
93613951 TT |
753 | AC_LINK_IFELSE( |
754 | [AC_LANG_PROGRAM( | |
755 | [[ | |
756 | #include <stdlib.h> | |
757 | #include <iconv.h> | |
758 | ]], | |
759 | [[iconv_t cd = iconv_open("",""); | |
760 | iconv(cd,NULL,NULL,NULL,NULL); | |
761 | iconv_close(cd);]])], | |
762 | [am_cv_func_iconv=yes]) | |
a04eba3f TT |
763 | if test "$am_cv_func_iconv" != yes; then |
764 | am_save_LIBS="$LIBS" | |
765 | LIBS="$LIBS $LIBICONV" | |
93613951 TT |
766 | AC_LINK_IFELSE( |
767 | [AC_LANG_PROGRAM( | |
768 | [[ | |
769 | #include <stdlib.h> | |
770 | #include <iconv.h> | |
771 | ]], | |
772 | [[iconv_t cd = iconv_open("",""); | |
773 | iconv(cd,NULL,NULL,NULL,NULL); | |
774 | iconv_close(cd);]])], | |
775 | [am_cv_lib_iconv=yes] | |
776 | [am_cv_func_iconv=yes]) | |
a04eba3f TT |
777 | LIBS="$am_save_LIBS" |
778 | fi | |
a64c9c13 | 779 | ]) |
a04eba3f | 780 | if test "$am_cv_func_iconv" = yes; then |
93613951 TT |
781 | AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ |
782 | dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, | |
783 | dnl Solaris 10. | |
784 | am_save_LIBS="$LIBS" | |
785 | if test $am_cv_lib_iconv = yes; then | |
786 | LIBS="$LIBS $LIBICONV" | |
787 | fi | |
788 | AC_RUN_IFELSE( | |
789 | [AC_LANG_SOURCE([[ | |
790 | #include <iconv.h> | |
791 | #include <string.h> | |
792 | int main () | |
793 | { | |
794 | int result = 0; | |
795 | /* Test against AIX 5.1 bug: Failures are not distinguishable from successful | |
796 | returns. */ | |
797 | { | |
798 | iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); | |
799 | if (cd_utf8_to_88591 != (iconv_t)(-1)) | |
800 | { | |
801 | static const char input[] = "\342\202\254"; /* EURO SIGN */ | |
802 | char buf[10]; | |
803 | const char *inptr = input; | |
804 | size_t inbytesleft = strlen (input); | |
805 | char *outptr = buf; | |
806 | size_t outbytesleft = sizeof (buf); | |
807 | size_t res = iconv (cd_utf8_to_88591, | |
808 | (char **) &inptr, &inbytesleft, | |
809 | &outptr, &outbytesleft); | |
810 | if (res == 0) | |
811 | result |= 1; | |
812 | iconv_close (cd_utf8_to_88591); | |
813 | } | |
814 | } | |
815 | /* Test against Solaris 10 bug: Failures are not distinguishable from | |
816 | successful returns. */ | |
817 | { | |
818 | iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); | |
819 | if (cd_ascii_to_88591 != (iconv_t)(-1)) | |
820 | { | |
821 | static const char input[] = "\263"; | |
822 | char buf[10]; | |
823 | const char *inptr = input; | |
824 | size_t inbytesleft = strlen (input); | |
825 | char *outptr = buf; | |
826 | size_t outbytesleft = sizeof (buf); | |
827 | size_t res = iconv (cd_ascii_to_88591, | |
828 | (char **) &inptr, &inbytesleft, | |
829 | &outptr, &outbytesleft); | |
830 | if (res == 0) | |
831 | result |= 2; | |
832 | iconv_close (cd_ascii_to_88591); | |
833 | } | |
834 | } | |
835 | /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ | |
836 | { | |
837 | iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); | |
838 | if (cd_88591_to_utf8 != (iconv_t)(-1)) | |
839 | { | |
840 | static const char input[] = "\304"; | |
841 | static char buf[2] = { (char)0xDE, (char)0xAD }; | |
842 | const char *inptr = input; | |
843 | size_t inbytesleft = 1; | |
844 | char *outptr = buf; | |
845 | size_t outbytesleft = 1; | |
846 | size_t res = iconv (cd_88591_to_utf8, | |
847 | (char **) &inptr, &inbytesleft, | |
848 | &outptr, &outbytesleft); | |
849 | if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) | |
850 | result |= 4; | |
851 | iconv_close (cd_88591_to_utf8); | |
852 | } | |
853 | } | |
854 | #if 0 /* This bug could be worked around by the caller. */ | |
855 | /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ | |
856 | { | |
857 | iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); | |
858 | if (cd_88591_to_utf8 != (iconv_t)(-1)) | |
859 | { | |
860 | static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; | |
861 | char buf[50]; | |
862 | const char *inptr = input; | |
863 | size_t inbytesleft = strlen (input); | |
864 | char *outptr = buf; | |
865 | size_t outbytesleft = sizeof (buf); | |
866 | size_t res = iconv (cd_88591_to_utf8, | |
867 | (char **) &inptr, &inbytesleft, | |
868 | &outptr, &outbytesleft); | |
869 | if ((int)res > 0) | |
870 | result |= 8; | |
871 | iconv_close (cd_88591_to_utf8); | |
872 | } | |
873 | } | |
874 | #endif | |
875 | /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is | |
876 | provided. */ | |
877 | if (/* Try standardized names. */ | |
878 | iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) | |
879 | /* Try IRIX, OSF/1 names. */ | |
880 | && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) | |
881 | /* Try AIX names. */ | |
882 | && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) | |
883 | /* Try HP-UX names. */ | |
884 | && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) | |
885 | result |= 16; | |
886 | return result; | |
887 | }]])], | |
888 | [am_cv_func_iconv_works=yes], | |
889 | [am_cv_func_iconv_works=no], | |
890 | [ | |
891 | changequote(,)dnl | |
892 | case "$host_os" in | |
893 | aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; | |
894 | *) am_cv_func_iconv_works="guessing yes" ;; | |
895 | esac | |
896 | changequote([,])dnl | |
897 | ]) | |
898 | LIBS="$am_save_LIBS" | |
899 | ]) | |
900 | case "$am_cv_func_iconv_works" in | |
901 | *no) am_func_iconv=no am_cv_lib_iconv=no ;; | |
902 | *) am_func_iconv=yes ;; | |
903 | esac | |
904 | else | |
905 | am_func_iconv=no am_cv_lib_iconv=no | |
906 | fi | |
907 | if test "$am_func_iconv" = yes; then | |
908 | AC_DEFINE([HAVE_ICONV], [1], | |
909 | [Define if you have the iconv() function and it works.]) | |
a04eba3f TT |
910 | fi |
911 | if test "$am_cv_lib_iconv" = yes; then | |
912 | AC_MSG_CHECKING([how to link with libiconv]) | |
913 | AC_MSG_RESULT([$LIBICONV]) | |
914 | else | |
915 | dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV | |
916 | dnl either. | |
917 | CPPFLAGS="$am_save_CPPFLAGS" | |
918 | LIBICONV= | |
919 | LTLIBICONV= | |
920 | fi | |
93613951 TT |
921 | AC_SUBST([LIBICONV]) |
922 | AC_SUBST([LTLIBICONV]) | |
a04eba3f TT |
923 | ]) |
924 | ||
93613951 TT |
925 | dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to |
926 | dnl avoid warnings like | |
927 | dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". | |
928 | dnl This is tricky because of the way 'aclocal' is implemented: | |
929 | dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. | |
930 | dnl Otherwise aclocal's initial scan pass would miss the macro definition. | |
931 | dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. | |
932 | dnl Otherwise aclocal would emit many "Use of uninitialized value $1" | |
933 | dnl warnings. | |
934 | m4_define([gl_iconv_AC_DEFUN], | |
935 | m4_version_prereq([2.64], | |
936 | [[AC_DEFUN_ONCE( | |
937 | [$1], [$2])]], | |
938 | [m4_ifdef([gl_00GNULIB], | |
939 | [[AC_DEFUN_ONCE( | |
940 | [$1], [$2])]], | |
941 | [[AC_DEFUN( | |
942 | [$1], [$2])]])])) | |
943 | gl_iconv_AC_DEFUN([AM_ICONV], | |
a04eba3f TT |
944 | [ |
945 | AM_ICONV_LINK | |
946 | if test "$am_cv_func_iconv" = yes; then | |
947 | AC_MSG_CHECKING([for iconv declaration]) | |
93613951 TT |
948 | AC_CACHE_VAL([am_cv_proto_iconv], [ |
949 | AC_COMPILE_IFELSE( | |
950 | [AC_LANG_PROGRAM( | |
951 | [[ | |
a04eba3f TT |
952 | #include <stdlib.h> |
953 | #include <iconv.h> | |
954 | extern | |
955 | #ifdef __cplusplus | |
956 | "C" | |
957 | #endif | |
93613951 | 958 | #if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) |
a04eba3f TT |
959 | size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); |
960 | #else | |
961 | size_t iconv(); | |
962 | #endif | |
93613951 TT |
963 | ]], |
964 | [[]])], | |
965 | [am_cv_proto_iconv_arg1=""], | |
966 | [am_cv_proto_iconv_arg1="const"]) | |
a04eba3f TT |
967 | 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);"]) |
968 | am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` | |
93613951 TT |
969 | AC_MSG_RESULT([ |
970 | $am_cv_proto_iconv]) | |
971 | AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], | |
a04eba3f | 972 | [Define as const if the declaration of iconv() needs const.]) |
93613951 TT |
973 | dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>. |
974 | m4_ifdef([gl_ICONV_H_DEFAULTS], | |
975 | [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) | |
976 | if test -n "$am_cv_proto_iconv_arg1"; then | |
977 | ICONV_CONST="const" | |
978 | fi | |
979 | ]) | |
a04eba3f TT |
980 | fi |
981 | ]) | |
93613951 TT |
982 | |
983 | # intdiv0.m4 serial 6 (gettext-0.18.2) | |
984 | dnl Copyright (C) 2002, 2007-2008, 2010-2013 Free Software Foundation, Inc. | |
985 | dnl This file is free software; the Free Software Foundation | |
986 | dnl gives unlimited permission to copy and/or distribute it, | |
987 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
988 | |
989 | dnl From Bruno Haible. | |
990 | ||
991 | AC_DEFUN([gt_INTDIV0], | |
992 | [ | |
993 | AC_REQUIRE([AC_PROG_CC])dnl | |
994 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | |
995 | ||
996 | AC_CACHE_CHECK([whether integer division by zero raises SIGFPE], | |
997 | gt_cv_int_divbyzero_sigfpe, | |
998 | [ | |
93613951 TT |
999 | gt_cv_int_divbyzero_sigfpe= |
1000 | changequote(,)dnl | |
1001 | case "$host_os" in | |
1002 | macos* | darwin[6-9]* | darwin[1-9][0-9]*) | |
1003 | # On Mac OS X 10.2 or newer, just assume the same as when cross- | |
1004 | # compiling. If we were to perform the real test, 1 Crash Report | |
1005 | # dialog window would pop up. | |
1006 | case "$host_cpu" in | |
1007 | i[34567]86 | x86_64) | |
1008 | gt_cv_int_divbyzero_sigfpe="guessing yes" ;; | |
1009 | esac | |
1010 | ;; | |
1011 | esac | |
1012 | changequote([,])dnl | |
1013 | if test -z "$gt_cv_int_divbyzero_sigfpe"; then | |
1014 | AC_RUN_IFELSE( | |
1015 | [AC_LANG_SOURCE([[ | |
a04eba3f TT |
1016 | #include <stdlib.h> |
1017 | #include <signal.h> | |
1018 | ||
1019 | static void | |
a04eba3f | 1020 | sigfpe_handler (int sig) |
a04eba3f TT |
1021 | { |
1022 | /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */ | |
1023 | exit (sig != SIGFPE); | |
1024 | } | |
1025 | ||
1026 | int x = 1; | |
1027 | int y = 0; | |
1028 | int z; | |
1029 | int nan; | |
1030 | ||
1031 | int main () | |
1032 | { | |
1033 | signal (SIGFPE, sigfpe_handler); | |
1034 | /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */ | |
1035 | #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP) | |
1036 | signal (SIGTRAP, sigfpe_handler); | |
1037 | #endif | |
1038 | /* Linux/SPARC yields signal SIGILL. */ | |
1039 | #if defined (__sparc__) && defined (__linux__) | |
1040 | signal (SIGILL, sigfpe_handler); | |
1041 | #endif | |
a64c9c13 | 1042 | |
a04eba3f TT |
1043 | z = x / y; |
1044 | nan = y / y; | |
93613951 | 1045 | exit (2); |
a04eba3f | 1046 | } |
93613951 TT |
1047 | ]])], |
1048 | [gt_cv_int_divbyzero_sigfpe=yes], | |
1049 | [gt_cv_int_divbyzero_sigfpe=no], | |
1050 | [ | |
1051 | # Guess based on the CPU. | |
1052 | changequote(,)dnl | |
1053 | case "$host_cpu" in | |
1054 | alpha* | i[34567]86 | x86_64 | m68k | s390*) | |
1055 | gt_cv_int_divbyzero_sigfpe="guessing yes";; | |
1056 | *) | |
1057 | gt_cv_int_divbyzero_sigfpe="guessing no";; | |
1058 | esac | |
1059 | changequote([,])dnl | |
1060 | ]) | |
1061 | fi | |
a04eba3f TT |
1062 | ]) |
1063 | case "$gt_cv_int_divbyzero_sigfpe" in | |
1064 | *yes) value=1;; | |
1065 | *) value=0;; | |
1066 | esac | |
93613951 | 1067 | AC_DEFINE_UNQUOTED([INTDIV0_RAISES_SIGFPE], [$value], |
a04eba3f TT |
1068 | [Define if integer division by zero raises signal SIGFPE.]) |
1069 | ]) | |
93613951 TT |
1070 | |
1071 | # intl.m4 serial 25 (gettext-0.18.3) | |
1072 | dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. | |
1073 | dnl This file is free software; the Free Software Foundation | |
1074 | dnl gives unlimited permission to copy and/or distribute it, | |
1075 | dnl with or without modifications, as long as this notice is preserved. | |
1076 | dnl | |
1077 | dnl This file can can be used in projects which are not available under | |
1078 | dnl the GNU General Public License or the GNU Library General Public | |
1079 | dnl License but which still want to provide support for the GNU gettext | |
1080 | dnl functionality. | |
1081 | dnl Please note that the actual code of the GNU gettext library is covered | |
1082 | dnl by the GNU Library General Public License, and the rest of the GNU | |
1083 | dnl gettext package package is covered by the GNU General Public License. | |
1084 | dnl They are *not* in the public domain. | |
1085 | ||
1086 | dnl Authors: | |
1087 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | |
1088 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2009. | |
1089 | ||
1090 | AC_PREREQ([2.60]) | |
1091 | ||
1092 | dnl Checks for all prerequisites of the intl subdirectory, | |
1093 | dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, | |
1094 | dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. | |
1095 | AC_DEFUN([AM_INTL_SUBDIR], | |
1096 | [ | |
1097 | AC_REQUIRE([AC_PROG_INSTALL])dnl | |
1098 | AC_REQUIRE([AC_PROG_MKDIR_P])dnl | |
1099 | AC_REQUIRE([AC_PROG_CC])dnl | |
1100 | AC_REQUIRE([AC_CANONICAL_HOST])dnl | |
1101 | AC_REQUIRE([gt_GLIBC2])dnl | |
1102 | AC_REQUIRE([AC_PROG_RANLIB])dnl | |
1103 | AC_REQUIRE([gl_VISIBILITY])dnl | |
1104 | AC_REQUIRE([gt_INTL_SUBDIR_CORE])dnl | |
1105 | AC_REQUIRE([AC_TYPE_LONG_LONG_INT])dnl | |
1106 | AC_REQUIRE([gt_TYPE_WCHAR_T])dnl | |
1107 | AC_REQUIRE([gt_TYPE_WINT_T])dnl | |
1108 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) | |
1109 | AC_REQUIRE([gt_TYPE_INTMAX_T]) | |
1110 | AC_REQUIRE([gt_PRINTF_POSIX]) | |
1111 | AC_REQUIRE([gl_GLIBC21])dnl | |
1112 | AC_REQUIRE([gl_XSIZE])dnl | |
1113 | AC_REQUIRE([gl_FCNTL_O_FLAGS])dnl | |
1114 | AC_REQUIRE([gt_INTL_MACOSX])dnl | |
1115 | AC_REQUIRE([gl_EXTERN_INLINE])dnl | |
1116 | ||
1117 | dnl Support for automake's --enable-silent-rules. | |
1118 | case "$enable_silent_rules" in | |
1119 | yes) INTL_DEFAULT_VERBOSITY=0;; | |
1120 | no) INTL_DEFAULT_VERBOSITY=1;; | |
1121 | *) INTL_DEFAULT_VERBOSITY=1;; | |
1122 | esac | |
1123 | AC_SUBST([INTL_DEFAULT_VERBOSITY]) | |
1124 | ||
1125 | AC_CHECK_TYPE([ptrdiff_t], , | |
1126 | [AC_DEFINE([ptrdiff_t], [long], | |
1127 | [Define as the type of the result of subtracting two pointers, if the system doesn't define it.]) | |
1128 | ]) | |
1129 | AC_CHECK_HEADERS([features.h stddef.h stdlib.h string.h]) | |
1130 | AC_CHECK_FUNCS([asprintf fwprintf newlocale putenv setenv setlocale \ | |
1131 | snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb]) | |
1132 | ||
1133 | dnl Use the _snprintf function only if it is declared (because on NetBSD it | |
1134 | dnl is defined as a weak alias of snprintf; we prefer to use the latter). | |
1135 | AC_CHECK_DECLS([_snprintf, _snwprintf], , , [#include <stdio.h>]) | |
1136 | ||
1137 | dnl Use the *_unlocked functions only if they are declared. | |
1138 | dnl (because some of them were defined without being declared in Solaris | |
1139 | dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built | |
1140 | dnl on Solaris 2.5.1 to run on Solaris 2.6). | |
1141 | AC_CHECK_DECLS([getc_unlocked], , , [#include <stdio.h>]) | |
1142 | ||
1143 | case $gt_cv_func_printf_posix in | |
1144 | *yes) HAVE_POSIX_PRINTF=1 ;; | |
1145 | *) HAVE_POSIX_PRINTF=0 ;; | |
1146 | esac | |
1147 | AC_SUBST([HAVE_POSIX_PRINTF]) | |
1148 | if test "$ac_cv_func_asprintf" = yes; then | |
1149 | HAVE_ASPRINTF=1 | |
1150 | else | |
1151 | HAVE_ASPRINTF=0 | |
1152 | fi | |
1153 | AC_SUBST([HAVE_ASPRINTF]) | |
1154 | if test "$ac_cv_func_snprintf" = yes; then | |
1155 | HAVE_SNPRINTF=1 | |
1156 | else | |
1157 | HAVE_SNPRINTF=0 | |
1158 | fi | |
1159 | AC_SUBST([HAVE_SNPRINTF]) | |
1160 | if test "$ac_cv_func_newlocale" = yes; then | |
1161 | HAVE_NEWLOCALE=1 | |
1162 | else | |
1163 | HAVE_NEWLOCALE=0 | |
1164 | fi | |
1165 | AC_SUBST([HAVE_NEWLOCALE]) | |
1166 | if test "$ac_cv_func_wprintf" = yes; then | |
1167 | HAVE_WPRINTF=1 | |
1168 | else | |
1169 | HAVE_WPRINTF=0 | |
1170 | fi | |
1171 | AC_SUBST([HAVE_WPRINTF]) | |
1172 | ||
1173 | AM_LANGINFO_CODESET | |
1174 | gt_LC_MESSAGES | |
1175 | ||
1176 | dnl Compilation on mingw and Cygwin needs special Makefile rules, because | |
1177 | dnl 1. when we install a shared library, we must arrange to export | |
1178 | dnl auxiliary pointer variables for every exported variable, | |
1179 | dnl 2. when we install a shared library and a static library simultaneously, | |
1180 | dnl the include file specifies __declspec(dllimport) and therefore we | |
1181 | dnl must arrange to define the auxiliary pointer variables for the | |
1182 | dnl exported variables _also_ in the static library. | |
1183 | if test "$enable_shared" = yes; then | |
1184 | case "$host_os" in | |
1185 | mingw* | cygwin*) is_woe32dll=yes ;; | |
1186 | *) is_woe32dll=no ;; | |
1187 | esac | |
1188 | else | |
1189 | is_woe32dll=no | |
1190 | fi | |
1191 | WOE32DLL=$is_woe32dll | |
1192 | AC_SUBST([WOE32DLL]) | |
1193 | ||
1194 | dnl On mingw and Cygwin, we can activate special Makefile rules which add | |
1195 | dnl version information to the shared libraries and executables. | |
1196 | case "$host_os" in | |
1197 | mingw* | cygwin*) is_woe32=yes ;; | |
1198 | *) is_woe32=no ;; | |
1199 | esac | |
1200 | WOE32=$is_woe32 | |
1201 | AC_SUBST([WOE32]) | |
1202 | if test $WOE32 = yes; then | |
1203 | dnl Check for a program that compiles Windows resource files. | |
1204 | AC_CHECK_TOOL([WINDRES], [windres]) | |
1205 | fi | |
1206 | ||
1207 | dnl Determine whether when creating a library, "-lc" should be passed to | |
1208 | dnl libtool or not. On many platforms, it is required for the libtool option | |
1209 | dnl -no-undefined to work. On HP-UX, however, the -lc - stored by libtool | |
1210 | dnl in the *.la files - makes it impossible to create multithreaded programs, | |
1211 | dnl because libtool also reorders the -lc to come before the -pthread, and | |
1212 | dnl this disables pthread_create() <http://docs.hp.com/en/1896/pthreads.html>. | |
1213 | case "$host_os" in | |
1214 | hpux*) LTLIBC="" ;; | |
1215 | *) LTLIBC="-lc" ;; | |
1216 | esac | |
1217 | AC_SUBST([LTLIBC]) | |
1218 | ||
1219 | dnl Rename some macros and functions used for locking. | |
1220 | AH_BOTTOM([ | |
1221 | #define __libc_lock_t gl_lock_t | |
1222 | #define __libc_lock_define gl_lock_define | |
1223 | #define __libc_lock_define_initialized gl_lock_define_initialized | |
1224 | #define __libc_lock_init gl_lock_init | |
1225 | #define __libc_lock_lock gl_lock_lock | |
1226 | #define __libc_lock_unlock gl_lock_unlock | |
1227 | #define __libc_lock_recursive_t gl_recursive_lock_t | |
1228 | #define __libc_lock_define_recursive gl_recursive_lock_define | |
1229 | #define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized | |
1230 | #define __libc_lock_init_recursive gl_recursive_lock_init | |
1231 | #define __libc_lock_lock_recursive gl_recursive_lock_lock | |
1232 | #define __libc_lock_unlock_recursive gl_recursive_lock_unlock | |
1233 | #define glthread_in_use libintl_thread_in_use | |
1234 | #define glthread_lock_init_func libintl_lock_init_func | |
1235 | #define glthread_lock_lock_func libintl_lock_lock_func | |
1236 | #define glthread_lock_unlock_func libintl_lock_unlock_func | |
1237 | #define glthread_lock_destroy_func libintl_lock_destroy_func | |
1238 | #define glthread_rwlock_init_multithreaded libintl_rwlock_init_multithreaded | |
1239 | #define glthread_rwlock_init_func libintl_rwlock_init_func | |
1240 | #define glthread_rwlock_rdlock_multithreaded libintl_rwlock_rdlock_multithreaded | |
1241 | #define glthread_rwlock_rdlock_func libintl_rwlock_rdlock_func | |
1242 | #define glthread_rwlock_wrlock_multithreaded libintl_rwlock_wrlock_multithreaded | |
1243 | #define glthread_rwlock_wrlock_func libintl_rwlock_wrlock_func | |
1244 | #define glthread_rwlock_unlock_multithreaded libintl_rwlock_unlock_multithreaded | |
1245 | #define glthread_rwlock_unlock_func libintl_rwlock_unlock_func | |
1246 | #define glthread_rwlock_destroy_multithreaded libintl_rwlock_destroy_multithreaded | |
1247 | #define glthread_rwlock_destroy_func libintl_rwlock_destroy_func | |
1248 | #define glthread_recursive_lock_init_multithreaded libintl_recursive_lock_init_multithreaded | |
1249 | #define glthread_recursive_lock_init_func libintl_recursive_lock_init_func | |
1250 | #define glthread_recursive_lock_lock_multithreaded libintl_recursive_lock_lock_multithreaded | |
1251 | #define glthread_recursive_lock_lock_func libintl_recursive_lock_lock_func | |
1252 | #define glthread_recursive_lock_unlock_multithreaded libintl_recursive_lock_unlock_multithreaded | |
1253 | #define glthread_recursive_lock_unlock_func libintl_recursive_lock_unlock_func | |
1254 | #define glthread_recursive_lock_destroy_multithreaded libintl_recursive_lock_destroy_multithreaded | |
1255 | #define glthread_recursive_lock_destroy_func libintl_recursive_lock_destroy_func | |
1256 | #define glthread_once_func libintl_once_func | |
1257 | #define glthread_once_singlethreaded libintl_once_singlethreaded | |
1258 | #define glthread_once_multithreaded libintl_once_multithreaded | |
1259 | ]) | |
1260 | ]) | |
1261 | ||
1262 | ||
1263 | dnl Checks for the core files of the intl subdirectory: | |
1264 | dnl dcigettext.c | |
1265 | dnl eval-plural.h | |
1266 | dnl explodename.c | |
1267 | dnl finddomain.c | |
1268 | dnl gettextP.h | |
1269 | dnl gmo.h | |
1270 | dnl hash-string.h hash-string.c | |
1271 | dnl l10nflist.c | |
1272 | dnl libgnuintl.h.in (except the *printf stuff) | |
1273 | dnl loadinfo.h | |
1274 | dnl loadmsgcat.c | |
1275 | dnl localealias.c | |
1276 | dnl log.c | |
1277 | dnl plural-exp.h plural-exp.c | |
1278 | dnl plural.y | |
1279 | dnl Used by libglocale. | |
1280 | AC_DEFUN([gt_INTL_SUBDIR_CORE], | |
1281 | [ | |
1282 | AC_REQUIRE([AC_C_INLINE])dnl | |
1283 | AC_REQUIRE([AC_TYPE_SIZE_T])dnl | |
1284 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | |
1285 | AC_REQUIRE([AC_FUNC_ALLOCA])dnl | |
1286 | AC_REQUIRE([AC_FUNC_MMAP])dnl | |
1287 | AC_REQUIRE([gt_INTDIV0])dnl | |
1288 | AC_REQUIRE([gl_AC_TYPE_UINTMAX_T])dnl | |
1289 | AC_REQUIRE([gt_INTTYPES_PRI])dnl | |
1290 | AC_REQUIRE([gl_LOCK])dnl | |
1291 | ||
1292 | AC_LINK_IFELSE( | |
1293 | [AC_LANG_PROGRAM( | |
1294 | [[int foo (int a) { a = __builtin_expect (a, 10); return a == 10 ? 0 : 1; }]], | |
1295 | [[]])], | |
1296 | [AC_DEFINE([HAVE_BUILTIN_EXPECT], [1], | |
1297 | [Define to 1 if the compiler understands __builtin_expect.])]) | |
1298 | ||
1299 | AC_CHECK_HEADERS([argz.h inttypes.h limits.h unistd.h sys/param.h]) | |
1300 | AC_CHECK_FUNCS([getcwd getegid geteuid getgid getuid mempcpy munmap \ | |
1301 | stpcpy strcasecmp strdup strtoul tsearch uselocale argz_count \ | |
1302 | argz_stringify argz_next __fsetlocking]) | |
1303 | ||
1304 | dnl Use the *_unlocked functions only if they are declared. | |
1305 | dnl (because some of them were defined without being declared in Solaris | |
1306 | dnl 2.5.1 but were removed in Solaris 2.6, whereas we want binaries built | |
1307 | dnl on Solaris 2.5.1 to run on Solaris 2.6). | |
1308 | AC_CHECK_DECLS([feof_unlocked, fgets_unlocked], , , [#include <stdio.h>]) | |
1309 | ||
1310 | AM_ICONV | |
1311 | ||
1312 | dnl intl/plural.c is generated from intl/plural.y. It requires bison, | |
1313 | dnl because plural.y uses bison specific features. It requires at least | |
1314 | dnl bison-1.26 because earlier versions generate a plural.c that doesn't | |
1315 | dnl compile. | |
1316 | dnl bison is only needed for the maintainer (who touches plural.y). But in | |
1317 | dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put | |
1318 | dnl the rule in general Makefile. Now, some people carelessly touch the | |
1319 | dnl files or have a broken "make" program, hence the plural.c rule will | |
1320 | dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not | |
1321 | dnl present or too old. | |
1322 | AC_CHECK_PROGS([INTLBISON], [bison]) | |
1323 | if test -z "$INTLBISON"; then | |
1324 | ac_verc_fail=yes | |
1325 | else | |
1326 | dnl Found it, now check the version. | |
1327 | AC_MSG_CHECKING([version of bison]) | |
1328 | changequote(<<,>>)dnl | |
1329 | ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` | |
1330 | case $ac_prog_version in | |
1331 | '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; | |
1332 | 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) | |
1333 | changequote([,])dnl | |
1334 | ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; | |
1335 | *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; | |
1336 | esac | |
1337 | AC_MSG_RESULT([$ac_prog_version]) | |
1338 | fi | |
1339 | if test $ac_verc_fail = yes; then | |
1340 | INTLBISON=: | |
1341 | fi | |
1342 | ]) | |
1343 | ||
1344 | # intlmacosx.m4 serial 5 (gettext-0.18.2) | |
1345 | dnl Copyright (C) 2004-2013 Free Software Foundation, Inc. | |
1346 | dnl This file is free software; the Free Software Foundation | |
1347 | dnl gives unlimited permission to copy and/or distribute it, | |
1348 | dnl with or without modifications, as long as this notice is preserved. | |
1349 | dnl | |
1350 | dnl This file can can be used in projects which are not available under | |
1351 | dnl the GNU General Public License or the GNU Library General Public | |
1352 | dnl License but which still want to provide support for the GNU gettext | |
1353 | dnl functionality. | |
1354 | dnl Please note that the actual code of the GNU gettext library is covered | |
1355 | dnl by the GNU Library General Public License, and the rest of the GNU | |
1356 | dnl gettext package package is covered by the GNU General Public License. | |
1357 | dnl They are *not* in the public domain. | |
1358 | ||
1359 | dnl Checks for special options needed on Mac OS X. | |
1360 | dnl Defines INTL_MACOSX_LIBS. | |
1361 | AC_DEFUN([gt_INTL_MACOSX], | |
1362 | [ | |
1363 | dnl Check for API introduced in Mac OS X 10.2. | |
1364 | AC_CACHE_CHECK([for CFPreferencesCopyAppValue], | |
1365 | [gt_cv_func_CFPreferencesCopyAppValue], | |
1366 | [gt_save_LIBS="$LIBS" | |
1367 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" | |
1368 | AC_LINK_IFELSE( | |
1369 | [AC_LANG_PROGRAM( | |
1370 | [[#include <CoreFoundation/CFPreferences.h>]], | |
1371 | [[CFPreferencesCopyAppValue(NULL, NULL)]])], | |
1372 | [gt_cv_func_CFPreferencesCopyAppValue=yes], | |
1373 | [gt_cv_func_CFPreferencesCopyAppValue=no]) | |
1374 | LIBS="$gt_save_LIBS"]) | |
1375 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then | |
1376 | AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1], | |
1377 | [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.]) | |
1378 | fi | |
1379 | dnl Check for API introduced in Mac OS X 10.3. | |
1380 | AC_CACHE_CHECK([for CFLocaleCopyCurrent], [gt_cv_func_CFLocaleCopyCurrent], | |
1381 | [gt_save_LIBS="$LIBS" | |
1382 | LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" | |
1383 | AC_LINK_IFELSE( | |
1384 | [AC_LANG_PROGRAM( | |
1385 | [[#include <CoreFoundation/CFLocale.h>]], | |
1386 | [[CFLocaleCopyCurrent();]])], | |
1387 | [gt_cv_func_CFLocaleCopyCurrent=yes], | |
1388 | [gt_cv_func_CFLocaleCopyCurrent=no]) | |
1389 | LIBS="$gt_save_LIBS"]) | |
1390 | if test $gt_cv_func_CFLocaleCopyCurrent = yes; then | |
1391 | AC_DEFINE([HAVE_CFLOCALECOPYCURRENT], [1], | |
1392 | [Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the CoreFoundation framework.]) | |
1393 | fi | |
1394 | INTL_MACOSX_LIBS= | |
1395 | if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then | |
1396 | INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | |
1397 | fi | |
1398 | AC_SUBST([INTL_MACOSX_LIBS]) | |
1399 | ]) | |
1400 | ||
1401 | # intmax.m4 serial 6 (gettext-0.18.2) | |
1402 | dnl Copyright (C) 2002-2005, 2008-2013 Free Software Foundation, Inc. | |
1403 | dnl This file is free software; the Free Software Foundation | |
1404 | dnl gives unlimited permission to copy and/or distribute it, | |
1405 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
1406 | |
1407 | dnl From Bruno Haible. | |
1408 | dnl Test whether the system has the 'intmax_t' type, but don't attempt to | |
1409 | dnl find a replacement if it is lacking. | |
1410 | ||
1411 | AC_DEFUN([gt_TYPE_INTMAX_T], | |
1412 | [ | |
93613951 TT |
1413 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) |
1414 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | |
1415 | AC_CACHE_CHECK([for intmax_t], [gt_cv_c_intmax_t], | |
1416 | [AC_COMPILE_IFELSE( | |
1417 | [AC_LANG_PROGRAM( | |
1418 | [[ | |
1419 | #include <stddef.h> | |
b0cacab0 TT |
1420 | #include <stdlib.h> |
1421 | #if HAVE_STDINT_H_WITH_UINTMAX | |
1422 | #include <stdint.h> | |
1423 | #endif | |
1424 | #if HAVE_INTTYPES_H_WITH_UINTMAX | |
1425 | #include <inttypes.h> | |
1426 | #endif | |
93613951 TT |
1427 | ]], |
1428 | [[intmax_t x = -1; | |
1429 | return !x;]])], | |
1430 | [gt_cv_c_intmax_t=yes], | |
1431 | [gt_cv_c_intmax_t=no])]) | |
b0cacab0 | 1432 | if test $gt_cv_c_intmax_t = yes; then |
93613951 | 1433 | AC_DEFINE([HAVE_INTMAX_T], [1], |
b0cacab0 TT |
1434 | [Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>.]) |
1435 | fi | |
1436 | ]) | |
a04eba3f | 1437 | |
93613951 TT |
1438 | # inttypes-pri.m4 serial 7 (gettext-0.18.2) |
1439 | dnl Copyright (C) 1997-2002, 2006, 2008-2013 Free Software Foundation, Inc. | |
1440 | dnl This file is free software; the Free Software Foundation | |
1441 | dnl gives unlimited permission to copy and/or distribute it, | |
1442 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
1443 | |
1444 | dnl From Bruno Haible. | |
1445 | ||
93613951 TT |
1446 | AC_PREREQ([2.53]) |
1447 | ||
a04eba3f TT |
1448 | # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI* |
1449 | # macros to non-string values. This is the case on AIX 4.3.3. | |
1450 | ||
1451 | AC_DEFUN([gt_INTTYPES_PRI], | |
1452 | [ | |
93613951 TT |
1453 | AC_CHECK_HEADERS([inttypes.h]) |
1454 | if test $ac_cv_header_inttypes_h = yes; then | |
a04eba3f | 1455 | AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken], |
93613951 | 1456 | [gt_cv_inttypes_pri_broken], |
a04eba3f | 1457 | [ |
93613951 TT |
1458 | AC_COMPILE_IFELSE( |
1459 | [AC_LANG_PROGRAM( | |
1460 | [[ | |
1461 | #include <inttypes.h> | |
a04eba3f TT |
1462 | #ifdef PRId32 |
1463 | char *p = PRId32; | |
1464 | #endif | |
93613951 TT |
1465 | ]], |
1466 | [[]])], | |
1467 | [gt_cv_inttypes_pri_broken=no], | |
1468 | [gt_cv_inttypes_pri_broken=yes]) | |
a04eba3f TT |
1469 | ]) |
1470 | fi | |
1471 | if test "$gt_cv_inttypes_pri_broken" = yes; then | |
93613951 | 1472 | AC_DEFINE_UNQUOTED([PRI_MACROS_BROKEN], [1], |
a04eba3f | 1473 | [Define if <inttypes.h> exists and defines unusable PRI* macros.]) |
93613951 TT |
1474 | PRI_MACROS_BROKEN=1 |
1475 | else | |
1476 | PRI_MACROS_BROKEN=0 | |
a04eba3f | 1477 | fi |
93613951 | 1478 | AC_SUBST([PRI_MACROS_BROKEN]) |
a04eba3f | 1479 | ]) |
93613951 TT |
1480 | |
1481 | # inttypes_h.m4 serial 10 | |
1482 | dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc. | |
1483 | dnl This file is free software; the Free Software Foundation | |
1484 | dnl gives unlimited permission to copy and/or distribute it, | |
1485 | dnl with or without modifications, as long as this notice is preserved. | |
1486 | ||
1487 | dnl From Paul Eggert. | |
1488 | ||
1489 | # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists, | |
1490 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | |
1491 | ||
1492 | AC_DEFUN([gl_AC_HEADER_INTTYPES_H], | |
1493 | [ | |
1494 | AC_CACHE_CHECK([for inttypes.h], [gl_cv_header_inttypes_h], | |
1495 | [AC_COMPILE_IFELSE( | |
1496 | [AC_LANG_PROGRAM( | |
1497 | [[ | |
1498 | #include <sys/types.h> | |
1499 | #include <inttypes.h> | |
1500 | ]], | |
1501 | [[uintmax_t i = (uintmax_t) -1; return !i;]])], | |
1502 | [gl_cv_header_inttypes_h=yes], | |
1503 | [gl_cv_header_inttypes_h=no])]) | |
1504 | if test $gl_cv_header_inttypes_h = yes; then | |
1505 | AC_DEFINE_UNQUOTED([HAVE_INTTYPES_H_WITH_UINTMAX], [1], | |
1506 | [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, | |
1507 | and declares uintmax_t. ]) | |
1508 | fi | |
1509 | ]) | |
1510 | ||
1511 | # lcmessage.m4 serial 7 (gettext-0.18.2) | |
1512 | dnl Copyright (C) 1995-2002, 2004-2005, 2008-2013 Free Software Foundation, | |
1513 | dnl Inc. | |
1514 | dnl This file is free software; the Free Software Foundation | |
1515 | dnl gives unlimited permission to copy and/or distribute it, | |
1516 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
1517 | dnl |
1518 | dnl This file can can be used in projects which are not available under | |
1519 | dnl the GNU General Public License or the GNU Library General Public | |
1520 | dnl License but which still want to provide support for the GNU gettext | |
1521 | dnl functionality. | |
1522 | dnl Please note that the actual code of the GNU gettext library is covered | |
1523 | dnl by the GNU Library General Public License, and the rest of the GNU | |
1524 | dnl gettext package package is covered by the GNU General Public License. | |
1525 | dnl They are *not* in the public domain. | |
1526 | ||
1527 | dnl Authors: | |
1528 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995. | |
a64c9c13 TT |
1529 | |
1530 | # Check whether LC_MESSAGES is available in <locale.h>. | |
a04eba3f | 1531 | |
93613951 | 1532 | AC_DEFUN([gt_LC_MESSAGES], |
a04eba3f | 1533 | [ |
93613951 TT |
1534 | AC_CACHE_CHECK([for LC_MESSAGES], [gt_cv_val_LC_MESSAGES], |
1535 | [AC_LINK_IFELSE( | |
1536 | [AC_LANG_PROGRAM( | |
1537 | [[#include <locale.h>]], | |
1538 | [[return LC_MESSAGES]])], | |
1539 | [gt_cv_val_LC_MESSAGES=yes], | |
1540 | [gt_cv_val_LC_MESSAGES=no])]) | |
1541 | if test $gt_cv_val_LC_MESSAGES = yes; then | |
1542 | AC_DEFINE([HAVE_LC_MESSAGES], [1], | |
a04eba3f TT |
1543 | [Define if your <locale.h> file defines LC_MESSAGES.]) |
1544 | fi | |
1545 | ]) | |
93613951 TT |
1546 | |
1547 | # lib-ld.m4 serial 6 | |
1548 | dnl Copyright (C) 1996-2003, 2009-2013 Free Software Foundation, Inc. | |
1549 | dnl This file is free software; the Free Software Foundation | |
1550 | dnl gives unlimited permission to copy and/or distribute it, | |
1551 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
1552 | |
1553 | dnl Subroutines of libtool.m4, | |
93613951 TT |
1554 | dnl with replacements s/_*LT_PATH/AC_LIB_PROG/ and s/lt_/acl_/ to avoid |
1555 | dnl collision with libtool.m4. | |
a04eba3f | 1556 | |
93613951 | 1557 | dnl From libtool-2.4. Sets the variable with_gnu_ld to yes or no. |
a04eba3f | 1558 | AC_DEFUN([AC_LIB_PROG_LD_GNU], |
93613951 TT |
1559 | [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], |
1560 | [# I'd rather use --version here, but apparently some GNU lds only accept -v. | |
b0cacab0 TT |
1561 | case `$LD -v 2>&1 </dev/null` in |
1562 | *GNU* | *'with BFD'*) | |
93613951 TT |
1563 | acl_cv_prog_gnu_ld=yes |
1564 | ;; | |
b0cacab0 | 1565 | *) |
93613951 TT |
1566 | acl_cv_prog_gnu_ld=no |
1567 | ;; | |
b0cacab0 | 1568 | esac]) |
a04eba3f TT |
1569 | with_gnu_ld=$acl_cv_prog_gnu_ld |
1570 | ]) | |
1571 | ||
93613951 | 1572 | dnl From libtool-2.4. Sets the variable LD. |
a04eba3f | 1573 | AC_DEFUN([AC_LIB_PROG_LD], |
93613951 | 1574 | [AC_REQUIRE([AC_PROG_CC])dnl |
a04eba3f | 1575 | AC_REQUIRE([AC_CANONICAL_HOST])dnl |
93613951 TT |
1576 | |
1577 | AC_ARG_WITH([gnu-ld], | |
1578 | [AS_HELP_STRING([--with-gnu-ld], | |
1579 | [assume the C compiler uses GNU ld [default=no]])], | |
1580 | [test "$withval" = no || with_gnu_ld=yes], | |
1581 | [with_gnu_ld=no])dnl | |
1582 | ||
b0cacab0 TT |
1583 | # Prepare PATH_SEPARATOR. |
1584 | # The user is always right. | |
1585 | if test "${PATH_SEPARATOR+set}" != set; then | |
93613951 TT |
1586 | # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which |
1587 | # contains only /bin. Note that ksh looks also at the FPATH variable, | |
1588 | # so we have to set that as well for the test. | |
1589 | PATH_SEPARATOR=: | |
1590 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ | |
1591 | && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ | |
1592 | || PATH_SEPARATOR=';' | |
1593 | } | |
b0cacab0 | 1594 | fi |
93613951 | 1595 | |
a04eba3f TT |
1596 | ac_prog=ld |
1597 | if test "$GCC" = yes; then | |
1598 | # Check if gcc -print-prog-name=ld gives a path. | |
93613951 | 1599 | AC_MSG_CHECKING([for ld used by $CC]) |
a04eba3f TT |
1600 | case $host in |
1601 | *-*-mingw*) | |
1602 | # gcc leaves a trailing carriage return which upsets mingw | |
1603 | ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; | |
1604 | *) | |
1605 | ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; | |
1606 | esac | |
1607 | case $ac_prog in | |
1608 | # Accept absolute paths. | |
93613951 TT |
1609 | [[\\/]]* | ?:[[\\/]]*) |
1610 | re_direlt='/[[^/]][[^/]]*/\.\./' | |
1611 | # Canonicalize the pathname of ld | |
1612 | ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` | |
1613 | while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do | |
1614 | ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` | |
a04eba3f TT |
1615 | done |
1616 | test -z "$LD" && LD="$ac_prog" | |
1617 | ;; | |
1618 | "") | |
1619 | # If it fails, then pretend we aren't using GCC. | |
1620 | ac_prog=ld | |
1621 | ;; | |
1622 | *) | |
1623 | # If it is relative, then search for the first ld in PATH. | |
1624 | with_gnu_ld=unknown | |
1625 | ;; | |
1626 | esac | |
1627 | elif test "$with_gnu_ld" = yes; then | |
1628 | AC_MSG_CHECKING([for GNU ld]) | |
1629 | else | |
1630 | AC_MSG_CHECKING([for non-GNU ld]) | |
1631 | fi | |
93613951 | 1632 | AC_CACHE_VAL([acl_cv_path_LD], |
a04eba3f | 1633 | [if test -z "$LD"; then |
93613951 | 1634 | acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR |
a04eba3f | 1635 | for ac_dir in $PATH; do |
93613951 | 1636 | IFS="$acl_save_ifs" |
a04eba3f TT |
1637 | test -z "$ac_dir" && ac_dir=. |
1638 | if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then | |
1639 | acl_cv_path_LD="$ac_dir/$ac_prog" | |
1640 | # Check to see if the program is GNU ld. I'd rather use --version, | |
93613951 | 1641 | # but apparently some variants of GNU ld only accept -v. |
a04eba3f | 1642 | # Break only if it was the GNU/non-GNU ld that we prefer. |
93613951 | 1643 | case `"$acl_cv_path_LD" -v 2>&1 </dev/null` in |
b0cacab0 | 1644 | *GNU* | *'with BFD'*) |
93613951 TT |
1645 | test "$with_gnu_ld" != no && break |
1646 | ;; | |
b0cacab0 | 1647 | *) |
93613951 TT |
1648 | test "$with_gnu_ld" != yes && break |
1649 | ;; | |
b0cacab0 | 1650 | esac |
a64c9c13 | 1651 | fi |
a04eba3f | 1652 | done |
93613951 | 1653 | IFS="$acl_save_ifs" |
a04eba3f TT |
1654 | else |
1655 | acl_cv_path_LD="$LD" # Let the user override the test with a path. | |
1656 | fi]) | |
1657 | LD="$acl_cv_path_LD" | |
1658 | if test -n "$LD"; then | |
93613951 | 1659 | AC_MSG_RESULT([$LD]) |
a04eba3f | 1660 | else |
93613951 | 1661 | AC_MSG_RESULT([no]) |
a04eba3f TT |
1662 | fi |
1663 | test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) | |
1664 | AC_LIB_PROG_LD_GNU | |
1665 | ]) | |
93613951 TT |
1666 | |
1667 | # lib-link.m4 serial 26 (gettext-0.18.2) | |
1668 | dnl Copyright (C) 2001-2013 Free Software Foundation, Inc. | |
1669 | dnl This file is free software; the Free Software Foundation | |
1670 | dnl gives unlimited permission to copy and/or distribute it, | |
1671 | dnl with or without modifications, as long as this notice is preserved. | |
a64c9c13 | 1672 | |
a04eba3f TT |
1673 | dnl From Bruno Haible. |
1674 | ||
93613951 TT |
1675 | AC_PREREQ([2.54]) |
1676 | ||
a04eba3f TT |
1677 | dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and |
1678 | dnl the libraries corresponding to explicit and implicit dependencies. | |
1679 | dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and | |
1680 | dnl augments the CPPFLAGS variable. | |
93613951 TT |
1681 | dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname |
1682 | dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | |
a04eba3f TT |
1683 | AC_DEFUN([AC_LIB_LINKFLAGS], |
1684 | [ | |
1685 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | |
1686 | AC_REQUIRE([AC_LIB_RPATH]) | |
93613951 TT |
1687 | pushdef([Name],[m4_translit([$1],[./+-], [____])]) |
1688 | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], | |
1689 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | |
a04eba3f TT |
1690 | AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ |
1691 | AC_LIB_LINKFLAGS_BODY([$1], [$2]) | |
1692 | ac_cv_lib[]Name[]_libs="$LIB[]NAME" | |
1693 | ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" | |
1694 | ac_cv_lib[]Name[]_cppflags="$INC[]NAME" | |
93613951 | 1695 | ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" |
a04eba3f TT |
1696 | ]) |
1697 | LIB[]NAME="$ac_cv_lib[]Name[]_libs" | |
1698 | LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" | |
1699 | INC[]NAME="$ac_cv_lib[]Name[]_cppflags" | |
93613951 | 1700 | LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" |
a04eba3f TT |
1701 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) |
1702 | AC_SUBST([LIB]NAME) | |
1703 | AC_SUBST([LTLIB]NAME) | |
93613951 | 1704 | AC_SUBST([LIB]NAME[_PREFIX]) |
a04eba3f TT |
1705 | dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the |
1706 | dnl results of this search when this library appears as a dependency. | |
1707 | HAVE_LIB[]NAME=yes | |
93613951 TT |
1708 | popdef([NAME]) |
1709 | popdef([Name]) | |
a04eba3f TT |
1710 | ]) |
1711 | ||
93613951 | 1712 | dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) |
a04eba3f TT |
1713 | dnl searches for libname and the libraries corresponding to explicit and |
1714 | dnl implicit dependencies, together with the specified include files and | |
93613951 TT |
1715 | dnl the ability to compile and link the specified testcode. The missing-message |
1716 | dnl defaults to 'no' and may contain additional hints for the user. | |
1717 | dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} | |
1718 | dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and | |
a04eba3f TT |
1719 | dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs |
1720 | dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. | |
93613951 TT |
1721 | dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname |
1722 | dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | |
a04eba3f TT |
1723 | AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], |
1724 | [ | |
1725 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) | |
1726 | AC_REQUIRE([AC_LIB_RPATH]) | |
93613951 TT |
1727 | pushdef([Name],[m4_translit([$1],[./+-], [____])]) |
1728 | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], | |
1729 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | |
a04eba3f TT |
1730 | |
1731 | dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME | |
1732 | dnl accordingly. | |
1733 | AC_LIB_LINKFLAGS_BODY([$1], [$2]) | |
1734 | ||
1735 | dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, | |
1736 | dnl because if the user has installed lib[]Name and not disabled its use | |
1737 | dnl via --without-lib[]Name-prefix, he wants to use it. | |
1738 | ac_save_CPPFLAGS="$CPPFLAGS" | |
1739 | AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) | |
1740 | ||
1741 | AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ | |
1742 | ac_save_LIBS="$LIBS" | |
93613951 TT |
1743 | dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, |
1744 | dnl because these -l options might require -L options that are present in | |
1745 | dnl LIBS. -l options benefit only from the -L options listed before it. | |
1746 | dnl Otherwise, add it to the front of LIBS, because it may be a static | |
1747 | dnl library that depends on another static library that is present in LIBS. | |
1748 | dnl Static libraries benefit only from the static libraries listed after | |
1749 | dnl it. | |
1750 | case " $LIB[]NAME" in | |
1751 | *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; | |
1752 | *) LIBS="$LIB[]NAME $LIBS" ;; | |
1753 | esac | |
1754 | AC_LINK_IFELSE( | |
1755 | [AC_LANG_PROGRAM([[$3]], [[$4]])], | |
1756 | [ac_cv_lib[]Name=yes], | |
1757 | [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) | |
a04eba3f TT |
1758 | LIBS="$ac_save_LIBS" |
1759 | ]) | |
1760 | if test "$ac_cv_lib[]Name" = yes; then | |
1761 | HAVE_LIB[]NAME=yes | |
93613951 | 1762 | AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) |
a04eba3f TT |
1763 | AC_MSG_CHECKING([how to link with lib[]$1]) |
1764 | AC_MSG_RESULT([$LIB[]NAME]) | |
1765 | else | |
1766 | HAVE_LIB[]NAME=no | |
1767 | dnl If $LIB[]NAME didn't lead to a usable library, we don't need | |
1768 | dnl $INC[]NAME either. | |
1769 | CPPFLAGS="$ac_save_CPPFLAGS" | |
1770 | LIB[]NAME= | |
1771 | LTLIB[]NAME= | |
93613951 | 1772 | LIB[]NAME[]_PREFIX= |
a04eba3f TT |
1773 | fi |
1774 | AC_SUBST([HAVE_LIB]NAME) | |
1775 | AC_SUBST([LIB]NAME) | |
1776 | AC_SUBST([LTLIB]NAME) | |
93613951 TT |
1777 | AC_SUBST([LIB]NAME[_PREFIX]) |
1778 | popdef([NAME]) | |
1779 | popdef([Name]) | |
a04eba3f TT |
1780 | ]) |
1781 | ||
1782 | dnl Determine the platform dependent parameters needed to use rpath: | |
93613951 TT |
1783 | dnl acl_libext, |
1784 | dnl acl_shlibext, | |
1785 | dnl acl_libname_spec, | |
1786 | dnl acl_library_names_spec, | |
1787 | dnl acl_hardcode_libdir_flag_spec, | |
1788 | dnl acl_hardcode_libdir_separator, | |
1789 | dnl acl_hardcode_direct, | |
1790 | dnl acl_hardcode_minus_L. | |
a04eba3f TT |
1791 | AC_DEFUN([AC_LIB_RPATH], |
1792 | [ | |
93613951 TT |
1793 | dnl Tell automake >= 1.10 to complain if config.rpath is missing. |
1794 | m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) | |
a04eba3f TT |
1795 | AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS |
1796 | AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld | |
1797 | AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host | |
1798 | AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir | |
93613951 | 1799 | AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ |
a04eba3f TT |
1800 | CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ |
1801 | ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh | |
1802 | . ./conftest.sh | |
1803 | rm -f ./conftest.sh | |
1804 | acl_cv_rpath=done | |
1805 | ]) | |
1806 | wl="$acl_cv_wl" | |
93613951 TT |
1807 | acl_libext="$acl_cv_libext" |
1808 | acl_shlibext="$acl_cv_shlibext" | |
1809 | acl_libname_spec="$acl_cv_libname_spec" | |
1810 | acl_library_names_spec="$acl_cv_library_names_spec" | |
1811 | acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" | |
1812 | acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" | |
1813 | acl_hardcode_direct="$acl_cv_hardcode_direct" | |
1814 | acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" | |
a04eba3f | 1815 | dnl Determine whether the user wants rpath handling at all. |
93613951 | 1816 | AC_ARG_ENABLE([rpath], |
a04eba3f TT |
1817 | [ --disable-rpath do not hardcode runtime library paths], |
1818 | :, enable_rpath=yes) | |
1819 | ]) | |
1820 | ||
93613951 TT |
1821 | dnl AC_LIB_FROMPACKAGE(name, package) |
1822 | dnl declares that libname comes from the given package. The configure file | |
1823 | dnl will then not have a --with-libname-prefix option but a | |
1824 | dnl --with-package-prefix option. Several libraries can come from the same | |
1825 | dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar | |
1826 | dnl macro call that searches for libname. | |
1827 | AC_DEFUN([AC_LIB_FROMPACKAGE], | |
1828 | [ | |
1829 | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], | |
1830 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | |
1831 | define([acl_frompackage_]NAME, [$2]) | |
1832 | popdef([NAME]) | |
1833 | pushdef([PACK],[$2]) | |
1834 | pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], | |
1835 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | |
1836 | define([acl_libsinpackage_]PACKUP, | |
1837 | m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) | |
1838 | popdef([PACKUP]) | |
1839 | popdef([PACK]) | |
1840 | ]) | |
1841 | ||
a04eba3f TT |
1842 | dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and |
1843 | dnl the libraries corresponding to explicit and implicit dependencies. | |
1844 | dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. | |
93613951 TT |
1845 | dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found |
1846 | dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. | |
a04eba3f TT |
1847 | AC_DEFUN([AC_LIB_LINKFLAGS_BODY], |
1848 | [ | |
93613951 TT |
1849 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) |
1850 | pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], | |
1851 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | |
1852 | pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) | |
1853 | pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], | |
1854 | [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) | |
1855 | pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) | |
1856 | dnl Autoconf >= 2.61 supports dots in --with options. | |
1857 | pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) | |
a04eba3f TT |
1858 | dnl By default, look in $includedir and $libdir. |
1859 | use_additional=yes | |
1860 | AC_LIB_WITH_FINAL_PREFIX([ | |
1861 | eval additional_includedir=\"$includedir\" | |
1862 | eval additional_libdir=\"$libdir\" | |
1863 | ]) | |
93613951 TT |
1864 | AC_ARG_WITH(P_A_C_K[-prefix], |
1865 | [[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib | |
1866 | --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], | |
a04eba3f TT |
1867 | [ |
1868 | if test "X$withval" = "Xno"; then | |
1869 | use_additional=no | |
1870 | else | |
1871 | if test "X$withval" = "X"; then | |
1872 | AC_LIB_WITH_FINAL_PREFIX([ | |
1873 | eval additional_includedir=\"$includedir\" | |
1874 | eval additional_libdir=\"$libdir\" | |
1875 | ]) | |
1876 | else | |
1877 | additional_includedir="$withval/include" | |
93613951 TT |
1878 | additional_libdir="$withval/$acl_libdirstem" |
1879 | if test "$acl_libdirstem2" != "$acl_libdirstem" \ | |
1880 | && ! test -d "$withval/$acl_libdirstem"; then | |
1881 | additional_libdir="$withval/$acl_libdirstem2" | |
1882 | fi | |
a04eba3f TT |
1883 | fi |
1884 | fi | |
1885 | ]) | |
1886 | dnl Search the library and its dependencies in $additional_libdir and | |
055866d8 | 1887 | dnl $LDFLAGS. Using breadth-first-search. |
a04eba3f TT |
1888 | LIB[]NAME= |
1889 | LTLIB[]NAME= | |
1890 | INC[]NAME= | |
93613951 TT |
1891 | LIB[]NAME[]_PREFIX= |
1892 | dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been | |
1893 | dnl computed. So it has to be reset here. | |
1894 | HAVE_LIB[]NAME= | |
a04eba3f TT |
1895 | rpathdirs= |
1896 | ltrpathdirs= | |
1897 | names_already_handled= | |
1898 | names_next_round='$1 $2' | |
1899 | while test -n "$names_next_round"; do | |
1900 | names_this_round="$names_next_round" | |
1901 | names_next_round= | |
1902 | for name in $names_this_round; do | |
1903 | already_handled= | |
1904 | for n in $names_already_handled; do | |
1905 | if test "$n" = "$name"; then | |
1906 | already_handled=yes | |
1907 | break | |
1908 | fi | |
1909 | done | |
1910 | if test -z "$already_handled"; then | |
1911 | names_already_handled="$names_already_handled $name" | |
1912 | dnl See if it was already located by an earlier AC_LIB_LINKFLAGS | |
1913 | dnl or AC_LIB_HAVE_LINKFLAGS call. | |
93613951 | 1914 | uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` |
a04eba3f TT |
1915 | eval value=\"\$HAVE_LIB$uppername\" |
1916 | if test -n "$value"; then | |
1917 | if test "$value" = yes; then | |
1918 | eval value=\"\$LIB$uppername\" | |
1919 | test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" | |
1920 | eval value=\"\$LTLIB$uppername\" | |
1921 | test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" | |
1922 | else | |
1923 | dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined | |
1924 | dnl that this library doesn't exist. So just drop it. | |
1925 | : | |
1926 | fi | |
1927 | else | |
1928 | dnl Search the library lib$name in $additional_libdir and $LDFLAGS | |
1929 | dnl and the already constructed $LIBNAME/$LTLIBNAME. | |
1930 | found_dir= | |
1931 | found_la= | |
1932 | found_so= | |
1933 | found_a= | |
93613951 TT |
1934 | eval libname=\"$acl_libname_spec\" # typically: libname=lib$name |
1935 | if test -n "$acl_shlibext"; then | |
1936 | shrext=".$acl_shlibext" # typically: shrext=.so | |
1937 | else | |
1938 | shrext= | |
1939 | fi | |
a04eba3f | 1940 | if test $use_additional = yes; then |
93613951 TT |
1941 | dir="$additional_libdir" |
1942 | dnl The same code as in the loop below: | |
1943 | dnl First look for a shared library. | |
1944 | if test -n "$acl_shlibext"; then | |
1945 | if test -f "$dir/$libname$shrext"; then | |
1946 | found_dir="$dir" | |
1947 | found_so="$dir/$libname$shrext" | |
1948 | else | |
1949 | if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then | |
1950 | ver=`(cd "$dir" && \ | |
1951 | for f in "$libname$shrext".*; do echo "$f"; done \ | |
1952 | | sed -e "s,^$libname$shrext\\\\.,," \ | |
1953 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | |
1954 | | sed 1q ) 2>/dev/null` | |
1955 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then | |
1956 | found_dir="$dir" | |
1957 | found_so="$dir/$libname$shrext.$ver" | |
1958 | fi | |
1959 | else | |
1960 | eval library_names=\"$acl_library_names_spec\" | |
1961 | for f in $library_names; do | |
1962 | if test -f "$dir/$f"; then | |
1963 | found_dir="$dir" | |
1964 | found_so="$dir/$f" | |
1965 | break | |
1966 | fi | |
1967 | done | |
a04eba3f TT |
1968 | fi |
1969 | fi | |
1970 | fi | |
93613951 TT |
1971 | dnl Then look for a static library. |
1972 | if test "X$found_dir" = "X"; then | |
1973 | if test -f "$dir/$libname.$acl_libext"; then | |
1974 | found_dir="$dir" | |
1975 | found_a="$dir/$libname.$acl_libext" | |
1976 | fi | |
1977 | fi | |
1978 | if test "X$found_dir" != "X"; then | |
1979 | if test -f "$dir/$libname.la"; then | |
1980 | found_la="$dir/$libname.la" | |
1981 | fi | |
1982 | fi | |
a04eba3f TT |
1983 | fi |
1984 | if test "X$found_dir" = "X"; then | |
1985 | for x in $LDFLAGS $LTLIB[]NAME; do | |
1986 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
1987 | case "$x" in | |
1988 | -L*) | |
1989 | dir=`echo "X$x" | sed -e 's/^X-L//'` | |
93613951 TT |
1990 | dnl First look for a shared library. |
1991 | if test -n "$acl_shlibext"; then | |
1992 | if test -f "$dir/$libname$shrext"; then | |
a04eba3f | 1993 | found_dir="$dir" |
93613951 TT |
1994 | found_so="$dir/$libname$shrext" |
1995 | else | |
1996 | if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then | |
1997 | ver=`(cd "$dir" && \ | |
1998 | for f in "$libname$shrext".*; do echo "$f"; done \ | |
1999 | | sed -e "s,^$libname$shrext\\\\.,," \ | |
2000 | | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | |
2001 | | sed 1q ) 2>/dev/null` | |
2002 | if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then | |
2003 | found_dir="$dir" | |
2004 | found_so="$dir/$libname$shrext.$ver" | |
2005 | fi | |
2006 | else | |
2007 | eval library_names=\"$acl_library_names_spec\" | |
2008 | for f in $library_names; do | |
2009 | if test -f "$dir/$f"; then | |
2010 | found_dir="$dir" | |
2011 | found_so="$dir/$f" | |
2012 | break | |
2013 | fi | |
2014 | done | |
a04eba3f TT |
2015 | fi |
2016 | fi | |
2017 | fi | |
93613951 TT |
2018 | dnl Then look for a static library. |
2019 | if test "X$found_dir" = "X"; then | |
2020 | if test -f "$dir/$libname.$acl_libext"; then | |
2021 | found_dir="$dir" | |
2022 | found_a="$dir/$libname.$acl_libext" | |
2023 | fi | |
2024 | fi | |
2025 | if test "X$found_dir" != "X"; then | |
2026 | if test -f "$dir/$libname.la"; then | |
2027 | found_la="$dir/$libname.la" | |
2028 | fi | |
2029 | fi | |
a04eba3f TT |
2030 | ;; |
2031 | esac | |
2032 | if test "X$found_dir" != "X"; then | |
2033 | break | |
2034 | fi | |
2035 | done | |
2036 | fi | |
2037 | if test "X$found_dir" != "X"; then | |
2038 | dnl Found the library. | |
2039 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" | |
2040 | if test "X$found_so" != "X"; then | |
2041 | dnl Linking with a shared library. We attempt to hardcode its | |
2042 | dnl directory into the executable's runpath, unless it's the | |
2043 | dnl standard /usr/lib. | |
93613951 TT |
2044 | if test "$enable_rpath" = no \ |
2045 | || test "X$found_dir" = "X/usr/$acl_libdirstem" \ | |
2046 | || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then | |
a04eba3f TT |
2047 | dnl No hardcoding is needed. |
2048 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | |
2049 | else | |
2050 | dnl Use an explicit option to hardcode DIR into the resulting | |
2051 | dnl binary. | |
2052 | dnl Potentially add DIR to ltrpathdirs. | |
2053 | dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. | |
2054 | haveit= | |
2055 | for x in $ltrpathdirs; do | |
2056 | if test "X$x" = "X$found_dir"; then | |
2057 | haveit=yes | |
2058 | break | |
2059 | fi | |
2060 | done | |
2061 | if test -z "$haveit"; then | |
2062 | ltrpathdirs="$ltrpathdirs $found_dir" | |
2063 | fi | |
2064 | dnl The hardcoding into $LIBNAME is system dependent. | |
93613951 | 2065 | if test "$acl_hardcode_direct" = yes; then |
a04eba3f TT |
2066 | dnl Using DIR/libNAME.so during linking hardcodes DIR into the |
2067 | dnl resulting binary. | |
2068 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | |
2069 | else | |
93613951 | 2070 | if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then |
a04eba3f TT |
2071 | dnl Use an explicit option to hardcode DIR into the resulting |
2072 | dnl binary. | |
2073 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | |
2074 | dnl Potentially add DIR to rpathdirs. | |
2075 | dnl The rpathdirs will be appended to $LIBNAME at the end. | |
2076 | haveit= | |
2077 | for x in $rpathdirs; do | |
2078 | if test "X$x" = "X$found_dir"; then | |
2079 | haveit=yes | |
2080 | break | |
2081 | fi | |
2082 | done | |
2083 | if test -z "$haveit"; then | |
2084 | rpathdirs="$rpathdirs $found_dir" | |
2085 | fi | |
2086 | else | |
2087 | dnl Rely on "-L$found_dir". | |
2088 | dnl But don't add it if it's already contained in the LDFLAGS | |
2089 | dnl or the already constructed $LIBNAME | |
2090 | haveit= | |
2091 | for x in $LDFLAGS $LIB[]NAME; do | |
2092 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2093 | if test "X$x" = "X-L$found_dir"; then | |
2094 | haveit=yes | |
2095 | break | |
2096 | fi | |
2097 | done | |
2098 | if test -z "$haveit"; then | |
2099 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" | |
2100 | fi | |
93613951 | 2101 | if test "$acl_hardcode_minus_L" != no; then |
a04eba3f TT |
2102 | dnl FIXME: Not sure whether we should use |
2103 | dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" | |
2104 | dnl here. | |
2105 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" | |
2106 | else | |
93613951 | 2107 | dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH |
a04eba3f TT |
2108 | dnl here, because this doesn't fit in flags passed to the |
2109 | dnl compiler. So give up. No hardcoding. This affects only | |
2110 | dnl very old systems. | |
2111 | dnl FIXME: Not sure whether we should use | |
2112 | dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" | |
2113 | dnl here. | |
2114 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" | |
2115 | fi | |
2116 | fi | |
2117 | fi | |
2118 | fi | |
2119 | else | |
2120 | if test "X$found_a" != "X"; then | |
2121 | dnl Linking with a static library. | |
2122 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" | |
2123 | else | |
2124 | dnl We shouldn't come here, but anyway it's good to have a | |
2125 | dnl fallback. | |
2126 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" | |
2127 | fi | |
2128 | fi | |
2129 | dnl Assume the include files are nearby. | |
2130 | additional_includedir= | |
2131 | case "$found_dir" in | |
93613951 TT |
2132 | */$acl_libdirstem | */$acl_libdirstem/) |
2133 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` | |
2134 | if test "$name" = '$1'; then | |
2135 | LIB[]NAME[]_PREFIX="$basedir" | |
2136 | fi | |
2137 | additional_includedir="$basedir/include" | |
2138 | ;; | |
2139 | */$acl_libdirstem2 | */$acl_libdirstem2/) | |
2140 | basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` | |
2141 | if test "$name" = '$1'; then | |
2142 | LIB[]NAME[]_PREFIX="$basedir" | |
2143 | fi | |
a04eba3f TT |
2144 | additional_includedir="$basedir/include" |
2145 | ;; | |
2146 | esac | |
2147 | if test "X$additional_includedir" != "X"; then | |
2148 | dnl Potentially add $additional_includedir to $INCNAME. | |
2149 | dnl But don't add it | |
2150 | dnl 1. if it's the standard /usr/include, | |
2151 | dnl 2. if it's /usr/local/include and we are using GCC on Linux, | |
2152 | dnl 3. if it's already present in $CPPFLAGS or the already | |
2153 | dnl constructed $INCNAME, | |
2154 | dnl 4. if it doesn't exist as a directory. | |
2155 | if test "X$additional_includedir" != "X/usr/include"; then | |
2156 | haveit= | |
2157 | if test "X$additional_includedir" = "X/usr/local/include"; then | |
2158 | if test -n "$GCC"; then | |
2159 | case $host_os in | |
93613951 | 2160 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
a04eba3f TT |
2161 | esac |
2162 | fi | |
2163 | fi | |
2164 | if test -z "$haveit"; then | |
2165 | for x in $CPPFLAGS $INC[]NAME; do | |
2166 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2167 | if test "X$x" = "X-I$additional_includedir"; then | |
2168 | haveit=yes | |
2169 | break | |
2170 | fi | |
2171 | done | |
2172 | if test -z "$haveit"; then | |
2173 | if test -d "$additional_includedir"; then | |
2174 | dnl Really add $additional_includedir to $INCNAME. | |
2175 | INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" | |
2176 | fi | |
2177 | fi | |
2178 | fi | |
2179 | fi | |
2180 | fi | |
2181 | dnl Look for dependencies. | |
2182 | if test -n "$found_la"; then | |
2183 | dnl Read the .la file. It defines the variables | |
2184 | dnl dlname, library_names, old_library, dependency_libs, current, | |
2185 | dnl age, revision, installed, dlopen, dlpreopen, libdir. | |
2186 | save_libdir="$libdir" | |
2187 | case "$found_la" in | |
2188 | */* | *\\*) . "$found_la" ;; | |
2189 | *) . "./$found_la" ;; | |
2190 | esac | |
2191 | libdir="$save_libdir" | |
2192 | dnl We use only dependency_libs. | |
2193 | for dep in $dependency_libs; do | |
2194 | case "$dep" in | |
2195 | -L*) | |
2196 | additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` | |
2197 | dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. | |
2198 | dnl But don't add it | |
2199 | dnl 1. if it's the standard /usr/lib, | |
2200 | dnl 2. if it's /usr/local/lib and we are using GCC on Linux, | |
2201 | dnl 3. if it's already present in $LDFLAGS or the already | |
2202 | dnl constructed $LIBNAME, | |
2203 | dnl 4. if it doesn't exist as a directory. | |
93613951 TT |
2204 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ |
2205 | && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then | |
a04eba3f | 2206 | haveit= |
93613951 TT |
2207 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ |
2208 | || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then | |
a04eba3f TT |
2209 | if test -n "$GCC"; then |
2210 | case $host_os in | |
93613951 | 2211 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
a04eba3f TT |
2212 | esac |
2213 | fi | |
2214 | fi | |
2215 | if test -z "$haveit"; then | |
2216 | haveit= | |
2217 | for x in $LDFLAGS $LIB[]NAME; do | |
2218 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2219 | if test "X$x" = "X-L$additional_libdir"; then | |
2220 | haveit=yes | |
2221 | break | |
2222 | fi | |
2223 | done | |
2224 | if test -z "$haveit"; then | |
2225 | if test -d "$additional_libdir"; then | |
2226 | dnl Really add $additional_libdir to $LIBNAME. | |
2227 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" | |
2228 | fi | |
2229 | fi | |
2230 | haveit= | |
2231 | for x in $LDFLAGS $LTLIB[]NAME; do | |
2232 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2233 | if test "X$x" = "X-L$additional_libdir"; then | |
2234 | haveit=yes | |
2235 | break | |
2236 | fi | |
2237 | done | |
2238 | if test -z "$haveit"; then | |
2239 | if test -d "$additional_libdir"; then | |
2240 | dnl Really add $additional_libdir to $LTLIBNAME. | |
2241 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" | |
2242 | fi | |
2243 | fi | |
2244 | fi | |
2245 | fi | |
2246 | ;; | |
2247 | -R*) | |
2248 | dir=`echo "X$dep" | sed -e 's/^X-R//'` | |
2249 | if test "$enable_rpath" != no; then | |
2250 | dnl Potentially add DIR to rpathdirs. | |
2251 | dnl The rpathdirs will be appended to $LIBNAME at the end. | |
2252 | haveit= | |
2253 | for x in $rpathdirs; do | |
2254 | if test "X$x" = "X$dir"; then | |
2255 | haveit=yes | |
2256 | break | |
2257 | fi | |
2258 | done | |
2259 | if test -z "$haveit"; then | |
2260 | rpathdirs="$rpathdirs $dir" | |
2261 | fi | |
2262 | dnl Potentially add DIR to ltrpathdirs. | |
2263 | dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. | |
2264 | haveit= | |
2265 | for x in $ltrpathdirs; do | |
2266 | if test "X$x" = "X$dir"; then | |
2267 | haveit=yes | |
2268 | break | |
2269 | fi | |
2270 | done | |
2271 | if test -z "$haveit"; then | |
2272 | ltrpathdirs="$ltrpathdirs $dir" | |
2273 | fi | |
2274 | fi | |
2275 | ;; | |
2276 | -l*) | |
2277 | dnl Handle this in the next round. | |
2278 | names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` | |
2279 | ;; | |
2280 | *.la) | |
2281 | dnl Handle this in the next round. Throw away the .la's | |
2282 | dnl directory; it is already contained in a preceding -L | |
2283 | dnl option. | |
2284 | names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` | |
2285 | ;; | |
2286 | *) | |
2287 | dnl Most likely an immediate library name. | |
2288 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" | |
2289 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" | |
2290 | ;; | |
2291 | esac | |
2292 | done | |
2293 | fi | |
2294 | else | |
2295 | dnl Didn't find the library; assume it is in the system directories | |
2296 | dnl known to the linker and runtime loader. (All the system | |
2297 | dnl directories known to the linker should also be known to the | |
2298 | dnl runtime loader, otherwise the system is severely misconfigured.) | |
2299 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" | |
2300 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" | |
2301 | fi | |
2302 | fi | |
2303 | fi | |
2304 | done | |
2305 | done | |
2306 | if test "X$rpathdirs" != "X"; then | |
93613951 | 2307 | if test -n "$acl_hardcode_libdir_separator"; then |
a04eba3f TT |
2308 | dnl Weird platform: only the last -rpath option counts, the user must |
2309 | dnl pass all path elements in one option. We can arrange that for a | |
2310 | dnl single library, but not when more than one $LIBNAMEs are used. | |
2311 | alldirs= | |
2312 | for found_dir in $rpathdirs; do | |
93613951 | 2313 | alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" |
a04eba3f | 2314 | done |
93613951 | 2315 | dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. |
a04eba3f TT |
2316 | acl_save_libdir="$libdir" |
2317 | libdir="$alldirs" | |
93613951 | 2318 | eval flag=\"$acl_hardcode_libdir_flag_spec\" |
a04eba3f TT |
2319 | libdir="$acl_save_libdir" |
2320 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" | |
2321 | else | |
2322 | dnl The -rpath options are cumulative. | |
2323 | for found_dir in $rpathdirs; do | |
2324 | acl_save_libdir="$libdir" | |
2325 | libdir="$found_dir" | |
93613951 | 2326 | eval flag=\"$acl_hardcode_libdir_flag_spec\" |
a04eba3f TT |
2327 | libdir="$acl_save_libdir" |
2328 | LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" | |
2329 | done | |
2330 | fi | |
2331 | fi | |
2332 | if test "X$ltrpathdirs" != "X"; then | |
2333 | dnl When using libtool, the option that works for both libraries and | |
2334 | dnl executables is -R. The -R options are cumulative. | |
2335 | for found_dir in $ltrpathdirs; do | |
2336 | LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" | |
2337 | done | |
2338 | fi | |
93613951 TT |
2339 | popdef([P_A_C_K]) |
2340 | popdef([PACKLIBS]) | |
2341 | popdef([PACKUP]) | |
2342 | popdef([PACK]) | |
2343 | popdef([NAME]) | |
a04eba3f TT |
2344 | ]) |
2345 | ||
2346 | dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, | |
2347 | dnl unless already present in VAR. | |
2348 | dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes | |
2349 | dnl contains two or three consecutive elements that belong together. | |
2350 | AC_DEFUN([AC_LIB_APPENDTOVAR], | |
2351 | [ | |
2352 | for element in [$2]; do | |
2353 | haveit= | |
2354 | for x in $[$1]; do | |
2355 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2356 | if test "X$x" = "X$element"; then | |
2357 | haveit=yes | |
2358 | break | |
2359 | fi | |
2360 | done | |
2361 | if test -z "$haveit"; then | |
2362 | [$1]="${[$1]}${[$1]:+ }$element" | |
2363 | fi | |
2364 | done | |
2365 | ]) | |
93613951 TT |
2366 | |
2367 | dnl For those cases where a variable contains several -L and -l options | |
2368 | dnl referring to unknown libraries and directories, this macro determines the | |
2369 | dnl necessary additional linker options for the runtime path. | |
2370 | dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) | |
2371 | dnl sets LDADDVAR to linker options needed together with LIBSVALUE. | |
2372 | dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, | |
2373 | dnl otherwise linking without libtool is assumed. | |
2374 | AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], | |
2375 | [ | |
2376 | AC_REQUIRE([AC_LIB_RPATH]) | |
2377 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) | |
2378 | $1= | |
2379 | if test "$enable_rpath" != no; then | |
2380 | if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then | |
2381 | dnl Use an explicit option to hardcode directories into the resulting | |
2382 | dnl binary. | |
2383 | rpathdirs= | |
2384 | next= | |
2385 | for opt in $2; do | |
2386 | if test -n "$next"; then | |
2387 | dir="$next" | |
2388 | dnl No need to hardcode the standard /usr/lib. | |
2389 | if test "X$dir" != "X/usr/$acl_libdirstem" \ | |
2390 | && test "X$dir" != "X/usr/$acl_libdirstem2"; then | |
2391 | rpathdirs="$rpathdirs $dir" | |
2392 | fi | |
2393 | next= | |
2394 | else | |
2395 | case $opt in | |
2396 | -L) next=yes ;; | |
2397 | -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` | |
2398 | dnl No need to hardcode the standard /usr/lib. | |
2399 | if test "X$dir" != "X/usr/$acl_libdirstem" \ | |
2400 | && test "X$dir" != "X/usr/$acl_libdirstem2"; then | |
2401 | rpathdirs="$rpathdirs $dir" | |
2402 | fi | |
2403 | next= ;; | |
2404 | *) next= ;; | |
2405 | esac | |
2406 | fi | |
2407 | done | |
2408 | if test "X$rpathdirs" != "X"; then | |
2409 | if test -n ""$3""; then | |
2410 | dnl libtool is used for linking. Use -R options. | |
2411 | for dir in $rpathdirs; do | |
2412 | $1="${$1}${$1:+ }-R$dir" | |
2413 | done | |
2414 | else | |
2415 | dnl The linker is used for linking directly. | |
2416 | if test -n "$acl_hardcode_libdir_separator"; then | |
2417 | dnl Weird platform: only the last -rpath option counts, the user | |
2418 | dnl must pass all path elements in one option. | |
2419 | alldirs= | |
2420 | for dir in $rpathdirs; do | |
2421 | alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" | |
2422 | done | |
2423 | acl_save_libdir="$libdir" | |
2424 | libdir="$alldirs" | |
2425 | eval flag=\"$acl_hardcode_libdir_flag_spec\" | |
2426 | libdir="$acl_save_libdir" | |
2427 | $1="$flag" | |
2428 | else | |
2429 | dnl The -rpath options are cumulative. | |
2430 | for dir in $rpathdirs; do | |
2431 | acl_save_libdir="$libdir" | |
2432 | libdir="$dir" | |
2433 | eval flag=\"$acl_hardcode_libdir_flag_spec\" | |
2434 | libdir="$acl_save_libdir" | |
2435 | $1="${$1}${$1:+ }$flag" | |
2436 | done | |
2437 | fi | |
2438 | fi | |
2439 | fi | |
2440 | fi | |
2441 | fi | |
2442 | AC_SUBST([$1]) | |
2443 | ]) | |
2444 | ||
2445 | # lib-prefix.m4 serial 7 (gettext-0.18) | |
2446 | dnl Copyright (C) 2001-2005, 2008-2013 Free Software Foundation, Inc. | |
2447 | dnl This file is free software; the Free Software Foundation | |
2448 | dnl gives unlimited permission to copy and/or distribute it, | |
2449 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
2450 | |
2451 | dnl From Bruno Haible. | |
2452 | ||
b0cacab0 TT |
2453 | dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and |
2454 | dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't | |
2455 | dnl require excessive bracketing. | |
2456 | ifdef([AC_HELP_STRING], | |
2457 | [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], | |
2458 | [AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) | |
2459 | ||
a04eba3f TT |
2460 | dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed |
2461 | dnl to access previously installed libraries. The basic assumption is that | |
2462 | dnl a user will want packages to use other packages he previously installed | |
2463 | dnl with the same --prefix option. | |
2464 | dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate | |
2465 | dnl libraries, but is otherwise very convenient. | |
2466 | AC_DEFUN([AC_LIB_PREFIX], | |
2467 | [ | |
2468 | AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) | |
2469 | AC_REQUIRE([AC_PROG_CC]) | |
2470 | AC_REQUIRE([AC_CANONICAL_HOST]) | |
93613951 | 2471 | AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) |
a04eba3f TT |
2472 | AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) |
2473 | dnl By default, look in $includedir and $libdir. | |
2474 | use_additional=yes | |
2475 | AC_LIB_WITH_FINAL_PREFIX([ | |
2476 | eval additional_includedir=\"$includedir\" | |
2477 | eval additional_libdir=\"$libdir\" | |
2478 | ]) | |
b0cacab0 | 2479 | AC_LIB_ARG_WITH([lib-prefix], |
a04eba3f TT |
2480 | [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib |
2481 | --without-lib-prefix don't search for libraries in includedir and libdir], | |
2482 | [ | |
2483 | if test "X$withval" = "Xno"; then | |
2484 | use_additional=no | |
2485 | else | |
2486 | if test "X$withval" = "X"; then | |
2487 | AC_LIB_WITH_FINAL_PREFIX([ | |
2488 | eval additional_includedir=\"$includedir\" | |
2489 | eval additional_libdir=\"$libdir\" | |
2490 | ]) | |
2491 | else | |
2492 | additional_includedir="$withval/include" | |
93613951 | 2493 | additional_libdir="$withval/$acl_libdirstem" |
a04eba3f TT |
2494 | fi |
2495 | fi | |
2496 | ]) | |
2497 | if test $use_additional = yes; then | |
2498 | dnl Potentially add $additional_includedir to $CPPFLAGS. | |
2499 | dnl But don't add it | |
2500 | dnl 1. if it's the standard /usr/include, | |
2501 | dnl 2. if it's already present in $CPPFLAGS, | |
2502 | dnl 3. if it's /usr/local/include and we are using GCC on Linux, | |
2503 | dnl 4. if it doesn't exist as a directory. | |
2504 | if test "X$additional_includedir" != "X/usr/include"; then | |
2505 | haveit= | |
2506 | for x in $CPPFLAGS; do | |
2507 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2508 | if test "X$x" = "X-I$additional_includedir"; then | |
2509 | haveit=yes | |
2510 | break | |
2511 | fi | |
2512 | done | |
2513 | if test -z "$haveit"; then | |
2514 | if test "X$additional_includedir" = "X/usr/local/include"; then | |
2515 | if test -n "$GCC"; then | |
2516 | case $host_os in | |
93613951 | 2517 | linux* | gnu* | k*bsd*-gnu) haveit=yes;; |
a04eba3f TT |
2518 | esac |
2519 | fi | |
2520 | fi | |
2521 | if test -z "$haveit"; then | |
2522 | if test -d "$additional_includedir"; then | |
2523 | dnl Really add $additional_includedir to $CPPFLAGS. | |
2524 | CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" | |
2525 | fi | |
2526 | fi | |
2527 | fi | |
2528 | fi | |
2529 | dnl Potentially add $additional_libdir to $LDFLAGS. | |
2530 | dnl But don't add it | |
2531 | dnl 1. if it's the standard /usr/lib, | |
2532 | dnl 2. if it's already present in $LDFLAGS, | |
2533 | dnl 3. if it's /usr/local/lib and we are using GCC on Linux, | |
2534 | dnl 4. if it doesn't exist as a directory. | |
93613951 | 2535 | if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then |
a04eba3f TT |
2536 | haveit= |
2537 | for x in $LDFLAGS; do | |
2538 | AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) | |
2539 | if test "X$x" = "X-L$additional_libdir"; then | |
2540 | haveit=yes | |
2541 | break | |
2542 | fi | |
2543 | done | |
2544 | if test -z "$haveit"; then | |
93613951 | 2545 | if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then |
a04eba3f TT |
2546 | if test -n "$GCC"; then |
2547 | case $host_os in | |
2548 | linux*) haveit=yes;; | |
2549 | esac | |
2550 | fi | |
2551 | fi | |
2552 | if test -z "$haveit"; then | |
2553 | if test -d "$additional_libdir"; then | |
2554 | dnl Really add $additional_libdir to $LDFLAGS. | |
2555 | LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" | |
2556 | fi | |
2557 | fi | |
2558 | fi | |
2559 | fi | |
2560 | fi | |
2561 | ]) | |
a64c9c13 | 2562 | |
a04eba3f TT |
2563 | dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, |
2564 | dnl acl_final_exec_prefix, containing the values to which $prefix and | |
2565 | dnl $exec_prefix will expand at the end of the configure script. | |
2566 | AC_DEFUN([AC_LIB_PREPARE_PREFIX], | |
2567 | [ | |
2568 | dnl Unfortunately, prefix and exec_prefix get only finally determined | |
2569 | dnl at the end of configure. | |
2570 | if test "X$prefix" = "XNONE"; then | |
2571 | acl_final_prefix="$ac_default_prefix" | |
2572 | else | |
2573 | acl_final_prefix="$prefix" | |
2574 | fi | |
2575 | if test "X$exec_prefix" = "XNONE"; then | |
2576 | acl_final_exec_prefix='${prefix}' | |
2577 | else | |
2578 | acl_final_exec_prefix="$exec_prefix" | |
2579 | fi | |
2580 | acl_save_prefix="$prefix" | |
2581 | prefix="$acl_final_prefix" | |
2582 | eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" | |
2583 | prefix="$acl_save_prefix" | |
2584 | ]) | |
2585 | ||
2586 | dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the | |
2587 | dnl variables prefix and exec_prefix bound to the values they will have | |
2588 | dnl at the end of the configure script. | |
2589 | AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], | |
2590 | [ | |
2591 | acl_save_prefix="$prefix" | |
2592 | prefix="$acl_final_prefix" | |
2593 | acl_save_exec_prefix="$exec_prefix" | |
2594 | exec_prefix="$acl_final_exec_prefix" | |
2595 | $1 | |
2596 | exec_prefix="$acl_save_exec_prefix" | |
2597 | prefix="$acl_save_prefix" | |
2598 | ]) | |
93613951 TT |
2599 | |
2600 | dnl AC_LIB_PREPARE_MULTILIB creates | |
2601 | dnl - a variable acl_libdirstem, containing the basename of the libdir, either | |
2602 | dnl "lib" or "lib64" or "lib/64", | |
2603 | dnl - a variable acl_libdirstem2, as a secondary possible value for | |
2604 | dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or | |
2605 | dnl "lib/amd64". | |
2606 | AC_DEFUN([AC_LIB_PREPARE_MULTILIB], | |
2607 | [ | |
2608 | dnl There is no formal standard regarding lib and lib64. | |
2609 | dnl On glibc systems, the current practice is that on a system supporting | |
2610 | dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under | |
2611 | dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine | |
2612 | dnl the compiler's default mode by looking at the compiler's library search | |
2613 | dnl path. If at least one of its elements ends in /lib64 or points to a | |
2614 | dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. | |
2615 | dnl Otherwise we use the default, namely "lib". | |
2616 | dnl On Solaris systems, the current practice is that on a system supporting | |
2617 | dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under | |
2618 | dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or | |
2619 | dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. | |
2620 | AC_REQUIRE([AC_CANONICAL_HOST]) | |
2621 | acl_libdirstem=lib | |
2622 | acl_libdirstem2= | |
2623 | case "$host_os" in | |
2624 | solaris*) | |
2625 | dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment | |
2626 | dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>. | |
2627 | dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." | |
2628 | dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the | |
2629 | dnl symlink is missing, so we set acl_libdirstem2 too. | |
2630 | AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], | |
2631 | [AC_EGREP_CPP([sixtyfour bits], [ | |
2632 | #ifdef _LP64 | |
2633 | sixtyfour bits | |
2634 | #endif | |
2635 | ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) | |
2636 | ]) | |
2637 | if test $gl_cv_solaris_64bit = yes; then | |
2638 | acl_libdirstem=lib/64 | |
2639 | case "$host_cpu" in | |
2640 | sparc*) acl_libdirstem2=lib/sparcv9 ;; | |
2641 | i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; | |
2642 | esac | |
2643 | fi | |
2644 | ;; | |
2645 | *) | |
2646 | searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` | |
2647 | if test -n "$searchpath"; then | |
2648 | acl_save_IFS="${IFS= }"; IFS=":" | |
2649 | for searchdir in $searchpath; do | |
2650 | if test -d "$searchdir"; then | |
2651 | case "$searchdir" in | |
2652 | */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; | |
2653 | */../ | */.. ) | |
2654 | # Better ignore directories of this form. They are misleading. | |
2655 | ;; | |
2656 | *) searchdir=`cd "$searchdir" && pwd` | |
2657 | case "$searchdir" in | |
2658 | */lib64 ) acl_libdirstem=lib64 ;; | |
2659 | esac ;; | |
2660 | esac | |
2661 | fi | |
2662 | done | |
2663 | IFS="$acl_save_IFS" | |
2664 | fi | |
2665 | ;; | |
2666 | esac | |
2667 | test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" | |
2668 | ]) | |
2669 | ||
2670 | # lock.m4 serial 13 (gettext-0.18.2) | |
2671 | dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. | |
2672 | dnl This file is free software; the Free Software Foundation | |
2673 | dnl gives unlimited permission to copy and/or distribute it, | |
2674 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
2675 | |
2676 | dnl From Bruno Haible. | |
b0cacab0 | 2677 | |
93613951 | 2678 | AC_DEFUN([gl_LOCK], |
b0cacab0 | 2679 | [ |
93613951 TT |
2680 | AC_REQUIRE([gl_THREADLIB]) |
2681 | if test "$gl_threads_api" = posix; then | |
2682 | # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the | |
2683 | # pthread_rwlock_* functions. | |
2684 | AC_CHECK_TYPE([pthread_rwlock_t], | |
2685 | [AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], | |
2686 | [Define if the POSIX multithreading library has read/write locks.])], | |
2687 | [], | |
2688 | [#include <pthread.h>]) | |
2689 | # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. | |
2690 | AC_COMPILE_IFELSE([ | |
2691 | AC_LANG_PROGRAM( | |
2692 | [[#include <pthread.h>]], | |
2693 | [[ | |
2694 | #if __FreeBSD__ == 4 | |
2695 | error "No, in FreeBSD 4.0 recursive mutexes actually don't work." | |
2696 | #elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ | |
2697 | && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) | |
2698 | error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." | |
2699 | #else | |
2700 | int x = (int)PTHREAD_MUTEX_RECURSIVE; | |
2701 | return !x; | |
2702 | #endif | |
2703 | ]])], | |
2704 | [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], | |
2705 | [Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE.])]) | |
b0cacab0 | 2706 | fi |
93613951 | 2707 | gl_PREREQ_LOCK |
b0cacab0 | 2708 | ]) |
93613951 TT |
2709 | |
2710 | # Prerequisites of lib/glthread/lock.c. | |
2711 | AC_DEFUN([gl_PREREQ_LOCK], [:]) | |
2712 | ||
2713 | # longlong.m4 serial 17 | |
2714 | dnl Copyright (C) 1999-2007, 2009-2013 Free Software Foundation, Inc. | |
2715 | dnl This file is free software; the Free Software Foundation | |
2716 | dnl gives unlimited permission to copy and/or distribute it, | |
2717 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
2718 | |
2719 | dnl From Paul Eggert. | |
2720 | ||
93613951 TT |
2721 | # Define HAVE_LONG_LONG_INT if 'long long int' works. |
2722 | # This fixes a bug in Autoconf 2.61, and can be faster | |
2723 | # than what's in Autoconf 2.62 through 2.68. | |
2724 | ||
2725 | # Note: If the type 'long long int' exists but is only 32 bits large | |
2726 | # (as on some very old compilers), HAVE_LONG_LONG_INT will not be | |
2727 | # defined. In this case you can treat 'long long int' like 'long int'. | |
2728 | ||
2729 | AC_DEFUN([AC_TYPE_LONG_LONG_INT], | |
2730 | [ | |
2731 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | |
2732 | AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], | |
2733 | [ac_cv_type_long_long_int=yes | |
2734 | if test "x${ac_cv_prog_cc_c99-no}" = xno; then | |
2735 | ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int | |
2736 | if test $ac_cv_type_long_long_int = yes; then | |
2737 | dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. | |
2738 | dnl If cross compiling, assume the bug is not important, since | |
2739 | dnl nobody cross compiles for this platform as far as we know. | |
2740 | AC_RUN_IFELSE( | |
2741 | [AC_LANG_PROGRAM( | |
2742 | [[@%:@include <limits.h> | |
2743 | @%:@ifndef LLONG_MAX | |
2744 | @%:@ define HALF \ | |
2745 | (1LL << (sizeof (long long int) * CHAR_BIT - 2)) | |
2746 | @%:@ define LLONG_MAX (HALF - 1 + HALF) | |
2747 | @%:@endif]], | |
2748 | [[long long int n = 1; | |
2749 | int i; | |
2750 | for (i = 0; ; i++) | |
2751 | { | |
2752 | long long int m = n << i; | |
2753 | if (m >> i != n) | |
2754 | return 1; | |
2755 | if (LLONG_MAX / 2 < m) | |
2756 | break; | |
2757 | } | |
2758 | return 0;]])], | |
2759 | [], | |
2760 | [ac_cv_type_long_long_int=no], | |
2761 | [:]) | |
2762 | fi | |
2763 | fi]) | |
2764 | if test $ac_cv_type_long_long_int = yes; then | |
2765 | AC_DEFINE([HAVE_LONG_LONG_INT], [1], | |
2766 | [Define to 1 if the system has the type 'long long int'.]) | |
2767 | fi | |
2768 | ]) | |
2769 | ||
2770 | # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. | |
2771 | # This fixes a bug in Autoconf 2.61, and can be faster | |
2772 | # than what's in Autoconf 2.62 through 2.68. | |
b0cacab0 | 2773 | |
93613951 TT |
2774 | # Note: If the type 'unsigned long long int' exists but is only 32 bits |
2775 | # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT | |
2776 | # will not be defined. In this case you can treat 'unsigned long long int' | |
2777 | # like 'unsigned long int'. | |
2778 | ||
2779 | AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], | |
b0cacab0 | 2780 | [ |
93613951 TT |
2781 | AC_CACHE_CHECK([for unsigned long long int], |
2782 | [ac_cv_type_unsigned_long_long_int], | |
2783 | [ac_cv_type_unsigned_long_long_int=yes | |
2784 | if test "x${ac_cv_prog_cc_c99-no}" = xno; then | |
2785 | AC_LINK_IFELSE( | |
2786 | [_AC_TYPE_LONG_LONG_SNIPPET], | |
2787 | [], | |
2788 | [ac_cv_type_unsigned_long_long_int=no]) | |
2789 | fi]) | |
2790 | if test $ac_cv_type_unsigned_long_long_int = yes; then | |
2791 | AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], | |
2792 | [Define to 1 if the system has the type 'unsigned long long int'.]) | |
b0cacab0 TT |
2793 | fi |
2794 | ]) | |
93613951 TT |
2795 | |
2796 | # Expands to a C program that can be used to test for simultaneous support | |
2797 | # of 'long long' and 'unsigned long long'. We don't want to say that | |
2798 | # 'long long' is available if 'unsigned long long' is not, or vice versa, | |
2799 | # because too many programs rely on the symmetry between signed and unsigned | |
2800 | # integer types (excluding 'bool'). | |
2801 | AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], | |
2802 | [ | |
2803 | AC_LANG_PROGRAM( | |
2804 | [[/* For now, do not test the preprocessor; as of 2007 there are too many | |
2805 | implementations with broken preprocessors. Perhaps this can | |
2806 | be revisited in 2012. In the meantime, code should not expect | |
2807 | #if to work with literals wider than 32 bits. */ | |
2808 | /* Test literals. */ | |
2809 | long long int ll = 9223372036854775807ll; | |
2810 | long long int nll = -9223372036854775807LL; | |
2811 | unsigned long long int ull = 18446744073709551615ULL; | |
2812 | /* Test constant expressions. */ | |
2813 | typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) | |
2814 | ? 1 : -1)]; | |
2815 | typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 | |
2816 | ? 1 : -1)]; | |
2817 | int i = 63;]], | |
2818 | [[/* Test availability of runtime routines for shift and division. */ | |
2819 | long long int llmax = 9223372036854775807ll; | |
2820 | unsigned long long int ullmax = 18446744073709551615ull; | |
2821 | return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) | |
2822 | | (llmax / ll) | (llmax % ll) | |
2823 | | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) | |
2824 | | (ullmax / ull) | (ullmax % ull));]]) | |
2825 | ]) | |
2826 | ||
2827 | # nls.m4 serial 5 (gettext-0.18) | |
2828 | dnl Copyright (C) 1995-2003, 2005-2006, 2008-2013 Free Software Foundation, | |
2829 | dnl Inc. | |
2830 | dnl This file is free software; the Free Software Foundation | |
2831 | dnl gives unlimited permission to copy and/or distribute it, | |
2832 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
2833 | dnl |
2834 | dnl This file can can be used in projects which are not available under | |
2835 | dnl the GNU General Public License or the GNU Library General Public | |
2836 | dnl License but which still want to provide support for the GNU gettext | |
2837 | dnl functionality. | |
2838 | dnl Please note that the actual code of the GNU gettext library is covered | |
2839 | dnl by the GNU Library General Public License, and the rest of the GNU | |
2840 | dnl gettext package package is covered by the GNU General Public License. | |
2841 | dnl They are *not* in the public domain. | |
2842 | ||
2843 | dnl Authors: | |
b0cacab0 TT |
2844 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. |
2845 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. | |
2846 | ||
93613951 TT |
2847 | AC_PREREQ([2.50]) |
2848 | ||
b0cacab0 TT |
2849 | AC_DEFUN([AM_NLS], |
2850 | [ | |
2851 | AC_MSG_CHECKING([whether NLS is requested]) | |
2852 | dnl Default is enabled NLS | |
93613951 | 2853 | AC_ARG_ENABLE([nls], |
b0cacab0 TT |
2854 | [ --disable-nls do not use Native Language Support], |
2855 | USE_NLS=$enableval, USE_NLS=yes) | |
93613951 TT |
2856 | AC_MSG_RESULT([$USE_NLS]) |
2857 | AC_SUBST([USE_NLS]) | |
b0cacab0 TT |
2858 | ]) |
2859 | ||
93613951 TT |
2860 | # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- |
2861 | # serial 1 (pkg-config-0.24) | |
2862 | # | |
2863 | # Copyright © 2004 Scott James Remnant <scott@netsplit.com>. | |
2864 | # | |
2865 | # This program is free software; you can redistribute it and/or modify | |
2866 | # it under the terms of the GNU General Public License as published by | |
2867 | # the Free Software Foundation; either version 2 of the License, or | |
2868 | # (at your option) any later version. | |
2869 | # | |
2870 | # This program is distributed in the hope that it will be useful, but | |
2871 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
2872 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
2873 | # General Public License for more details. | |
2874 | # | |
2875 | # You should have received a copy of the GNU General Public License | |
2876 | # along with this program; if not, write to the Free Software | |
8785aaea | 2877 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
93613951 TT |
2878 | # |
2879 | # As a special exception to the GNU General Public License, if you | |
2880 | # distribute this file as part of a program that contains a | |
2881 | # configuration script generated by Autoconf, you may include it under | |
2882 | # the same distribution terms that you use for the rest of that program. | |
2883 | ||
2884 | # PKG_PROG_PKG_CONFIG([MIN-VERSION]) | |
2885 | # ---------------------------------- | |
2886 | AC_DEFUN([PKG_PROG_PKG_CONFIG], | |
2887 | [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) | |
2888 | m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) | |
2889 | m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) | |
2890 | AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) | |
2891 | AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) | |
2892 | AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) | |
2893 | ||
2894 | if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then | |
2895 | AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) | |
2896 | fi | |
2897 | if test -n "$PKG_CONFIG"; then | |
2898 | _pkg_min_version=m4_default([$1], [0.9.0]) | |
2899 | AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) | |
2900 | if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then | |
2901 | AC_MSG_RESULT([yes]) | |
2902 | else | |
2903 | AC_MSG_RESULT([no]) | |
2904 | PKG_CONFIG="" | |
2905 | fi | |
2906 | fi[]dnl | |
2907 | ])# PKG_PROG_PKG_CONFIG | |
2908 | ||
2909 | # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | |
2910 | # | |
2911 | # Check to see whether a particular set of modules exists. Similar | |
2912 | # to PKG_CHECK_MODULES(), but does not set variables or print errors. | |
2913 | # | |
2914 | # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
055866d8 | 2915 | # only at the first occurrence in configure.ac, so if the first place |
93613951 TT |
2916 | # it's called might be skipped (such as if it is within an "if", you |
2917 | # have to call PKG_CHECK_EXISTS manually | |
2918 | # -------------------------------------------------------------- | |
2919 | AC_DEFUN([PKG_CHECK_EXISTS], | |
2920 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
2921 | if test -n "$PKG_CONFIG" && \ | |
2922 | AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then | |
2923 | m4_default([$2], [:]) | |
2924 | m4_ifvaln([$3], [else | |
2925 | $3])dnl | |
2926 | fi]) | |
2927 | ||
2928 | # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) | |
2929 | # --------------------------------------------- | |
2930 | m4_define([_PKG_CONFIG], | |
2931 | [if test -n "$$1"; then | |
2932 | pkg_cv_[]$1="$$1" | |
2933 | elif test -n "$PKG_CONFIG"; then | |
2934 | PKG_CHECK_EXISTS([$3], | |
2935 | [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` | |
2936 | test "x$?" != "x0" && pkg_failed=yes ], | |
2937 | [pkg_failed=yes]) | |
2938 | else | |
2939 | pkg_failed=untried | |
2940 | fi[]dnl | |
2941 | ])# _PKG_CONFIG | |
2942 | ||
2943 | # _PKG_SHORT_ERRORS_SUPPORTED | |
2944 | # ----------------------------- | |
2945 | AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], | |
2946 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) | |
2947 | if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then | |
2948 | _pkg_short_errors_supported=yes | |
2949 | else | |
2950 | _pkg_short_errors_supported=no | |
2951 | fi[]dnl | |
2952 | ])# _PKG_SHORT_ERRORS_SUPPORTED | |
2953 | ||
2954 | ||
2955 | # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], | |
2956 | # [ACTION-IF-NOT-FOUND]) | |
2957 | # | |
2958 | # | |
2959 | # Note that if there is a possibility the first call to | |
2960 | # PKG_CHECK_MODULES might not happen, you should be sure to include an | |
2961 | # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac | |
2962 | # | |
2963 | # | |
2964 | # -------------------------------------------------------------- | |
2965 | AC_DEFUN([PKG_CHECK_MODULES], | |
2966 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
2967 | AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl | |
2968 | AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl | |
2969 | ||
2970 | pkg_failed=no | |
2971 | AC_MSG_CHECKING([for $1]) | |
2972 | ||
2973 | _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) | |
2974 | _PKG_CONFIG([$1][_LIBS], [libs], [$2]) | |
2975 | ||
2976 | m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS | |
2977 | and $1[]_LIBS to avoid the need to call pkg-config. | |
2978 | See the pkg-config man page for more details.]) | |
2979 | ||
2980 | if test $pkg_failed = yes; then | |
2981 | AC_MSG_RESULT([no]) | |
2982 | _PKG_SHORT_ERRORS_SUPPORTED | |
2983 | if test $_pkg_short_errors_supported = yes; then | |
2984 | $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` | |
2985 | else | |
2986 | $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` | |
2987 | fi | |
2988 | # Put the nasty error message in config.log where it belongs | |
2989 | echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD | |
2990 | ||
2991 | m4_default([$4], [AC_MSG_ERROR( | |
2992 | [Package requirements ($2) were not met: | |
2993 | ||
2994 | $$1_PKG_ERRORS | |
2995 | ||
2996 | Consider adjusting the PKG_CONFIG_PATH environment variable if you | |
2997 | installed software in a non-standard prefix. | |
2998 | ||
2999 | _PKG_TEXT])[]dnl | |
3000 | ]) | |
3001 | elif test $pkg_failed = untried; then | |
3002 | AC_MSG_RESULT([no]) | |
3003 | m4_default([$4], [AC_MSG_FAILURE( | |
3004 | [The pkg-config script could not be found or is too old. Make sure it | |
3005 | is in your PATH or set the PKG_CONFIG environment variable to the full | |
3006 | path to pkg-config. | |
3007 | ||
3008 | _PKG_TEXT | |
3009 | ||
3010 | To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl | |
3011 | ]) | |
3012 | else | |
3013 | $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS | |
3014 | $1[]_LIBS=$pkg_cv_[]$1[]_LIBS | |
3015 | AC_MSG_RESULT([yes]) | |
3016 | $3 | |
3017 | fi[]dnl | |
3018 | ])# PKG_CHECK_MODULES | |
3019 | ||
3020 | ||
3021 | # PKG_INSTALLDIR(DIRECTORY) | |
3022 | # ------------------------- | |
3023 | # Substitutes the variable pkgconfigdir as the location where a module | |
3024 | # should install pkg-config .pc files. By default the directory is | |
3025 | # $libdir/pkgconfig, but the default can be changed by passing | |
3026 | # DIRECTORY. The user can override through the --with-pkgconfigdir | |
3027 | # parameter. | |
3028 | AC_DEFUN([PKG_INSTALLDIR], | |
3029 | [m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) | |
3030 | m4_pushdef([pkg_description], | |
3031 | [pkg-config installation directory @<:@]pkg_default[@:>@]) | |
3032 | AC_ARG_WITH([pkgconfigdir], | |
3033 | [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, | |
3034 | [with_pkgconfigdir=]pkg_default) | |
3035 | AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) | |
3036 | m4_popdef([pkg_default]) | |
3037 | m4_popdef([pkg_description]) | |
3038 | ]) dnl PKG_INSTALLDIR | |
3039 | ||
3040 | ||
3041 | # PKG_NOARCH_INSTALLDIR(DIRECTORY) | |
3042 | # ------------------------- | |
3043 | # Substitutes the variable noarch_pkgconfigdir as the location where a | |
3044 | # module should install arch-independent pkg-config .pc files. By | |
3045 | # default the directory is $datadir/pkgconfig, but the default can be | |
3046 | # changed by passing DIRECTORY. The user can override through the | |
3047 | # --with-noarch-pkgconfigdir parameter. | |
3048 | AC_DEFUN([PKG_NOARCH_INSTALLDIR], | |
3049 | [m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) | |
3050 | m4_pushdef([pkg_description], | |
3051 | [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) | |
3052 | AC_ARG_WITH([noarch-pkgconfigdir], | |
3053 | [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, | |
3054 | [with_noarch_pkgconfigdir=]pkg_default) | |
3055 | AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) | |
3056 | m4_popdef([pkg_default]) | |
3057 | m4_popdef([pkg_description]) | |
3058 | ]) dnl PKG_NOARCH_INSTALLDIR | |
3059 | ||
3060 | ||
3061 | # PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, | |
3062 | # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) | |
3063 | # ------------------------------------------- | |
3064 | # Retrieves the value of the pkg-config variable for the given module. | |
3065 | AC_DEFUN([PKG_CHECK_VAR], | |
3066 | [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl | |
3067 | AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl | |
3068 | ||
3069 | _PKG_CONFIG([$1], [variable="][$3]["], [$2]) | |
3070 | AS_VAR_COPY([$1], [pkg_cv_][$1]) | |
3071 | ||
3072 | AS_VAR_IF([$1], [""], [$5], [$4])dnl | |
3073 | ])# PKG_CHECK_VAR | |
3074 | ||
3075 | # po.m4 serial 21 (gettext-0.18.3) | |
3076 | dnl Copyright (C) 1995-2013 Free Software Foundation, Inc. | |
3077 | dnl This file is free software; the Free Software Foundation | |
3078 | dnl gives unlimited permission to copy and/or distribute it, | |
3079 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
3080 | dnl |
3081 | dnl This file can can be used in projects which are not available under | |
3082 | dnl the GNU General Public License or the GNU Library General Public | |
3083 | dnl License but which still want to provide support for the GNU gettext | |
3084 | dnl functionality. | |
3085 | dnl Please note that the actual code of the GNU gettext library is covered | |
3086 | dnl by the GNU Library General Public License, and the rest of the GNU | |
3087 | dnl gettext package package is covered by the GNU General Public License. | |
3088 | dnl They are *not* in the public domain. | |
3089 | ||
3090 | dnl Authors: | |
3091 | dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000. | |
3092 | dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003. | |
3093 | ||
93613951 TT |
3094 | AC_PREREQ([2.60]) |
3095 | ||
b0cacab0 TT |
3096 | dnl Checks for all prerequisites of the po subdirectory. |
3097 | AC_DEFUN([AM_PO_SUBDIRS], | |
3098 | [ | |
3099 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl | |
3100 | AC_REQUIRE([AC_PROG_INSTALL])dnl | |
93613951 TT |
3101 | AC_REQUIRE([AC_PROG_MKDIR_P])dnl |
3102 | AC_REQUIRE([AC_PROG_SED])dnl | |
b0cacab0 TT |
3103 | AC_REQUIRE([AM_NLS])dnl |
3104 | ||
93613951 TT |
3105 | dnl Release version of the gettext macros. This is used to ensure that |
3106 | dnl the gettext macros and po/Makefile.in.in are in sync. | |
3107 | AC_SUBST([GETTEXT_MACRO_VERSION], [0.18]) | |
3108 | ||
b0cacab0 TT |
3109 | dnl Perform the following tests also if --disable-nls has been given, |
3110 | dnl because they are needed for "make dist" to work. | |
3111 | ||
3112 | dnl Search for GNU msgfmt in the PATH. | |
3113 | dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. | |
3114 | dnl The second test excludes FreeBSD msgfmt. | |
3115 | AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, | |
93613951 | 3116 | [$ac_dir/$ac_word --statistics /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && |
b0cacab0 TT |
3117 | (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], |
3118 | :) | |
93613951 TT |
3119 | AC_PATH_PROG([GMSGFMT], [gmsgfmt], [$MSGFMT]) |
3120 | ||
3121 | dnl Test whether it is GNU msgfmt >= 0.15. | |
3122 | changequote(,)dnl | |
3123 | case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in | |
3124 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; | |
3125 | *) MSGFMT_015=$MSGFMT ;; | |
3126 | esac | |
3127 | changequote([,])dnl | |
3128 | AC_SUBST([MSGFMT_015]) | |
3129 | changequote(,)dnl | |
3130 | case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in | |
3131 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; | |
3132 | *) GMSGFMT_015=$GMSGFMT ;; | |
3133 | esac | |
3134 | changequote([,])dnl | |
3135 | AC_SUBST([GMSGFMT_015]) | |
b0cacab0 TT |
3136 | |
3137 | dnl Search for GNU xgettext 0.12 or newer in the PATH. | |
3138 | dnl The first test excludes Solaris xgettext and early GNU xgettext versions. | |
3139 | dnl The second test excludes FreeBSD xgettext. | |
3140 | AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, | |
93613951 | 3141 | [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1 && |
b0cacab0 TT |
3142 | (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)], |
3143 | :) | |
3144 | dnl Remove leftover from FreeBSD xgettext call. | |
3145 | rm -f messages.po | |
3146 | ||
93613951 TT |
3147 | dnl Test whether it is GNU xgettext >= 0.15. |
3148 | changequote(,)dnl | |
3149 | case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in | |
3150 | '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; | |
3151 | *) XGETTEXT_015=$XGETTEXT ;; | |
3152 | esac | |
3153 | changequote([,])dnl | |
3154 | AC_SUBST([XGETTEXT_015]) | |
3155 | ||
b0cacab0 TT |
3156 | dnl Search for GNU msgmerge 0.11 or newer in the PATH. |
3157 | AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, | |
93613951 | 3158 | [$ac_dir/$ac_word --update -q /dev/null /dev/null >&]AS_MESSAGE_LOG_FD[ 2>&1], :) |
b0cacab0 | 3159 | |
93613951 TT |
3160 | dnl Installation directories. |
3161 | dnl Autoconf >= 2.60 defines localedir. For older versions of autoconf, we | |
3162 | dnl have to define it here, so that it can be used in po/Makefile. | |
3163 | test -n "$localedir" || localedir='${datadir}/locale' | |
3164 | AC_SUBST([localedir]) | |
3165 | ||
3166 | dnl Support for AM_XGETTEXT_OPTION. | |
3167 | test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= | |
3168 | AC_SUBST([XGETTEXT_EXTRA_OPTIONS]) | |
b0cacab0 | 3169 | |
93613951 | 3170 | AC_CONFIG_COMMANDS([po-directories], [[ |
b0cacab0 TT |
3171 | for ac_file in $CONFIG_FILES; do |
3172 | # Support "outfile[:infile[:infile...]]" | |
3173 | case "$ac_file" in | |
3174 | *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; | |
3175 | esac | |
3176 | # PO directories have a Makefile.in generated from Makefile.in.in. | |
3177 | case "$ac_file" in */Makefile.in) | |
3178 | # Adjust a relative srcdir. | |
3179 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | |
93613951 | 3180 | ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` |
b0cacab0 TT |
3181 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` |
3182 | # In autoconf-2.13 it is called $ac_given_srcdir. | |
3183 | # In autoconf-2.50 it is called $srcdir. | |
3184 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | |
3185 | case "$ac_given_srcdir" in | |
3186 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | |
3187 | /*) top_srcdir="$ac_given_srcdir" ;; | |
3188 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | |
3189 | esac | |
93613951 TT |
3190 | # Treat a directory as a PO directory if and only if it has a |
3191 | # POTFILES.in file. This allows packages to have multiple PO | |
3192 | # directories under different names or in different locations. | |
b0cacab0 TT |
3193 | if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then |
3194 | rm -f "$ac_dir/POTFILES" | |
3195 | test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" | |
93613951 TT |
3196 | gt_tab=`printf '\t'` |
3197 | cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ${gt_tab}]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" | |
b0cacab0 TT |
3198 | POMAKEFILEDEPS="POTFILES.in" |
3199 | # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend | |
3200 | # on $ac_dir but don't depend on user-specified configuration | |
3201 | # parameters. | |
3202 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | |
3203 | # The LINGUAS file contains the set of available languages. | |
3204 | if test -n "$OBSOLETE_ALL_LINGUAS"; then | |
3205 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | |
3206 | fi | |
93613951 TT |
3207 | ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` |
3208 | # Hide the ALL_LINGUAS assignment from automake < 1.5. | |
b0cacab0 TT |
3209 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' |
3210 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" | |
3211 | else | |
3212 | # The set of available languages was given in configure.in. | |
93613951 | 3213 | # Hide the ALL_LINGUAS assignment from automake < 1.5. |
b0cacab0 TT |
3214 | eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' |
3215 | fi | |
3216 | # Compute POFILES | |
3217 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) | |
3218 | # Compute UPDATEPOFILES | |
3219 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) | |
3220 | # Compute DUMMYPOFILES | |
3221 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) | |
3222 | # Compute GMOFILES | |
3223 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) | |
3224 | case "$ac_given_srcdir" in | |
3225 | .) srcdirpre= ;; | |
3226 | *) srcdirpre='$(srcdir)/' ;; | |
3227 | esac | |
3228 | POFILES= | |
3229 | UPDATEPOFILES= | |
3230 | DUMMYPOFILES= | |
3231 | GMOFILES= | |
3232 | for lang in $ALL_LINGUAS; do | |
3233 | POFILES="$POFILES $srcdirpre$lang.po" | |
3234 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | |
3235 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | |
3236 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | |
3237 | done | |
3238 | # CATALOGS depends on both $ac_dir and the user's LINGUAS | |
3239 | # environment variable. | |
3240 | INST_LINGUAS= | |
3241 | if test -n "$ALL_LINGUAS"; then | |
3242 | for presentlang in $ALL_LINGUAS; do | |
3243 | useit=no | |
3244 | if test "%UNSET%" != "$LINGUAS"; then | |
3245 | desiredlanguages="$LINGUAS" | |
3246 | else | |
3247 | desiredlanguages="$ALL_LINGUAS" | |
3248 | fi | |
3249 | for desiredlang in $desiredlanguages; do | |
3250 | # Use the presentlang catalog if desiredlang is | |
3251 | # a. equal to presentlang, or | |
3252 | # b. a variant of presentlang (because in this case, | |
3253 | # presentlang can be used as a fallback for messages | |
3254 | # which are not translated in the desiredlang catalog). | |
3255 | case "$desiredlang" in | |
3256 | "$presentlang"*) useit=yes;; | |
3257 | esac | |
3258 | done | |
3259 | if test $useit = yes; then | |
3260 | INST_LINGUAS="$INST_LINGUAS $presentlang" | |
3261 | fi | |
3262 | done | |
3263 | fi | |
3264 | CATALOGS= | |
3265 | if test -n "$INST_LINGUAS"; then | |
3266 | for lang in $INST_LINGUAS; do | |
3267 | CATALOGS="$CATALOGS $lang.gmo" | |
3268 | done | |
3269 | fi | |
3270 | test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" | |
3271 | 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" | |
3272 | for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do | |
3273 | if test -f "$f"; then | |
3274 | case "$f" in | |
3275 | *.orig | *.bak | *~) ;; | |
3276 | *) cat "$f" >> "$ac_dir/Makefile" ;; | |
3277 | esac | |
3278 | fi | |
3279 | done | |
3280 | fi | |
3281 | ;; | |
3282 | esac | |
93613951 | 3283 | done]], |
b0cacab0 TT |
3284 | [# Capture the value of obsolete ALL_LINGUAS because we need it to compute |
3285 | # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it | |
93613951 | 3286 | # from automake < 1.5. |
b0cacab0 TT |
3287 | eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' |
3288 | # Capture the value of LINGUAS because we need it to compute CATALOGS. | |
3289 | LINGUAS="${LINGUAS-%UNSET%}" | |
3290 | ]) | |
3291 | ]) | |
3292 | ||
3293 | dnl Postprocesses a Makefile in a directory containing PO files. | |
3294 | AC_DEFUN([AM_POSTPROCESS_PO_MAKEFILE], | |
3295 | [ | |
3296 | # When this code is run, in config.status, two variables have already been | |
3297 | # set: | |
3298 | # - OBSOLETE_ALL_LINGUAS is the value of LINGUAS set in configure.in, | |
3299 | # - LINGUAS is the value of the environment variable LINGUAS at configure | |
3300 | # time. | |
3301 | ||
3302 | changequote(,)dnl | |
3303 | # Adjust a relative srcdir. | |
3304 | ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` | |
93613951 | 3305 | ac_dir_suffix=/`echo "$ac_dir"|sed 's%^\./%%'` |
b0cacab0 TT |
3306 | ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` |
3307 | # In autoconf-2.13 it is called $ac_given_srcdir. | |
3308 | # In autoconf-2.50 it is called $srcdir. | |
3309 | test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" | |
3310 | case "$ac_given_srcdir" in | |
3311 | .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; | |
3312 | /*) top_srcdir="$ac_given_srcdir" ;; | |
3313 | *) top_srcdir="$ac_dots$ac_given_srcdir" ;; | |
3314 | esac | |
3315 | ||
3316 | # Find a way to echo strings without interpreting backslash. | |
3317 | if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then | |
3318 | gt_echo='echo' | |
3319 | else | |
3320 | if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then | |
3321 | gt_echo='printf %s\n' | |
3322 | else | |
3323 | echo_func () { | |
3324 | cat <<EOT | |
3325 | $* | |
3326 | EOT | |
3327 | } | |
3328 | gt_echo='echo_func' | |
3329 | fi | |
3330 | fi | |
3331 | ||
3332 | # A sed script that extracts the value of VARIABLE from a Makefile. | |
93613951 | 3333 | tab=`printf '\t'` |
b0cacab0 TT |
3334 | sed_x_variable=' |
3335 | # Test if the hold space is empty. | |
3336 | x | |
3337 | s/P/P/ | |
3338 | x | |
3339 | ta | |
3340 | # Yes it was empty. Look if we have the expected variable definition. | |
93613951 | 3341 | /^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=/{ |
b0cacab0 | 3342 | # Seen the first line of the variable definition. |
93613951 | 3343 | s/^['"${tab}"' ]*VARIABLE['"${tab}"' ]*=// |
b0cacab0 TT |
3344 | ba |
3345 | } | |
3346 | bd | |
3347 | :a | |
3348 | # Here we are processing a line from the variable definition. | |
3349 | # Remove comment, more precisely replace it with a space. | |
3350 | s/#.*$/ / | |
3351 | # See if the line ends in a backslash. | |
3352 | tb | |
3353 | :b | |
3354 | s/\\$// | |
3355 | # Print the line, without the trailing backslash. | |
3356 | p | |
3357 | tc | |
3358 | # There was no trailing backslash. The end of the variable definition is | |
3359 | # reached. Clear the hold space. | |
3360 | s/^.*$// | |
3361 | x | |
3362 | bd | |
3363 | :c | |
3364 | # A trailing backslash means that the variable definition continues in the | |
3365 | # next line. Put a nonempty string into the hold space to indicate this. | |
3366 | s/^.*$/P/ | |
3367 | x | |
3368 | :d | |
3369 | ' | |
3370 | changequote([,])dnl | |
3371 | ||
3372 | # Set POTFILES to the value of the Makefile variable POTFILES. | |
93613951 | 3373 | sed_x_POTFILES=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/POTFILES/g'` |
b0cacab0 TT |
3374 | POTFILES=`sed -n -e "$sed_x_POTFILES" < "$ac_file"` |
3375 | # Compute POTFILES_DEPS as | |
3376 | # $(foreach file, $(POTFILES), $(top_srcdir)/$(file)) | |
3377 | POTFILES_DEPS= | |
3378 | for file in $POTFILES; do | |
3379 | POTFILES_DEPS="$POTFILES_DEPS "'$(top_srcdir)/'"$file" | |
3380 | done | |
3381 | POMAKEFILEDEPS="" | |
3382 | ||
3383 | if test -n "$OBSOLETE_ALL_LINGUAS"; then | |
3384 | test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" | |
3385 | fi | |
3386 | if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then | |
3387 | # The LINGUAS file contains the set of available languages. | |
93613951 | 3388 | ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` |
b0cacab0 TT |
3389 | POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" |
3390 | else | |
3391 | # Set ALL_LINGUAS to the value of the Makefile variable LINGUAS. | |
93613951 | 3392 | sed_x_LINGUAS=`$gt_echo "$sed_x_variable" | sed -e '/^ *#/d' -e 's/VARIABLE/LINGUAS/g'` |
b0cacab0 TT |
3393 | ALL_LINGUAS_=`sed -n -e "$sed_x_LINGUAS" < "$ac_file"` |
3394 | fi | |
93613951 | 3395 | # Hide the ALL_LINGUAS assignment from automake < 1.5. |
b0cacab0 TT |
3396 | eval 'ALL_LINGUAS''=$ALL_LINGUAS_' |
3397 | # Compute POFILES | |
3398 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) | |
3399 | # Compute UPDATEPOFILES | |
3400 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) | |
3401 | # Compute DUMMYPOFILES | |
3402 | # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) | |
3403 | # Compute GMOFILES | |
3404 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) | |
3405 | # Compute PROPERTIESFILES | |
3406 | # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).properties) | |
3407 | # Compute CLASSFILES | |
3408 | # as $(foreach lang, $(ALL_LINGUAS), $(top_srcdir)/$(DOMAIN)_$(lang).class) | |
3409 | # Compute QMFILES | |
3410 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).qm) | |
3411 | # Compute MSGFILES | |
3412 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang)).msg) | |
3413 | # Compute RESOURCESDLLFILES | |
3414 | # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(frob $(lang))/$(DOMAIN).resources.dll) | |
3415 | case "$ac_given_srcdir" in | |
3416 | .) srcdirpre= ;; | |
3417 | *) srcdirpre='$(srcdir)/' ;; | |
3418 | esac | |
3419 | POFILES= | |
3420 | UPDATEPOFILES= | |
3421 | DUMMYPOFILES= | |
3422 | GMOFILES= | |
3423 | PROPERTIESFILES= | |
3424 | CLASSFILES= | |
3425 | QMFILES= | |
3426 | MSGFILES= | |
3427 | RESOURCESDLLFILES= | |
3428 | for lang in $ALL_LINGUAS; do | |
3429 | POFILES="$POFILES $srcdirpre$lang.po" | |
3430 | UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" | |
3431 | DUMMYPOFILES="$DUMMYPOFILES $lang.nop" | |
3432 | GMOFILES="$GMOFILES $srcdirpre$lang.gmo" | |
3433 | PROPERTIESFILES="$PROPERTIESFILES \$(top_srcdir)/\$(DOMAIN)_$lang.properties" | |
3434 | CLASSFILES="$CLASSFILES \$(top_srcdir)/\$(DOMAIN)_$lang.class" | |
3435 | QMFILES="$QMFILES $srcdirpre$lang.qm" | |
3436 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | |
3437 | MSGFILES="$MSGFILES $srcdirpre$frobbedlang.msg" | |
93613951 | 3438 | frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` |
b0cacab0 TT |
3439 | RESOURCESDLLFILES="$RESOURCESDLLFILES $srcdirpre$frobbedlang/\$(DOMAIN).resources.dll" |
3440 | done | |
3441 | # CATALOGS depends on both $ac_dir and the user's LINGUAS | |
3442 | # environment variable. | |
3443 | INST_LINGUAS= | |
3444 | if test -n "$ALL_LINGUAS"; then | |
3445 | for presentlang in $ALL_LINGUAS; do | |
3446 | useit=no | |
3447 | if test "%UNSET%" != "$LINGUAS"; then | |
3448 | desiredlanguages="$LINGUAS" | |
3449 | else | |
3450 | desiredlanguages="$ALL_LINGUAS" | |
3451 | fi | |
3452 | for desiredlang in $desiredlanguages; do | |
3453 | # Use the presentlang catalog if desiredlang is | |
3454 | # a. equal to presentlang, or | |
3455 | # b. a variant of presentlang (because in this case, | |
3456 | # presentlang can be used as a fallback for messages | |
3457 | # which are not translated in the desiredlang catalog). | |
3458 | case "$desiredlang" in | |
3459 | "$presentlang"*) useit=yes;; | |
3460 | esac | |
3461 | done | |
3462 | if test $useit = yes; then | |
3463 | INST_LINGUAS="$INST_LINGUAS $presentlang" | |
3464 | fi | |
3465 | done | |
3466 | fi | |
3467 | CATALOGS= | |
3468 | JAVACATALOGS= | |
3469 | QTCATALOGS= | |
3470 | TCLCATALOGS= | |
3471 | CSHARPCATALOGS= | |
3472 | if test -n "$INST_LINGUAS"; then | |
3473 | for lang in $INST_LINGUAS; do | |
3474 | CATALOGS="$CATALOGS $lang.gmo" | |
3475 | JAVACATALOGS="$JAVACATALOGS \$(DOMAIN)_$lang.properties" | |
3476 | QTCATALOGS="$QTCATALOGS $lang.qm" | |
3477 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | |
3478 | TCLCATALOGS="$TCLCATALOGS $frobbedlang.msg" | |
93613951 | 3479 | frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` |
b0cacab0 TT |
3480 | CSHARPCATALOGS="$CSHARPCATALOGS $frobbedlang/\$(DOMAIN).resources.dll" |
3481 | done | |
3482 | fi | |
3483 | ||
3484 | 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" | |
93613951 | 3485 | tab=`printf '\t'` |
b0cacab0 TT |
3486 | if grep -l '@TCLCATALOGS@' "$ac_file" > /dev/null; then |
3487 | # Add dependencies that cannot be formulated as a simple suffix rule. | |
3488 | for lang in $ALL_LINGUAS; do | |
3489 | frobbedlang=`echo $lang | sed -e 's/\..*$//' -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` | |
3490 | cat >> "$ac_file.tmp" <<EOF | |
3491 | $frobbedlang.msg: $lang.po | |
93613951 TT |
3492 | ${tab}@echo "\$(MSGFMT) -c --tcl -d \$(srcdir) -l $lang $srcdirpre$lang.po"; \ |
3493 | ${tab}\$(MSGFMT) -c --tcl -d "\$(srcdir)" -l $lang $srcdirpre$lang.po || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } | |
b0cacab0 TT |
3494 | EOF |
3495 | done | |
3496 | fi | |
3497 | if grep -l '@CSHARPCATALOGS@' "$ac_file" > /dev/null; then | |
3498 | # Add dependencies that cannot be formulated as a simple suffix rule. | |
3499 | for lang in $ALL_LINGUAS; do | |
93613951 | 3500 | frobbedlang=`echo $lang | sed -e 's/_/-/g' -e 's/^sr-CS/sr-SP/' -e 's/@latin$/-Latn/' -e 's/@cyrillic$/-Cyrl/' -e 's/^sr-SP$/sr-SP-Latn/' -e 's/^uz-UZ$/uz-UZ-Latn/'` |
b0cacab0 TT |
3501 | cat >> "$ac_file.tmp" <<EOF |
3502 | $frobbedlang/\$(DOMAIN).resources.dll: $lang.po | |
93613951 TT |
3503 | ${tab}@echo "\$(MSGFMT) -c --csharp -d \$(srcdir) -l $lang $srcdirpre$lang.po -r \$(DOMAIN)"; \ |
3504 | ${tab}\$(MSGFMT) -c --csharp -d "\$(srcdir)" -l $lang $srcdirpre$lang.po -r "\$(DOMAIN)" || { rm -f "\$(srcdir)/$frobbedlang.msg"; exit 1; } | |
b0cacab0 TT |
3505 | EOF |
3506 | done | |
3507 | fi | |
3508 | if test -n "$POMAKEFILEDEPS"; then | |
3509 | cat >> "$ac_file.tmp" <<EOF | |
3510 | Makefile: $POMAKEFILEDEPS | |
3511 | EOF | |
3512 | fi | |
3513 | mv "$ac_file.tmp" "$ac_file" | |
3514 | ]) | |
93613951 TT |
3515 | |
3516 | dnl Initializes the accumulator used by AM_XGETTEXT_OPTION. | |
3517 | AC_DEFUN([AM_XGETTEXT_OPTION_INIT], | |
3518 | [ | |
3519 | XGETTEXT_EXTRA_OPTIONS= | |
3520 | ]) | |
3521 | ||
3522 | dnl Registers an option to be passed to xgettext in the po subdirectory. | |
3523 | AC_DEFUN([AM_XGETTEXT_OPTION], | |
3524 | [ | |
3525 | AC_REQUIRE([AM_XGETTEXT_OPTION_INIT]) | |
3526 | XGETTEXT_EXTRA_OPTIONS="$XGETTEXT_EXTRA_OPTIONS $1" | |
3527 | ]) | |
3528 | ||
3529 | # printf-posix.m4 serial 6 (gettext-0.18.2) | |
3530 | dnl Copyright (C) 2003, 2007, 2009-2013 Free Software Foundation, Inc. | |
3531 | dnl This file is free software; the Free Software Foundation | |
3532 | dnl gives unlimited permission to copy and/or distribute it, | |
3533 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
3534 | |
3535 | dnl From Bruno Haible. | |
3536 | dnl Test whether the printf() function supports POSIX/XSI format strings with | |
3537 | dnl positions. | |
3538 | ||
3539 | AC_DEFUN([gt_PRINTF_POSIX], | |
3540 | [ | |
3541 | AC_REQUIRE([AC_PROG_CC]) | |
3542 | AC_CACHE_CHECK([whether printf() supports POSIX/XSI format strings], | |
3543 | gt_cv_func_printf_posix, | |
3544 | [ | |
93613951 TT |
3545 | AC_RUN_IFELSE( |
3546 | [AC_LANG_SOURCE([[ | |
b0cacab0 TT |
3547 | #include <stdio.h> |
3548 | #include <string.h> | |
3549 | /* The string "%2$d %1$d", with dollar characters protected from the shell's | |
3550 | dollar expansion (possibly an autoconf bug). */ | |
3551 | static char format[] = { '%', '2', '$', 'd', ' ', '%', '1', '$', 'd', '\0' }; | |
3552 | static char buf[100]; | |
3553 | int main () | |
3554 | { | |
3555 | sprintf (buf, format, 33, 55); | |
3556 | return (strcmp (buf, "55 33") != 0); | |
93613951 TT |
3557 | }]])], |
3558 | [gt_cv_func_printf_posix=yes], | |
3559 | [gt_cv_func_printf_posix=no], | |
3560 | [ | |
3561 | AC_EGREP_CPP([notposix], [ | |
3562 | #if defined __NetBSD__ || defined __BEOS__ || defined _MSC_VER || defined __MINGW32__ || defined __CYGWIN__ | |
b0cacab0 TT |
3563 | notposix |
3564 | #endif | |
93613951 TT |
3565 | ], |
3566 | [gt_cv_func_printf_posix="guessing no"], | |
3567 | [gt_cv_func_printf_posix="guessing yes"]) | |
3568 | ]) | |
b0cacab0 TT |
3569 | ]) |
3570 | case $gt_cv_func_printf_posix in | |
3571 | *yes) | |
93613951 | 3572 | AC_DEFINE([HAVE_POSIX_PRINTF], [1], |
b0cacab0 TT |
3573 | [Define if your printf() function supports format strings with positions.]) |
3574 | ;; | |
3575 | esac | |
3576 | ]) | |
93613951 TT |
3577 | |
3578 | # progtest.m4 serial 7 (gettext-0.18.2) | |
3579 | dnl Copyright (C) 1996-2003, 2005, 2008-2013 Free Software Foundation, Inc. | |
3580 | dnl This file is free software; the Free Software Foundation | |
3581 | dnl gives unlimited permission to copy and/or distribute it, | |
3582 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
3583 | dnl |
3584 | dnl This file can can be used in projects which are not available under | |
3585 | dnl the GNU General Public License or the GNU Library General Public | |
3586 | dnl License but which still want to provide support for the GNU gettext | |
3587 | dnl functionality. | |
3588 | dnl Please note that the actual code of the GNU gettext library is covered | |
3589 | dnl by the GNU Library General Public License, and the rest of the GNU | |
3590 | dnl gettext package package is covered by the GNU General Public License. | |
3591 | dnl They are *not* in the public domain. | |
3592 | ||
3593 | dnl Authors: | |
3594 | dnl Ulrich Drepper <drepper@cygnus.com>, 1996. | |
a04eba3f | 3595 | |
93613951 TT |
3596 | AC_PREREQ([2.50]) |
3597 | ||
a04eba3f | 3598 | # Search path for a program which passes the given test. |
a64c9c13 TT |
3599 | |
3600 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | |
3601 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | |
a04eba3f | 3602 | AC_DEFUN([AM_PATH_PROG_WITH_TEST], |
b0cacab0 TT |
3603 | [ |
3604 | # Prepare PATH_SEPARATOR. | |
3605 | # The user is always right. | |
3606 | if test "${PATH_SEPARATOR+set}" != set; then | |
93613951 TT |
3607 | # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which |
3608 | # contains only /bin. Note that ksh looks also at the FPATH variable, | |
3609 | # so we have to set that as well for the test. | |
3610 | PATH_SEPARATOR=: | |
3611 | (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ | |
3612 | && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ | |
3613 | || PATH_SEPARATOR=';' | |
3614 | } | |
b0cacab0 TT |
3615 | fi |
3616 | ||
3617 | # Find out how to test for executable files. Don't use a zero-byte file, | |
3618 | # as systems may use methods other than mode bits to determine executability. | |
3619 | cat >conf$$.file <<_ASEOF | |
3620 | #! /bin/sh | |
3621 | exit 0 | |
3622 | _ASEOF | |
3623 | chmod +x conf$$.file | |
3624 | if test -x conf$$.file >/dev/null 2>&1; then | |
3625 | ac_executable_p="test -x" | |
3626 | else | |
3627 | ac_executable_p="test -f" | |
3628 | fi | |
3629 | rm -f conf$$.file | |
3630 | ||
3631 | # Extract the first word of "$2", so it can be a program name with args. | |
a64c9c13 TT |
3632 | set dummy $2; ac_word=[$]2 |
3633 | AC_MSG_CHECKING([for $ac_word]) | |
93613951 | 3634 | AC_CACHE_VAL([ac_cv_path_$1], |
a64c9c13 | 3635 | [case "[$]$1" in |
b0cacab0 TT |
3636 | [[\\/]]* | ?:[[\\/]]*) |
3637 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | |
3638 | ;; | |
a64c9c13 | 3639 | *) |
b0cacab0 TT |
3640 | ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR |
3641 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | |
3642 | IFS="$ac_save_IFS" | |
3643 | test -z "$ac_dir" && ac_dir=. | |
3644 | for ac_exec_ext in '' $ac_executable_extensions; do | |
3645 | if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then | |
93613951 | 3646 | echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD |
b0cacab0 TT |
3647 | if [$3]; then |
3648 | ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" | |
3649 | break 2 | |
3650 | fi | |
3651 | fi | |
3652 | done | |
3653 | done | |
3654 | IFS="$ac_save_IFS" | |
a64c9c13 TT |
3655 | dnl If no 4th arg is given, leave the cache variable unset, |
3656 | dnl so AC_PATH_PROGS will keep looking. | |
3657 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | |
3658 | ])dnl | |
b0cacab0 | 3659 | ;; |
a64c9c13 TT |
3660 | esac])dnl |
3661 | $1="$ac_cv_path_$1" | |
a04eba3f | 3662 | if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then |
93613951 | 3663 | AC_MSG_RESULT([$][$1]) |
a64c9c13 | 3664 | else |
93613951 | 3665 | AC_MSG_RESULT([no]) |
a64c9c13 | 3666 | fi |
93613951 | 3667 | AC_SUBST([$1])dnl |
a64c9c13 | 3668 | ]) |
b0cacab0 | 3669 | |
93613951 TT |
3670 | # size_max.m4 serial 10 |
3671 | dnl Copyright (C) 2003, 2005-2006, 2008-2013 Free Software Foundation, Inc. | |
3672 | dnl This file is free software; the Free Software Foundation | |
3673 | dnl gives unlimited permission to copy and/or distribute it, | |
3674 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
3675 | |
3676 | dnl From Bruno Haible. | |
3677 | ||
3678 | AC_DEFUN([gl_SIZE_MAX], | |
3679 | [ | |
93613951 | 3680 | AC_CHECK_HEADERS([stdint.h]) |
b0cacab0 | 3681 | dnl First test whether the system already has SIZE_MAX. |
93613951 TT |
3682 | AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ |
3683 | gl_cv_size_max= | |
3684 | AC_EGREP_CPP([Found it], [ | |
b0cacab0 TT |
3685 | #include <limits.h> |
3686 | #if HAVE_STDINT_H | |
3687 | #include <stdint.h> | |
3688 | #endif | |
3689 | #ifdef SIZE_MAX | |
3690 | Found it | |
3691 | #endif | |
93613951 TT |
3692 | ], [gl_cv_size_max=yes]) |
3693 | if test -z "$gl_cv_size_max"; then | |
3694 | dnl Define it ourselves. Here we assume that the type 'size_t' is not wider | |
3695 | dnl than the type 'unsigned long'. Try hard to find a definition that can | |
3696 | dnl be used in a preprocessor #if, i.e. doesn't contain a cast. | |
3697 | AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], | |
3698 | [#include <stddef.h> | |
3699 | #include <limits.h>], [size_t_bits_minus_1=]) | |
3700 | AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], | |
3701 | [#include <stddef.h>], [fits_in_uint=]) | |
3702 | if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then | |
3703 | if test $fits_in_uint = 1; then | |
3704 | dnl Even though SIZE_MAX fits in an unsigned int, it must be of type | |
3705 | dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. | |
3706 | AC_COMPILE_IFELSE( | |
3707 | [AC_LANG_PROGRAM( | |
3708 | [[#include <stddef.h> | |
3709 | extern size_t foo; | |
3710 | extern unsigned long foo; | |
3711 | ]], | |
3712 | [[]])], | |
3713 | [fits_in_uint=0]) | |
3714 | fi | |
3715 | dnl We cannot use 'expr' to simplify this expression, because 'expr' | |
3716 | dnl works only with 'long' integers in the host environment, while we | |
3717 | dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. | |
3718 | if test $fits_in_uint = 1; then | |
3719 | gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" | |
3720 | else | |
3721 | gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" | |
3722 | fi | |
b0cacab0 | 3723 | else |
93613951 TT |
3724 | dnl Shouldn't happen, but who knows... |
3725 | gl_cv_size_max='((size_t)~(size_t)0)' | |
b0cacab0 | 3726 | fi |
b0cacab0 | 3727 | fi |
93613951 TT |
3728 | ]) |
3729 | if test "$gl_cv_size_max" != yes; then | |
3730 | AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], | |
b0cacab0 TT |
3731 | [Define as the maximum value of type 'size_t', if the system doesn't define it.]) |
3732 | fi | |
93613951 TT |
3733 | dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after |
3734 | dnl <stdint.h>. Remember that the #undef in AH_VERBATIM gets replaced with | |
3735 | dnl #define by AC_DEFINE_UNQUOTED. | |
3736 | AH_VERBATIM([SIZE_MAX], | |
3737 | [/* Define as the maximum value of type 'size_t', if the system doesn't define | |
3738 | it. */ | |
3739 | #ifndef SIZE_MAX | |
3740 | # undef SIZE_MAX | |
3741 | #endif]) | |
3742 | ]) | |
3743 | ||
3744 | dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. | |
3745 | dnl Remove this when we can assume autoconf >= 2.61. | |
3746 | m4_ifdef([AC_COMPUTE_INT], [], [ | |
3747 | AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) | |
b0cacab0 | 3748 | ]) |
93613951 TT |
3749 | |
3750 | # stdint_h.m4 serial 9 | |
3751 | dnl Copyright (C) 1997-2004, 2006, 2008-2013 Free Software Foundation, Inc. | |
3752 | dnl This file is free software; the Free Software Foundation | |
3753 | dnl gives unlimited permission to copy and/or distribute it, | |
3754 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
3755 | |
3756 | dnl From Paul Eggert. | |
3757 | ||
3758 | # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists, | |
3759 | # doesn't clash with <sys/types.h>, and declares uintmax_t. | |
3760 | ||
93613951 | 3761 | AC_DEFUN([gl_AC_HEADER_STDINT_H], |
a04eba3f | 3762 | [ |
93613951 TT |
3763 | AC_CACHE_CHECK([for stdint.h], [gl_cv_header_stdint_h], |
3764 | [AC_COMPILE_IFELSE( | |
3765 | [AC_LANG_PROGRAM( | |
3766 | [[#include <sys/types.h> | |
3767 | #include <stdint.h>]], | |
3768 | [[uintmax_t i = (uintmax_t) -1; return !i;]])], | |
3769 | [gl_cv_header_stdint_h=yes], | |
3770 | [gl_cv_header_stdint_h=no])]) | |
3771 | if test $gl_cv_header_stdint_h = yes; then | |
3772 | AC_DEFINE_UNQUOTED([HAVE_STDINT_H_WITH_UINTMAX], [1], | |
b0cacab0 TT |
3773 | [Define if <stdint.h> exists, doesn't clash with <sys/types.h>, |
3774 | and declares uintmax_t. ]) | |
a04eba3f TT |
3775 | fi |
3776 | ]) | |
93613951 TT |
3777 | |
3778 | # threadlib.m4 serial 10 (gettext-0.18.2) | |
3779 | dnl Copyright (C) 2005-2013 Free Software Foundation, Inc. | |
3780 | dnl This file is free software; the Free Software Foundation | |
3781 | dnl gives unlimited permission to copy and/or distribute it, | |
3782 | dnl with or without modifications, as long as this notice is preserved. | |
3783 | ||
3784 | dnl From Bruno Haible. | |
3785 | ||
3786 | dnl gl_THREADLIB | |
3787 | dnl ------------ | |
3788 | dnl Tests for a multithreading library to be used. | |
3789 | dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO | |
3790 | dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the | |
3791 | dnl default is 'no', otherwise it is system dependent. In both cases, the user | |
3792 | dnl can change the choice through the options --enable-threads=choice or | |
3793 | dnl --disable-threads. | |
3794 | dnl Defines at most one of the macros USE_POSIX_THREADS, USE_SOLARIS_THREADS, | |
3795 | dnl USE_PTH_THREADS, USE_WINDOWS_THREADS | |
3796 | dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use | |
3797 | dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with | |
3798 | dnl libtool). | |
3799 | dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for | |
3800 | dnl programs that really need multithread functionality. The difference | |
3801 | dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak | |
3802 | dnl symbols, typically LIBTHREAD="" whereas LIBMULTITHREAD="-lpthread". | |
3803 | dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for | |
3804 | dnl multithread-safe programs. | |
3805 | ||
3806 | AC_DEFUN([gl_THREADLIB_EARLY], | |
3807 | [ | |
3808 | AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) | |
3809 | ]) | |
3810 | ||
3811 | dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once. | |
3812 | ||
3813 | AC_DEFUN([gl_THREADLIB_EARLY_BODY], | |
3814 | [ | |
3815 | dnl Ordering constraints: This macro modifies CPPFLAGS in a way that | |
3816 | dnl influences the result of the autoconf tests that test for *_unlocked | |
3817 | dnl declarations, on AIX 5 at least. Therefore it must come early. | |
3818 | AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl | |
3819 | AC_BEFORE([$0], [gl_ARGP])dnl | |
3820 | ||
3821 | AC_REQUIRE([AC_CANONICAL_HOST]) | |
3822 | dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. | |
3823 | dnl AC_USE_SYSTEM_EXTENSIONS was introduced in autoconf 2.60 and obsoletes | |
3824 | dnl AC_GNU_SOURCE. | |
3825 | m4_ifdef([AC_USE_SYSTEM_EXTENSIONS], | |
3826 | [AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])], | |
3827 | [AC_REQUIRE([AC_GNU_SOURCE])]) | |
3828 | dnl Check for multithreading. | |
3829 | m4_ifdef([gl_THREADLIB_DEFAULT_NO], | |
3830 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], | |
3831 | [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) | |
3832 | AC_ARG_ENABLE([threads], | |
3833 | AC_HELP_STRING([--enable-threads={posix|solaris|pth|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ | |
3834 | AC_HELP_STRING([--disable-threads], [build without multithread safety])]), | |
3835 | [gl_use_threads=$enableval], | |
3836 | [if test -n "$gl_use_threads_default"; then | |
3837 | gl_use_threads="$gl_use_threads_default" | |
3838 | else | |
3839 | changequote(,)dnl | |
3840 | case "$host_os" in | |
3841 | dnl Disable multithreading by default on OSF/1, because it interferes | |
3842 | dnl with fork()/exec(): When msgexec is linked with -lpthread, its | |
3843 | dnl child process gets an endless segmentation fault inside execvp(). | |
3844 | dnl Disable multithreading by default on Cygwin 1.5.x, because it has | |
3845 | dnl bugs that lead to endless loops or crashes. See | |
3846 | dnl <http://cygwin.com/ml/cygwin/2009-08/msg00283.html>. | |
3847 | osf*) gl_use_threads=no ;; | |
3848 | cygwin*) | |
3849 | case `uname -r` in | |
3850 | 1.[0-5].*) gl_use_threads=no ;; | |
3851 | *) gl_use_threads=yes ;; | |
3852 | esac | |
3853 | ;; | |
3854 | *) gl_use_threads=yes ;; | |
3855 | esac | |
3856 | changequote([,])dnl | |
3857 | fi | |
3858 | ]) | |
3859 | if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then | |
3860 | # For using <pthread.h>: | |
3861 | case "$host_os" in | |
3862 | osf*) | |
3863 | # On OSF/1, the compiler needs the flag -D_REENTRANT so that it | |
3864 | # groks <pthread.h>. cc also understands the flag -pthread, but | |
3865 | # we don't use it because 1. gcc-2.95 doesn't understand -pthread, | |
3866 | # 2. putting a flag into CPPFLAGS that has an effect on the linker | |
3867 | # causes the AC_LINK_IFELSE test below to succeed unexpectedly, | |
3868 | # leading to wrong values of LIBTHREAD and LTLIBTHREAD. | |
3869 | CPPFLAGS="$CPPFLAGS -D_REENTRANT" | |
3870 | ;; | |
3871 | esac | |
3872 | # Some systems optimize for single-threaded programs by default, and | |
3873 | # need special flags to disable these optimizations. For example, the | |
3874 | # definition of 'errno' in <errno.h>. | |
3875 | case "$host_os" in | |
3876 | aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; | |
3877 | solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; | |
3878 | esac | |
3879 | fi | |
3880 | ]) | |
3881 | ||
3882 | dnl The guts of gl_THREADLIB. Needs to be expanded only once. | |
3883 | ||
3884 | AC_DEFUN([gl_THREADLIB_BODY], | |
3885 | [ | |
3886 | AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) | |
3887 | gl_threads_api=none | |
3888 | LIBTHREAD= | |
3889 | LTLIBTHREAD= | |
3890 | LIBMULTITHREAD= | |
3891 | LTLIBMULTITHREAD= | |
3892 | if test "$gl_use_threads" != no; then | |
3893 | dnl Check whether the compiler and linker support weak declarations. | |
3894 | AC_CACHE_CHECK([whether imported symbols can be declared weak], | |
3895 | [gl_cv_have_weak], | |
3896 | [gl_cv_have_weak=no | |
3897 | dnl First, test whether the compiler accepts it syntactically. | |
3898 | AC_LINK_IFELSE( | |
3899 | [AC_LANG_PROGRAM( | |
3900 | [[extern void xyzzy (); | |
3901 | #pragma weak xyzzy]], | |
3902 | [[xyzzy();]])], | |
3903 | [gl_cv_have_weak=maybe]) | |
3904 | if test $gl_cv_have_weak = maybe; then | |
3905 | dnl Second, test whether it actually works. On Cygwin 1.7.2, with | |
3906 | dnl gcc 4.3, symbols declared weak always evaluate to the address 0. | |
3907 | AC_RUN_IFELSE( | |
3908 | [AC_LANG_SOURCE([[ | |
3909 | #include <stdio.h> | |
3910 | #pragma weak fputs | |
3911 | int main () | |
3912 | { | |
3913 | return (fputs == NULL); | |
3914 | }]])], | |
3915 | [gl_cv_have_weak=yes], | |
3916 | [gl_cv_have_weak=no], | |
3917 | [dnl When cross-compiling, assume that only ELF platforms support | |
3918 | dnl weak symbols. | |
3919 | AC_EGREP_CPP([Extensible Linking Format], | |
3920 | [#ifdef __ELF__ | |
3921 | Extensible Linking Format | |
3922 | #endif | |
3923 | ], | |
3924 | [gl_cv_have_weak="guessing yes"], | |
3925 | [gl_cv_have_weak="guessing no"]) | |
3926 | ]) | |
3927 | fi | |
3928 | ]) | |
3929 | if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then | |
3930 | # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that | |
3931 | # it groks <pthread.h>. It's added above, in gl_THREADLIB_EARLY_BODY. | |
3932 | AC_CHECK_HEADER([pthread.h], | |
3933 | [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) | |
3934 | if test "$gl_have_pthread_h" = yes; then | |
3935 | # Other possible tests: | |
3936 | # -lpthreads (FSU threads, PCthreads) | |
3937 | # -lgthreads | |
3938 | gl_have_pthread= | |
3939 | # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist | |
3940 | # in libc. IRIX 6.5 has the first one in both libc and libpthread, but | |
3941 | # the second one only in libpthread, and lock.c needs it. | |
3942 | AC_LINK_IFELSE( | |
3943 | [AC_LANG_PROGRAM( | |
3944 | [[#include <pthread.h>]], | |
3945 | [[pthread_mutex_lock((pthread_mutex_t*)0); | |
3946 | pthread_mutexattr_init((pthread_mutexattr_t*)0);]])], | |
3947 | [gl_have_pthread=yes]) | |
3948 | # Test for libpthread by looking for pthread_kill. (Not pthread_self, | |
3949 | # since it is defined as a macro on OSF/1.) | |
3950 | if test -n "$gl_have_pthread"; then | |
3951 | # The program links fine without libpthread. But it may actually | |
3952 | # need to link with libpthread in order to create multiple threads. | |
3953 | AC_CHECK_LIB([pthread], [pthread_kill], | |
3954 | [LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread | |
3955 | # On Solaris and HP-UX, most pthread functions exist also in libc. | |
3956 | # Therefore pthread_in_use() needs to actually try to create a | |
3957 | # thread: pthread_create from libc will fail, whereas | |
3958 | # pthread_create will actually create a thread. | |
3959 | case "$host_os" in | |
3960 | solaris* | hpux*) | |
3961 | AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], | |
3962 | [Define if the pthread_in_use() detection is hard.]) | |
3963 | esac | |
3964 | ]) | |
3965 | else | |
3966 | # Some library is needed. Try libpthread and libc_r. | |
3967 | AC_CHECK_LIB([pthread], [pthread_kill], | |
3968 | [gl_have_pthread=yes | |
3969 | LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread | |
3970 | LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread]) | |
3971 | if test -z "$gl_have_pthread"; then | |
3972 | # For FreeBSD 4. | |
3973 | AC_CHECK_LIB([c_r], [pthread_kill], | |
3974 | [gl_have_pthread=yes | |
3975 | LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r | |
3976 | LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r]) | |
3977 | fi | |
3978 | fi | |
3979 | if test -n "$gl_have_pthread"; then | |
3980 | gl_threads_api=posix | |
3981 | AC_DEFINE([USE_POSIX_THREADS], [1], | |
3982 | [Define if the POSIX multithreading library can be used.]) | |
3983 | if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then | |
3984 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | |
3985 | AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], | |
3986 | [Define if references to the POSIX multithreading library should be made weak.]) | |
3987 | LIBTHREAD= | |
3988 | LTLIBTHREAD= | |
3989 | fi | |
3990 | fi | |
3991 | fi | |
3992 | fi | |
3993 | fi | |
3994 | if test -z "$gl_have_pthread"; then | |
3995 | if test "$gl_use_threads" = yes || test "$gl_use_threads" = solaris; then | |
3996 | gl_have_solaristhread= | |
3997 | gl_save_LIBS="$LIBS" | |
3998 | LIBS="$LIBS -lthread" | |
3999 | AC_LINK_IFELSE( | |
4000 | [AC_LANG_PROGRAM( | |
4001 | [[ | |
4002 | #include <thread.h> | |
4003 | #include <synch.h> | |
4004 | ]], | |
4005 | [[thr_self();]])], | |
4006 | [gl_have_solaristhread=yes]) | |
4007 | LIBS="$gl_save_LIBS" | |
4008 | if test -n "$gl_have_solaristhread"; then | |
4009 | gl_threads_api=solaris | |
4010 | LIBTHREAD=-lthread | |
4011 | LTLIBTHREAD=-lthread | |
4012 | LIBMULTITHREAD="$LIBTHREAD" | |
4013 | LTLIBMULTITHREAD="$LTLIBTHREAD" | |
4014 | AC_DEFINE([USE_SOLARIS_THREADS], [1], | |
4015 | [Define if the old Solaris multithreading library can be used.]) | |
4016 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | |
4017 | AC_DEFINE([USE_SOLARIS_THREADS_WEAK], [1], | |
4018 | [Define if references to the old Solaris multithreading library should be made weak.]) | |
4019 | LIBTHREAD= | |
4020 | LTLIBTHREAD= | |
4021 | fi | |
4022 | fi | |
4023 | fi | |
4024 | fi | |
4025 | if test "$gl_use_threads" = pth; then | |
4026 | gl_save_CPPFLAGS="$CPPFLAGS" | |
4027 | AC_LIB_LINKFLAGS([pth]) | |
4028 | gl_have_pth= | |
4029 | gl_save_LIBS="$LIBS" | |
4030 | LIBS="$LIBS $LIBPTH" | |
4031 | AC_LINK_IFELSE( | |
4032 | [AC_LANG_PROGRAM([[#include <pth.h>]], [[pth_self();]])], | |
4033 | [gl_have_pth=yes]) | |
4034 | LIBS="$gl_save_LIBS" | |
4035 | if test -n "$gl_have_pth"; then | |
4036 | gl_threads_api=pth | |
4037 | LIBTHREAD="$LIBPTH" | |
4038 | LTLIBTHREAD="$LTLIBPTH" | |
4039 | LIBMULTITHREAD="$LIBTHREAD" | |
4040 | LTLIBMULTITHREAD="$LTLIBTHREAD" | |
4041 | AC_DEFINE([USE_PTH_THREADS], [1], | |
4042 | [Define if the GNU Pth multithreading library can be used.]) | |
4043 | if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then | |
4044 | if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then | |
4045 | AC_DEFINE([USE_PTH_THREADS_WEAK], [1], | |
4046 | [Define if references to the GNU Pth multithreading library should be made weak.]) | |
4047 | LIBTHREAD= | |
4048 | LTLIBTHREAD= | |
4049 | fi | |
4050 | fi | |
4051 | else | |
4052 | CPPFLAGS="$gl_save_CPPFLAGS" | |
4053 | fi | |
4054 | fi | |
4055 | if test -z "$gl_have_pthread"; then | |
4056 | case "$gl_use_threads" in | |
4057 | yes | windows | win32) # The 'win32' is for backward compatibility. | |
4058 | if { case "$host_os" in | |
4059 | mingw*) true;; | |
4060 | *) false;; | |
4061 | esac | |
4062 | }; then | |
4063 | gl_threads_api=windows | |
4064 | AC_DEFINE([USE_WINDOWS_THREADS], [1], | |
4065 | [Define if the native Windows multithreading API can be used.]) | |
4066 | fi | |
4067 | ;; | |
4068 | esac | |
4069 | fi | |
4070 | fi | |
4071 | AC_MSG_CHECKING([for multithread API to use]) | |
4072 | AC_MSG_RESULT([$gl_threads_api]) | |
4073 | AC_SUBST([LIBTHREAD]) | |
4074 | AC_SUBST([LTLIBTHREAD]) | |
4075 | AC_SUBST([LIBMULTITHREAD]) | |
4076 | AC_SUBST([LTLIBMULTITHREAD]) | |
4077 | ]) | |
4078 | ||
4079 | AC_DEFUN([gl_THREADLIB], | |
4080 | [ | |
4081 | AC_REQUIRE([gl_THREADLIB_EARLY]) | |
4082 | AC_REQUIRE([gl_THREADLIB_BODY]) | |
4083 | ]) | |
4084 | ||
4085 | ||
4086 | dnl gl_DISABLE_THREADS | |
4087 | dnl ------------------ | |
4088 | dnl Sets the gl_THREADLIB default so that threads are not used by default. | |
4089 | dnl The user can still override it at installation time, by using the | |
4090 | dnl configure option '--enable-threads'. | |
4091 | ||
4092 | AC_DEFUN([gl_DISABLE_THREADS], [ | |
4093 | m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) | |
4094 | ]) | |
4095 | ||
4096 | ||
4097 | dnl Survey of platforms: | |
4098 | dnl | |
4099 | dnl Platform Available Compiler Supports test-lock | |
4100 | dnl flavours option weak result | |
4101 | dnl --------------- --------- --------- -------- --------- | |
4102 | dnl Linux 2.4/glibc posix -lpthread Y OK | |
4103 | dnl | |
4104 | dnl GNU Hurd/glibc posix | |
4105 | dnl | |
4106 | dnl FreeBSD 5.3 posix -lc_r Y | |
4107 | dnl posix -lkse ? Y | |
4108 | dnl posix -lpthread ? Y | |
4109 | dnl posix -lthr Y | |
4110 | dnl | |
4111 | dnl FreeBSD 5.2 posix -lc_r Y | |
4112 | dnl posix -lkse Y | |
4113 | dnl posix -lthr Y | |
4114 | dnl | |
4115 | dnl FreeBSD 4.0,4.10 posix -lc_r Y OK | |
4116 | dnl | |
4117 | dnl NetBSD 1.6 -- | |
4118 | dnl | |
4119 | dnl OpenBSD 3.4 posix -lpthread Y OK | |
4120 | dnl | |
4121 | dnl Mac OS X 10.[123] posix -lpthread Y OK | |
4122 | dnl | |
4123 | dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK | |
4124 | dnl solaris -lthread Y Sol 7,8: 0.0; Sol 9: OK | |
4125 | dnl | |
4126 | dnl HP-UX 11 posix -lpthread N (cc) OK | |
4127 | dnl Y (gcc) | |
4128 | dnl | |
4129 | dnl IRIX 6.5 posix -lpthread Y 0.5 | |
4130 | dnl | |
4131 | dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK | |
4132 | dnl | |
4133 | dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK | |
4134 | dnl -lpthread (gcc) Y | |
4135 | dnl | |
4136 | dnl Cygwin posix -lpthread Y OK | |
4137 | dnl | |
4138 | dnl Any of the above pth -lpth 0.0 | |
4139 | dnl | |
4140 | dnl Mingw windows N OK | |
4141 | dnl | |
4142 | dnl BeOS 5 -- | |
4143 | dnl | |
4144 | dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is | |
4145 | dnl turned off: | |
4146 | dnl OK if all three tests terminate OK, | |
4147 | dnl 0.5 if the first test terminates OK but the second one loops endlessly, | |
4148 | dnl 0.0 if the first test already loops endlessly. | |
4149 | ||
4150 | # uintmax_t.m4 serial 12 | |
4151 | dnl Copyright (C) 1997-2004, 2007-2013 Free Software Foundation, Inc. | |
4152 | dnl This file is free software; the Free Software Foundation | |
4153 | dnl gives unlimited permission to copy and/or distribute it, | |
4154 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f TT |
4155 | |
4156 | dnl From Paul Eggert. | |
4157 | ||
93613951 | 4158 | AC_PREREQ([2.13]) |
a04eba3f | 4159 | |
b0cacab0 TT |
4160 | # Define uintmax_t to 'unsigned long' or 'unsigned long long' |
4161 | # if it is not already defined in <stdint.h> or <inttypes.h>. | |
a04eba3f | 4162 | |
93613951 | 4163 | AC_DEFUN([gl_AC_TYPE_UINTMAX_T], |
a04eba3f | 4164 | [ |
93613951 TT |
4165 | AC_REQUIRE([gl_AC_HEADER_INTTYPES_H]) |
4166 | AC_REQUIRE([gl_AC_HEADER_STDINT_H]) | |
4167 | if test $gl_cv_header_inttypes_h = no && test $gl_cv_header_stdint_h = no; then | |
4168 | AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) | |
4169 | test $ac_cv_type_unsigned_long_long_int = yes \ | |
a04eba3f TT |
4170 | && ac_type='unsigned long long' \ |
4171 | || ac_type='unsigned long' | |
93613951 | 4172 | AC_DEFINE_UNQUOTED([uintmax_t], [$ac_type], |
b0cacab0 TT |
4173 | [Define to unsigned long or unsigned long long |
4174 | if <stdint.h> and <inttypes.h> don't define.]) | |
4175 | else | |
93613951 | 4176 | AC_DEFINE([HAVE_UINTMAX_T], [1], |
b0cacab0 | 4177 | [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.]) |
a04eba3f TT |
4178 | fi |
4179 | ]) | |
a04eba3f | 4180 | |
93613951 TT |
4181 | # visibility.m4 serial 5 (gettext-0.18.2) |
4182 | dnl Copyright (C) 2005, 2008, 2010-2013 Free Software Foundation, Inc. | |
4183 | dnl This file is free software; the Free Software Foundation | |
4184 | dnl gives unlimited permission to copy and/or distribute it, | |
4185 | dnl with or without modifications, as long as this notice is preserved. | |
a04eba3f | 4186 | |
93613951 | 4187 | dnl From Bruno Haible. |
b0cacab0 | 4188 | |
93613951 TT |
4189 | dnl Tests whether the compiler supports the command-line option |
4190 | dnl -fvisibility=hidden and the function and variable attributes | |
4191 | dnl __attribute__((__visibility__("hidden"))) and | |
4192 | dnl __attribute__((__visibility__("default"))). | |
4193 | dnl Does *not* test for __visibility__("protected") - which has tricky | |
4194 | dnl semantics (see the 'vismain' test in glibc) and does not exist e.g. on | |
4195 | dnl Mac OS X. | |
4196 | dnl Does *not* test for __visibility__("internal") - which has processor | |
4197 | dnl dependent semantics. | |
4198 | dnl Does *not* test for #pragma GCC visibility push(hidden) - which is | |
4199 | dnl "really only recommended for legacy code". | |
4200 | dnl Set the variable CFLAG_VISIBILITY. | |
4201 | dnl Defines and sets the variable HAVE_VISIBILITY. | |
4202 | ||
4203 | AC_DEFUN([gl_VISIBILITY], | |
a04eba3f | 4204 | [ |
93613951 TT |
4205 | AC_REQUIRE([AC_PROG_CC]) |
4206 | CFLAG_VISIBILITY= | |
4207 | HAVE_VISIBILITY=0 | |
4208 | if test -n "$GCC"; then | |
4209 | dnl First, check whether -Werror can be added to the command line, or | |
4210 | dnl whether it leads to an error because of some other option that the | |
4211 | dnl user has put into $CC $CFLAGS $CPPFLAGS. | |
4212 | AC_MSG_CHECKING([whether the -Werror option is usable]) | |
4213 | AC_CACHE_VAL([gl_cv_cc_vis_werror], [ | |
4214 | gl_save_CFLAGS="$CFLAGS" | |
4215 | CFLAGS="$CFLAGS -Werror" | |
4216 | AC_COMPILE_IFELSE( | |
4217 | [AC_LANG_PROGRAM([[]], [[]])], | |
4218 | [gl_cv_cc_vis_werror=yes], | |
4219 | [gl_cv_cc_vis_werror=no]) | |
4220 | CFLAGS="$gl_save_CFLAGS"]) | |
4221 | AC_MSG_RESULT([$gl_cv_cc_vis_werror]) | |
4222 | dnl Now check whether visibility declarations are supported. | |
4223 | AC_MSG_CHECKING([for simple visibility declarations]) | |
4224 | AC_CACHE_VAL([gl_cv_cc_visibility], [ | |
4225 | gl_save_CFLAGS="$CFLAGS" | |
4226 | CFLAGS="$CFLAGS -fvisibility=hidden" | |
4227 | dnl We use the option -Werror and a function dummyfunc, because on some | |
4228 | dnl platforms (Cygwin 1.7) the use of -fvisibility triggers a warning | |
4229 | dnl "visibility attribute not supported in this configuration; ignored" | |
4230 | dnl at the first function definition in every compilation unit, and we | |
4231 | dnl don't want to use the option in this case. | |
4232 | if test $gl_cv_cc_vis_werror = yes; then | |
4233 | CFLAGS="$CFLAGS -Werror" | |
4234 | fi | |
4235 | AC_COMPILE_IFELSE( | |
4236 | [AC_LANG_PROGRAM( | |
4237 | [[extern __attribute__((__visibility__("hidden"))) int hiddenvar; | |
4238 | extern __attribute__((__visibility__("default"))) int exportedvar; | |
4239 | extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); | |
4240 | extern __attribute__((__visibility__("default"))) int exportedfunc (void); | |
4241 | void dummyfunc (void) {} | |
4242 | ]], | |
4243 | [[]])], | |
4244 | [gl_cv_cc_visibility=yes], | |
4245 | [gl_cv_cc_visibility=no]) | |
4246 | CFLAGS="$gl_save_CFLAGS"]) | |
4247 | AC_MSG_RESULT([$gl_cv_cc_visibility]) | |
4248 | if test $gl_cv_cc_visibility = yes; then | |
4249 | CFLAG_VISIBILITY="-fvisibility=hidden" | |
4250 | HAVE_VISIBILITY=1 | |
4251 | fi | |
a04eba3f | 4252 | fi |
93613951 TT |
4253 | AC_SUBST([CFLAG_VISIBILITY]) |
4254 | AC_SUBST([HAVE_VISIBILITY]) | |
4255 | AC_DEFINE_UNQUOTED([HAVE_VISIBILITY], [$HAVE_VISIBILITY], | |
4256 | [Define to 1 or 0, depending whether the compiler supports simple visibility declarations.]) | |
a04eba3f | 4257 | ]) |
93613951 TT |
4258 | |
4259 | # wchar_t.m4 serial 4 (gettext-0.18.2) | |
4260 | dnl Copyright (C) 2002-2003, 2008-2013 Free Software Foundation, Inc. | |
4261 | dnl This file is free software; the Free Software Foundation | |
4262 | dnl gives unlimited permission to copy and/or distribute it, | |
4263 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
4264 | |
4265 | dnl From Bruno Haible. | |
4266 | dnl Test whether <stddef.h> has the 'wchar_t' type. | |
4267 | dnl Prerequisite: AC_PROG_CC | |
4268 | ||
4269 | AC_DEFUN([gt_TYPE_WCHAR_T], | |
4270 | [ | |
93613951 TT |
4271 | AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], |
4272 | [AC_COMPILE_IFELSE( | |
4273 | [AC_LANG_PROGRAM( | |
4274 | [[#include <stddef.h> | |
4275 | wchar_t foo = (wchar_t)'\0';]], | |
4276 | [[]])], | |
4277 | [gt_cv_c_wchar_t=yes], | |
4278 | [gt_cv_c_wchar_t=no])]) | |
b0cacab0 | 4279 | if test $gt_cv_c_wchar_t = yes; then |
93613951 | 4280 | AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) |
b0cacab0 TT |
4281 | fi |
4282 | ]) | |
93613951 TT |
4283 | |
4284 | # wint_t.m4 serial 5 (gettext-0.18.2) | |
4285 | dnl Copyright (C) 2003, 2007-2013 Free Software Foundation, Inc. | |
4286 | dnl This file is free software; the Free Software Foundation | |
4287 | dnl gives unlimited permission to copy and/or distribute it, | |
4288 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
4289 | |
4290 | dnl From Bruno Haible. | |
4291 | dnl Test whether <wchar.h> has the 'wint_t' type. | |
4292 | dnl Prerequisite: AC_PROG_CC | |
4293 | ||
4294 | AC_DEFUN([gt_TYPE_WINT_T], | |
4295 | [ | |
93613951 TT |
4296 | AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], |
4297 | [AC_COMPILE_IFELSE( | |
4298 | [AC_LANG_PROGRAM( | |
4299 | [[ | |
4300 | /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before | |
4301 | <wchar.h>. | |
4302 | BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be included | |
4303 | before <wchar.h>. */ | |
4304 | #include <stddef.h> | |
4305 | #include <stdio.h> | |
4306 | #include <time.h> | |
4307 | #include <wchar.h> | |
4308 | wint_t foo = (wchar_t)'\0';]], | |
4309 | [[]])], | |
4310 | [gt_cv_c_wint_t=yes], | |
4311 | [gt_cv_c_wint_t=no])]) | |
b0cacab0 | 4312 | if test $gt_cv_c_wint_t = yes; then |
93613951 | 4313 | AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) |
b0cacab0 TT |
4314 | fi |
4315 | ]) | |
93613951 TT |
4316 | |
4317 | # xsize.m4 serial 5 | |
4318 | dnl Copyright (C) 2003-2004, 2008-2013 Free Software Foundation, Inc. | |
4319 | dnl This file is free software; the Free Software Foundation | |
4320 | dnl gives unlimited permission to copy and/or distribute it, | |
4321 | dnl with or without modifications, as long as this notice is preserved. | |
b0cacab0 TT |
4322 | |
4323 | AC_DEFUN([gl_XSIZE], | |
4324 | [ | |
4325 | dnl Prerequisites of lib/xsize.h. | |
4326 | AC_REQUIRE([gl_SIZE_MAX]) | |
93613951 | 4327 | AC_CHECK_HEADERS([stdint.h]) |
b0cacab0 | 4328 | ]) |
740837de | 4329 | |
9519cd56 | 4330 | m4_include([acinclude.m4]) |