]> git.ipfire.org Git - thirdparty/bash.git/blob - aclocal.m4
Imported from ../bash-4.0.tar.gz.
[thirdparty/bash.git] / aclocal.m4
1 dnl
2 dnl Bash specific tests
3 dnl
4 dnl Some derived from PDKSH 5.1.3 autoconf tests
5 dnl
6
7 AC_DEFUN(BASH_C_LONG_LONG,
8 [AC_CACHE_CHECK(for long long, ac_cv_c_long_long,
9 [if test "$GCC" = yes; then
10 ac_cv_c_long_long=yes
11 else
12 AC_TRY_RUN([
13 int
14 main()
15 {
16 long long foo = 0;
17 exit(sizeof(long long) < sizeof(long));
18 }
19 ], ac_cv_c_long_long=yes, ac_cv_c_long_long=no)
20 fi])
21 if test $ac_cv_c_long_long = yes; then
22 AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.])
23 fi
24 ])
25
26 dnl
27 dnl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX
28 dnl (< changed to <=) added.
29 dnl
30 AC_DEFUN(BASH_C_LONG_DOUBLE,
31 [AC_CACHE_CHECK(for long double, ac_cv_c_long_double,
32 [if test "$GCC" = yes; then
33 ac_cv_c_long_double=yes
34 else
35 AC_TRY_RUN([
36 int
37 main()
38 {
39 /* The Stardent Vistra knows sizeof(long double), but does not
40 support it. */
41 long double foo = 0.0;
42 /* On Ultrix 4.3 cc, long double is 4 and double is 8. */
43 /* On IRIX 5.3, the compiler converts long double to double with a warning,
44 but compiles this successfully. */
45 exit(sizeof(long double) <= sizeof(double));
46 }
47 ], ac_cv_c_long_double=yes, ac_cv_c_long_double=no)
48 fi])
49 if test $ac_cv_c_long_double = yes; then
50 AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.])
51 fi
52 ])
53
54 dnl
55 dnl Check for <inttypes.h>. This is separated out so that it can be
56 dnl AC_REQUIREd.
57 dnl
58 dnl BASH_HEADER_INTTYPES
59 AC_DEFUN(BASH_HEADER_INTTYPES,
60 [
61 AC_CHECK_HEADERS(inttypes.h)
62 ])
63
64 dnl
65 dnl check for typedef'd symbols in header files, but allow the caller to
66 dnl specify the include files to be checked in addition to the default
67 dnl
68 dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
69 AC_DEFUN(BASH_CHECK_TYPE,
70 [
71 AC_REQUIRE([AC_HEADER_STDC])dnl
72 AC_REQUIRE([BASH_HEADER_INTTYPES])
73 AC_MSG_CHECKING(for $1)
74 AC_CACHE_VAL(bash_cv_type_$1,
75 [AC_EGREP_CPP($1, [#include <sys/types.h>
76 #if STDC_HEADERS
77 #include <stdlib.h>
78 #include <stddef.h>
79 #endif
80 #if HAVE_INTTYPES_H
81 #include <inttypes.h>
82 #endif
83 $2
84 ], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
85 AC_MSG_RESULT($bash_cv_type_$1)
86 ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
87 AC_DEFINE($4)
88 fi])
89 if test $bash_cv_type_$1 = no; then
90 AC_DEFINE_UNQUOTED($1, $3)
91 fi
92 ])
93
94 dnl
95 dnl BASH_CHECK_DECL(FUNC)
96 dnl
97 dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like
98 dnl AC_CHECK_DECL
99 dnl
100 AC_DEFUN(BASH_CHECK_DECL,
101 [
102 AC_REQUIRE([AC_HEADER_STDC])
103 AC_REQUIRE([BASH_HEADER_INTTYPES])
104 AC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1,
105 [AC_TRY_LINK(
106 [
107 #if STDC_HEADERS
108 # include <stdlib.h>
109 #endif
110 #if HAVE_INTTYPES_H
111 # include <inttypes.h>
112 #endif
113 ],
114 [return !$1;],
115 bash_cv_decl_$1=yes, bash_cv_decl_$1=no)])
116 bash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
117 if test $bash_cv_decl_$1 = yes; then
118 AC_DEFINE_UNQUOTED($bash_tr_func, 1)
119 else
120 AC_DEFINE_UNQUOTED($bash_tr_func, 0)
121 fi
122 ])
123
124 AC_DEFUN(BASH_DECL_PRINTF,
125 [AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
126 AC_CACHE_VAL(bash_cv_printf_declared,
127 [AC_TRY_RUN([
128 #include <stdio.h>
129 #ifdef __STDC__
130 typedef int (*_bashfunc)(const char *, ...);
131 #else
132 typedef int (*_bashfunc)();
133 #endif
134 main()
135 {
136 _bashfunc pf;
137 pf = (_bashfunc) printf;
138 exit(pf == 0);
139 }
140 ], bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
141 [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
142 bash_cv_printf_declared=yes]
143 )])
144 AC_MSG_RESULT($bash_cv_printf_declared)
145 if test $bash_cv_printf_declared = yes; then
146 AC_DEFINE(PRINTF_DECLARED)
147 fi
148 ])
149
150 AC_DEFUN(BASH_DECL_SBRK,
151 [AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
152 AC_CACHE_VAL(bash_cv_sbrk_declared,
153 [AC_EGREP_HEADER(sbrk, unistd.h,
154 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
155 AC_MSG_RESULT($bash_cv_sbrk_declared)
156 if test $bash_cv_sbrk_declared = yes; then
157 AC_DEFINE(SBRK_DECLARED)
158 fi
159 ])
160
161 dnl
162 dnl Check for sys_siglist[] or _sys_siglist[]
163 dnl
164 AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
165 [AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
166 AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
167 [AC_TRY_COMPILE([
168 #include <sys/types.h>
169 #include <signal.h>
170 #ifdef HAVE_UNISTD_H
171 #include <unistd.h>
172 #endif], [ char *msg = _sys_siglist[2]; ],
173 bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no,
174 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
175 AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
176 if test $bash_cv_decl_under_sys_siglist = yes; then
177 AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
178 fi
179 ])
180
181 AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
182 [AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
183 AC_MSG_CHECKING([for _sys_siglist in system C library])
184 AC_CACHE_VAL(bash_cv_under_sys_siglist,
185 [AC_TRY_RUN([
186 #include <sys/types.h>
187 #include <signal.h>
188 #ifdef HAVE_UNISTD_H
189 #include <unistd.h>
190 #endif
191 #ifndef UNDER_SYS_SIGLIST_DECLARED
192 extern char *_sys_siglist[];
193 #endif
194 main()
195 {
196 char *msg = (char *)_sys_siglist[2];
197 exit(msg == 0);
198 }],
199 bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
200 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
201 bash_cv_under_sys_siglist=no])])
202 AC_MSG_RESULT($bash_cv_under_sys_siglist)
203 if test $bash_cv_under_sys_siglist = yes; then
204 AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
205 fi
206 ])
207
208 AC_DEFUN(BASH_SYS_SIGLIST,
209 [AC_REQUIRE([AC_DECL_SYS_SIGLIST])
210 AC_MSG_CHECKING([for sys_siglist in system C library])
211 AC_CACHE_VAL(bash_cv_sys_siglist,
212 [AC_TRY_RUN([
213 #include <sys/types.h>
214 #include <signal.h>
215 #ifdef HAVE_UNISTD_H
216 #include <unistd.h>
217 #endif
218 #if !HAVE_DECL_SYS_SIGLIST
219 extern char *sys_siglist[];
220 #endif
221 main()
222 {
223 char *msg = sys_siglist[2];
224 exit(msg == 0);
225 }],
226 bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
227 [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
228 bash_cv_sys_siglist=no])])
229 AC_MSG_RESULT($bash_cv_sys_siglist)
230 if test $bash_cv_sys_siglist = yes; then
231 AC_DEFINE(HAVE_SYS_SIGLIST)
232 fi
233 ])
234
235 dnl Check for the various permutations of sys_siglist and make sure we
236 dnl compile in siglist.o if they're not defined
237 AC_DEFUN(BASH_CHECK_SYS_SIGLIST, [
238 AC_REQUIRE([BASH_SYS_SIGLIST])
239 AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
240 AC_REQUIRE([BASH_FUNC_STRSIGNAL])
241 if test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then
242 SIGLIST_O=siglist.o
243 else
244 SIGLIST_O=
245 fi
246 AC_SUBST([SIGLIST_O])
247 ])
248
249 dnl Check for sys_errlist[] and sys_nerr, check for declaration
250 AC_DEFUN(BASH_SYS_ERRLIST,
251 [AC_MSG_CHECKING([for sys_errlist and sys_nerr])
252 AC_CACHE_VAL(bash_cv_sys_errlist,
253 [AC_TRY_LINK([#include <errno.h>],
254 [extern char *sys_errlist[];
255 extern int sys_nerr;
256 char *msg = sys_errlist[sys_nerr - 1];],
257 bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl
258 AC_MSG_RESULT($bash_cv_sys_errlist)
259 if test $bash_cv_sys_errlist = yes; then
260 AC_DEFINE(HAVE_SYS_ERRLIST)
261 fi
262 ])
263
264 dnl
265 dnl Check if dup2() does not clear the close on exec flag
266 dnl
267 AC_DEFUN(BASH_FUNC_DUP2_CLOEXEC_CHECK,
268 [AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
269 AC_CACHE_VAL(bash_cv_dup2_broken,
270 [AC_TRY_RUN([
271 #include <sys/types.h>
272 #include <fcntl.h>
273 main()
274 {
275 int fd1, fd2, fl;
276 fd1 = open("/dev/null", 2);
277 if (fcntl(fd1, 2, 1) < 0)
278 exit(1);
279 fd2 = dup2(fd1, 1);
280 if (fd2 < 0)
281 exit(2);
282 fl = fcntl(fd2, 1, 0);
283 /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
284 exit(fl != 1);
285 }
286 ], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
287 [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
288 bash_cv_dup2_broken=no])
289 ])
290 AC_MSG_RESULT($bash_cv_dup2_broken)
291 if test $bash_cv_dup2_broken = yes; then
292 AC_DEFINE(DUP2_BROKEN)
293 fi
294 ])
295
296 AC_DEFUN(BASH_FUNC_STRSIGNAL,
297 [AC_MSG_CHECKING([for the existence of strsignal])
298 AC_CACHE_VAL(bash_cv_have_strsignal,
299 [AC_TRY_LINK([#include <sys/types.h>
300 #include <signal.h>],
301 [char *s = (char *)strsignal(2);],
302 bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)])
303 AC_MSG_RESULT($bash_cv_have_strsignal)
304 if test $bash_cv_have_strsignal = yes; then
305 AC_DEFINE(HAVE_STRSIGNAL)
306 fi
307 ])
308
309 dnl Check to see if opendir will open non-directories (not a nice thing)
310 AC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
311 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
312 AC_MSG_CHECKING(if opendir() opens non-directories)
313 AC_CACHE_VAL(bash_cv_opendir_not_robust,
314 [AC_TRY_RUN([
315 #include <stdio.h>
316 #include <sys/types.h>
317 #include <fcntl.h>
318 #ifdef HAVE_UNISTD_H
319 # include <unistd.h>
320 #endif /* HAVE_UNISTD_H */
321 #if defined(HAVE_DIRENT_H)
322 # include <dirent.h>
323 #else
324 # define dirent direct
325 # ifdef HAVE_SYS_NDIR_H
326 # include <sys/ndir.h>
327 # endif /* SYSNDIR */
328 # ifdef HAVE_SYS_DIR_H
329 # include <sys/dir.h>
330 # endif /* SYSDIR */
331 # ifdef HAVE_NDIR_H
332 # include <ndir.h>
333 # endif
334 #endif /* HAVE_DIRENT_H */
335 main()
336 {
337 DIR *dir;
338 int fd, err;
339 err = mkdir("bash-aclocal", 0700);
340 if (err < 0) {
341 perror("mkdir");
342 exit(1);
343 }
344 unlink("bash-aclocal/not_a_directory");
345 fd = open("bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
346 write(fd, "\n", 1);
347 close(fd);
348 dir = opendir("bash-aclocal/not_a_directory");
349 unlink("bash-aclocal/not_a_directory");
350 rmdir("bash-aclocal");
351 exit (dir == 0);
352 }], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
353 [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
354 bash_cv_opendir_not_robust=no]
355 )])
356 AC_MSG_RESULT($bash_cv_opendir_not_robust)
357 if test $bash_cv_opendir_not_robust = yes; then
358 AC_DEFINE(OPENDIR_NOT_ROBUST)
359 fi
360 ])
361
362 dnl
363 AC_DEFUN(BASH_TYPE_SIGHANDLER,
364 [AC_MSG_CHECKING([whether signal handlers are of type void])
365 AC_CACHE_VAL(bash_cv_void_sighandler,
366 [AC_TRY_COMPILE([#include <sys/types.h>
367 #include <signal.h>
368 #ifdef signal
369 #undef signal
370 #endif
371 #ifdef __cplusplus
372 extern "C"
373 #endif
374 void (*signal ()) ();],
375 [int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl
376 AC_MSG_RESULT($bash_cv_void_sighandler)
377 if test $bash_cv_void_sighandler = yes; then
378 AC_DEFINE(VOID_SIGHANDLER)
379 fi
380 ])
381
382 dnl
383 dnl A signed 16-bit integer quantity
384 dnl
385 AC_DEFUN(BASH_TYPE_BITS16_T,
386 [
387 if test "$ac_cv_sizeof_short" = 2; then
388 AC_CHECK_TYPE(bits16_t, short)
389 elif test "$ac_cv_sizeof_char" = 2; then
390 AC_CHECK_TYPE(bits16_t, char)
391 else
392 AC_CHECK_TYPE(bits16_t, short)
393 fi
394 ])
395
396 dnl
397 dnl An unsigned 16-bit integer quantity
398 dnl
399 AC_DEFUN(BASH_TYPE_U_BITS16_T,
400 [
401 if test "$ac_cv_sizeof_short" = 2; then
402 AC_CHECK_TYPE(u_bits16_t, unsigned short)
403 elif test "$ac_cv_sizeof_char" = 2; then
404 AC_CHECK_TYPE(u_bits16_t, unsigned char)
405 else
406 AC_CHECK_TYPE(u_bits16_t, unsigned short)
407 fi
408 ])
409
410 dnl
411 dnl A signed 32-bit integer quantity
412 dnl
413 AC_DEFUN(BASH_TYPE_BITS32_T,
414 [
415 if test "$ac_cv_sizeof_int" = 4; then
416 AC_CHECK_TYPE(bits32_t, int)
417 elif test "$ac_cv_sizeof_long" = 4; then
418 AC_CHECK_TYPE(bits32_t, long)
419 else
420 AC_CHECK_TYPE(bits32_t, int)
421 fi
422 ])
423
424 dnl
425 dnl An unsigned 32-bit integer quantity
426 dnl
427 AC_DEFUN(BASH_TYPE_U_BITS32_T,
428 [
429 if test "$ac_cv_sizeof_int" = 4; then
430 AC_CHECK_TYPE(u_bits32_t, unsigned int)
431 elif test "$ac_cv_sizeof_long" = 4; then
432 AC_CHECK_TYPE(u_bits32_t, unsigned long)
433 else
434 AC_CHECK_TYPE(u_bits32_t, unsigned int)
435 fi
436 ])
437
438 AC_DEFUN(BASH_TYPE_PTRDIFF_T,
439 [
440 if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
441 AC_CHECK_TYPE(ptrdiff_t, int)
442 elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
443 AC_CHECK_TYPE(ptrdiff_t, long)
444 elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then
445 AC_CHECK_TYPE(ptrdiff_t, [long long])
446 else
447 AC_CHECK_TYPE(ptrdiff_t, int)
448 fi
449 ])
450
451 dnl
452 dnl A signed 64-bit quantity
453 dnl
454 AC_DEFUN(BASH_TYPE_BITS64_T,
455 [
456 if test "$ac_cv_sizeof_char_p" = 8; then
457 AC_CHECK_TYPE(bits64_t, char *)
458 elif test "$ac_cv_sizeof_double" = 8; then
459 AC_CHECK_TYPE(bits64_t, double)
460 elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then
461 AC_CHECK_TYPE(bits64_t, [long long])
462 elif test "$ac_cv_sizeof_long" = 8; then
463 AC_CHECK_TYPE(bits64_t, long)
464 else
465 AC_CHECK_TYPE(bits64_t, double)
466 fi
467 ])
468
469 AC_DEFUN(BASH_TYPE_LONG_LONG,
470 [
471 AC_CACHE_CHECK([for long long], bash_cv_type_long_long,
472 [AC_TRY_LINK([
473 long long ll = 1; int i = 63;],
474 [
475 long long llm = (long long) -1;
476 return ll << i | ll >> i | llm / ll | llm % ll;
477 ], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')])
478 if test "$bash_cv_type_long_long" = 'long long'; then
479 AC_DEFINE(HAVE_LONG_LONG, 1)
480 fi
481 ])
482
483 AC_DEFUN(BASH_TYPE_UNSIGNED_LONG_LONG,
484 [
485 AC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long,
486 [AC_TRY_LINK([
487 unsigned long long ull = 1; int i = 63;],
488 [
489 unsigned long long ullmax = (unsigned long long) -1;
490 return ull << i | ull >> i | ullmax / ull | ullmax % ull;
491 ], bash_cv_type_unsigned_long_long='unsigned long long',
492 bash_cv_type_unsigned_long_long='unsigned long')])
493 if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then
494 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1)
495 fi
496 ])
497
498 dnl
499 dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0)
500 dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use
501 dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify
502 dnl matters, this just checks for rlim_t, quad_t, or long.
503 dnl
504 AC_DEFUN(BASH_TYPE_RLIMIT,
505 [AC_MSG_CHECKING(for size and type of struct rlimit fields)
506 AC_CACHE_VAL(bash_cv_type_rlimit,
507 [AC_TRY_COMPILE([#include <sys/types.h>
508 #include <sys/resource.h>],
509 [rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[
510 AC_TRY_RUN([
511 #include <sys/types.h>
512 #include <sys/time.h>
513 #include <sys/resource.h>
514 main()
515 {
516 #ifdef HAVE_QUAD_T
517 struct rlimit rl;
518 if (sizeof(rl.rlim_cur) == sizeof(quad_t))
519 exit(0);
520 #endif
521 exit(1);
522 }], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
523 [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long)
524 bash_cv_type_rlimit=long])])
525 ])
526 AC_MSG_RESULT($bash_cv_type_rlimit)
527 if test $bash_cv_type_rlimit = quad_t; then
528 AC_DEFINE(RLIMTYPE, quad_t)
529 elif test $bash_cv_type_rlimit = rlim_t; then
530 AC_DEFINE(RLIMTYPE, rlim_t)
531 fi
532 ])
533
534 AC_DEFUN(BASH_TYPE_SIG_ATOMIC_T,
535 [AC_CACHE_CHECK([for sig_atomic_t in signal.h], ac_cv_have_sig_atomic_t,
536 [AC_TRY_LINK([
537 #include <signal.h>
538 ],[ sig_atomic_t x; ],
539 ac_cv_have_sig_atomic_t=yes, ac_cv_have_sig_atomic_t=no)])
540 if test "$ac_cv_have_sig_atomic_t" = "no"
541 then
542 AC_CHECK_TYPE(sig_atomic_t,int)
543 fi
544 ])
545
546 AC_DEFUN(BASH_FUNC_LSTAT,
547 [dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
548 dnl inline function in <sys/stat.h>.
549 AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
550 [AC_TRY_LINK([
551 #include <sys/types.h>
552 #include <sys/stat.h>
553 ],[ lstat(".",(struct stat *)0); ],
554 bash_cv_func_lstat=yes, bash_cv_func_lstat=no)])
555 if test $bash_cv_func_lstat = yes; then
556 AC_DEFINE(HAVE_LSTAT)
557 fi
558 ])
559
560 AC_DEFUN(BASH_FUNC_INET_ATON,
561 [
562 AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
563 [AC_TRY_LINK([
564 #include <sys/types.h>
565 #include <netinet/in.h>
566 #include <arpa/inet.h>
567 struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ],
568 bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)])
569 if test $bash_cv_func_inet_aton = yes; then
570 AC_DEFINE(HAVE_INET_ATON)
571 else
572 AC_LIBOBJ(inet_aton)
573 fi
574 ])
575
576 AC_DEFUN(BASH_FUNC_GETENV,
577 [AC_MSG_CHECKING(to see if getenv can be redefined)
578 AC_CACHE_VAL(bash_cv_getenv_redef,
579 [AC_TRY_RUN([
580 #ifdef HAVE_UNISTD_H
581 # include <unistd.h>
582 #endif
583 #ifndef __STDC__
584 # ifndef const
585 # define const
586 # endif
587 #endif
588 char *
589 getenv (name)
590 #if defined (__linux__) || defined (__bsdi__) || defined (convex)
591 const char *name;
592 #else
593 char const *name;
594 #endif /* !__linux__ && !__bsdi__ && !convex */
595 {
596 return "42";
597 }
598 main()
599 {
600 char *s;
601 /* The next allows this program to run, but does not allow bash to link
602 when it redefines getenv. I'm not really interested in figuring out
603 why not. */
604 #if defined (NeXT)
605 exit(1);
606 #endif
607 s = getenv("ABCDE");
608 exit(s == 0); /* force optimizer to leave getenv in */
609 }
610 ], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
611 [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
612 bash_cv_getenv_redef=yes]
613 )])
614 AC_MSG_RESULT($bash_cv_getenv_redef)
615 if test $bash_cv_getenv_redef = yes; then
616 AC_DEFINE(CAN_REDEFINE_GETENV)
617 fi
618 ])
619
620 # We should check for putenv before calling this
621 AC_DEFUN(BASH_FUNC_STD_PUTENV,
622 [
623 AC_REQUIRE([AC_HEADER_STDC])
624 AC_REQUIRE([AC_C_PROTOTYPES])
625 AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
626 [AC_TRY_LINK([
627 #if STDC_HEADERS
628 #include <stdlib.h>
629 #include <stddef.h>
630 #endif
631 #ifndef __STDC__
632 # ifndef const
633 # define const
634 # endif
635 #endif
636 #ifdef PROTOTYPES
637 extern int putenv (char *);
638 #else
639 extern int putenv ();
640 #endif
641 ],
642 [return (putenv == 0);],
643 bash_cv_std_putenv=yes, bash_cv_std_putenv=no
644 )])
645 if test $bash_cv_std_putenv = yes; then
646 AC_DEFINE(HAVE_STD_PUTENV)
647 fi
648 ])
649
650 # We should check for unsetenv before calling this
651 AC_DEFUN(BASH_FUNC_STD_UNSETENV,
652 [
653 AC_REQUIRE([AC_HEADER_STDC])
654 AC_REQUIRE([AC_C_PROTOTYPES])
655 AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
656 [AC_TRY_LINK([
657 #if STDC_HEADERS
658 #include <stdlib.h>
659 #include <stddef.h>
660 #endif
661 #ifndef __STDC__
662 # ifndef const
663 # define const
664 # endif
665 #endif
666 #ifdef PROTOTYPES
667 extern int unsetenv (const char *);
668 #else
669 extern int unsetenv ();
670 #endif
671 ],
672 [return (unsetenv == 0);],
673 bash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no
674 )])
675 if test $bash_cv_std_unsetenv = yes; then
676 AC_DEFINE(HAVE_STD_UNSETENV)
677 fi
678 ])
679
680 AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
681 [AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
682 AC_CACHE_VAL(bash_cv_ulimit_maxfds,
683 [AC_TRY_RUN([
684 main()
685 {
686 long maxfds = ulimit(4, 0L);
687 exit (maxfds == -1L);
688 }
689 ], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
690 [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
691 bash_cv_ulimit_maxfds=no]
692 )])
693 AC_MSG_RESULT($bash_cv_ulimit_maxfds)
694 if test $bash_cv_ulimit_maxfds = yes; then
695 AC_DEFINE(ULIMIT_MAXFDS)
696 fi
697 ])
698
699 AC_DEFUN(BASH_FUNC_GETCWD,
700 [AC_MSG_CHECKING([if getcwd() will dynamically allocate memory with 0 size])
701 AC_CACHE_VAL(bash_cv_getcwd_malloc,
702 [AC_TRY_RUN([
703 #include <stdio.h>
704 #ifdef HAVE_UNISTD_H
705 #include <unistd.h>
706 #endif
707
708 main()
709 {
710 char *xpwd;
711 xpwd = getcwd(0, 0);
712 exit (xpwd == 0);
713 }
714 ], bash_cv_getcwd_malloc=yes, bash_cv_getcwd_malloc=no,
715 [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
716 bash_cv_getcwd_malloc=no]
717 )])
718 AC_MSG_RESULT($bash_cv_getcwd_malloc)
719 if test $bash_cv_getcwd_malloc = no; then
720 AC_DEFINE(GETCWD_BROKEN)
721 AC_LIBOBJ(getcwd)
722 fi
723 ])
724
725 dnl
726 dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
727 dnl system, we can't use AC_PREREQ
728 dnl
729 AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
730 [if test "X$bash_cv_have_gethostbyname" = "X"; then
731 _bash_needmsg=yes
732 else
733 AC_MSG_CHECKING(for gethostbyname in socket library)
734 _bash_needmsg=
735 fi
736 AC_CACHE_VAL(bash_cv_have_gethostbyname,
737 [AC_TRY_LINK([#include <netdb.h>],
738 [ struct hostent *hp;
739 hp = gethostbyname("localhost");
740 ], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
741 )
742 if test "X$_bash_needmsg" = Xyes; then
743 AC_MSG_CHECKING(for gethostbyname in socket library)
744 fi
745 AC_MSG_RESULT($bash_cv_have_gethostbyname)
746 if test "$bash_cv_have_gethostbyname" = yes; then
747 AC_DEFINE(HAVE_GETHOSTBYNAME)
748 fi
749 ])
750
751 AC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH,
752 [AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
753 AC_CACHE_VAL(bash_cv_fnm_extmatch,
754 [AC_TRY_RUN([
755 #include <fnmatch.h>
756
757 main()
758 {
759 #ifdef FNM_EXTMATCH
760 exit (0);
761 #else
762 exit (1);
763 #endif
764 }
765 ], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
766 [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
767 bash_cv_fnm_extmatch=no])
768 ])
769 AC_MSG_RESULT($bash_cv_fnm_extmatch)
770 if test $bash_cv_fnm_extmatch = yes; then
771 AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
772 fi
773 ])
774
775 AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
776 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
777 AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
778 AC_CACHE_VAL(bash_cv_func_sigsetjmp,
779 [AC_TRY_RUN([
780 #ifdef HAVE_UNISTD_H
781 #include <unistd.h>
782 #endif
783 #include <sys/types.h>
784 #include <signal.h>
785 #include <setjmp.h>
786
787 main()
788 {
789 #if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
790 exit (1);
791 #else
792
793 int code;
794 sigset_t set, oset;
795 sigjmp_buf xx;
796
797 /* get the mask */
798 sigemptyset(&set);
799 sigemptyset(&oset);
800 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
801 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
802
803 /* save it */
804 code = sigsetjmp(xx, 1);
805 if (code)
806 exit(0); /* could get sigmask and compare to oset here. */
807
808 /* change it */
809 sigaddset(&set, SIGINT);
810 sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
811
812 /* and siglongjmp */
813 siglongjmp(xx, 10);
814 exit(1);
815 #endif
816 }], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
817 [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
818 bash_cv_func_sigsetjmp=missing]
819 )])
820 AC_MSG_RESULT($bash_cv_func_sigsetjmp)
821 if test $bash_cv_func_sigsetjmp = present; then
822 AC_DEFINE(HAVE_POSIX_SIGSETJMP)
823 fi
824 ])
825
826 AC_DEFUN(BASH_FUNC_STRCOLL,
827 [
828 AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
829 AC_CACHE_VAL(bash_cv_func_strcoll_broken,
830 [AC_TRY_RUN([
831 #include <stdio.h>
832 #if defined (HAVE_LOCALE_H)
833 #include <locale.h>
834 #endif
835
836 main(c, v)
837 int c;
838 char *v[];
839 {
840 int r1, r2;
841 char *deflocale, *defcoll;
842
843 #ifdef HAVE_SETLOCALE
844 deflocale = setlocale(LC_ALL, "");
845 defcoll = setlocale(LC_COLLATE, "");
846 #endif
847
848 #ifdef HAVE_STRCOLL
849 /* These two values are taken from tests/glob-test. */
850 r1 = strcoll("abd", "aXd");
851 #else
852 r1 = 0;
853 #endif
854 r2 = strcmp("abd", "aXd");
855
856 /* These two should both be greater than 0. It is permissible for
857 a system to return different values, as long as the sign is the
858 same. */
859
860 /* Exit with 1 (failure) if these two values are both > 0, since
861 this tests whether strcoll(3) is broken with respect to strcmp(3)
862 in the default locale. */
863 exit (r1 > 0 && r2 > 0);
864 }
865 ], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
866 [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
867 bash_cv_func_strcoll_broken=no]
868 )])
869 AC_MSG_RESULT($bash_cv_func_strcoll_broken)
870 if test $bash_cv_func_strcoll_broken = yes; then
871 AC_DEFINE(STRCOLL_BROKEN)
872 fi
873 ])
874
875 AC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT,
876 [AC_MSG_CHECKING([for printf floating point output in hex notation])
877 AC_CACHE_VAL(bash_cv_printf_a_format,
878 [AC_TRY_RUN([
879 #include <stdio.h>
880 #include <string.h>
881
882 int
883 main()
884 {
885 double y = 0.0;
886 char abuf[1024];
887
888 sprintf(abuf, "%A", y);
889 exit(strchr(abuf, 'P') == (char *)0);
890 }
891 ], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no,
892 [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
893 bash_cv_printf_a_format=no]
894 )])
895 AC_MSG_RESULT($bash_cv_printf_a_format)
896 if test $bash_cv_printf_a_format = yes; then
897 AC_DEFINE(HAVE_PRINTF_A_FORMAT)
898 fi
899 ])
900
901 AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
902 [
903 AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
904 #include <sys/types.h>
905 #include <termios.h>
906 ])
907 ])
908
909 AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
910 [
911 AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
912 #include <sys/types.h>
913 #include <termio.h>
914 ])
915 ])
916
917 dnl
918 dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
919 dnl
920 dnl sets bash_cv_struct_stat_st_blocks
921 dnl
922 dnl unused for now; we'll see how AC_CHECK_MEMBERS works
923 dnl
924 AC_DEFUN(BASH_STRUCT_ST_BLOCKS,
925 [
926 AC_MSG_CHECKING([for struct stat.st_blocks])
927 AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
928 [AC_TRY_COMPILE(
929 [
930 #include <sys/types.h>
931 #include <sys/stat.h>
932 ],
933 [
934 main()
935 {
936 static struct stat a;
937 if (a.st_blocks) return 0;
938 return 0;
939 }
940 ], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no)
941 ])
942 AC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
943 if test "$bash_cv_struct_stat_st_blocks" = "yes"; then
944 AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
945 fi
946 ])
947
948 AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
949 [
950 if test "X$bash_cv_termcap_lib" = "X"; then
951 _bash_needmsg=yes
952 else
953 AC_MSG_CHECKING(which library has the termcap functions)
954 _bash_needmsg=
955 fi
956 AC_CACHE_VAL(bash_cv_termcap_lib,
957 [AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
958 [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
959 [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
960 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
961 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
962 bash_cv_termcap_lib=gnutermcap)])])])])])
963 if test "X$_bash_needmsg" = "Xyes"; then
964 AC_MSG_CHECKING(which library has the termcap functions)
965 fi
966 AC_MSG_RESULT(using $bash_cv_termcap_lib)
967 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
968 LDFLAGS="$LDFLAGS -L./lib/termcap"
969 TERMCAP_LIB="./lib/termcap/libtermcap.a"
970 TERMCAP_DEP="./lib/termcap/libtermcap.a"
971 elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
972 TERMCAP_LIB=-ltermcap
973 TERMCAP_DEP=
974 elif test $bash_cv_termcap_lib = libtinfo; then
975 TERMCAP_LIB=-ltinfo
976 TERMCAP_DEP=
977 elif test $bash_cv_termcap_lib = libncurses; then
978 TERMCAP_LIB=-lncurses
979 TERMCAP_DEP=
980 elif test $bash_cv_termcap_lib = libc; then
981 TERMCAP_LIB=
982 TERMCAP_DEP=
983 else
984 TERMCAP_LIB=-lcurses
985 TERMCAP_DEP=
986 fi
987 ])
988
989 dnl
990 dnl Check for the presence of getpeername in libsocket.
991 dnl If libsocket is present, check for libnsl and add it to LIBS if
992 dnl it's there, since most systems with libsocket require linking
993 dnl with libnsl as well. This should only be called if getpeername
994 dnl was not found in libc.
995 dnl
996 dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
997 dnl AS WELL
998 dnl
999 AC_DEFUN(BASH_CHECK_LIB_SOCKET,
1000 [
1001 if test "X$bash_cv_have_socklib" = "X"; then
1002 _bash_needmsg=
1003 else
1004 AC_MSG_CHECKING(for socket library)
1005 _bash_needmsg=yes
1006 fi
1007 AC_CACHE_VAL(bash_cv_have_socklib,
1008 [AC_CHECK_LIB(socket, getpeername,
1009 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
1010 if test "X$_bash_needmsg" = Xyes; then
1011 AC_MSG_RESULT($bash_cv_have_socklib)
1012 _bash_needmsg=
1013 fi
1014 if test $bash_cv_have_socklib = yes; then
1015 # check for libnsl, add it to LIBS if present
1016 if test "X$bash_cv_have_libnsl" = "X"; then
1017 _bash_needmsg=
1018 else
1019 AC_MSG_CHECKING(for libnsl)
1020 _bash_needmsg=yes
1021 fi
1022 AC_CACHE_VAL(bash_cv_have_libnsl,
1023 [AC_CHECK_LIB(nsl, t_open,
1024 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1025 if test "X$_bash_needmsg" = Xyes; then
1026 AC_MSG_RESULT($bash_cv_have_libnsl)
1027 _bash_needmsg=
1028 fi
1029 if test $bash_cv_have_libnsl = yes; then
1030 LIBS="-lsocket -lnsl $LIBS"
1031 else
1032 LIBS="-lsocket $LIBS"
1033 fi
1034 AC_DEFINE(HAVE_LIBSOCKET)
1035 AC_DEFINE(HAVE_GETPEERNAME)
1036 fi
1037 ])
1038
1039 AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
1040 [AC_REQUIRE([AC_HEADER_DIRENT])
1041 AC_MSG_CHECKING(for struct dirent.d_ino)
1042 AC_CACHE_VAL(bash_cv_dirent_has_dino,
1043 [AC_TRY_COMPILE([
1044 #include <stdio.h>
1045 #include <sys/types.h>
1046 #ifdef HAVE_UNISTD_H
1047 # include <unistd.h>
1048 #endif /* HAVE_UNISTD_H */
1049 #if defined(HAVE_DIRENT_H)
1050 # include <dirent.h>
1051 #else
1052 # define dirent direct
1053 # ifdef HAVE_SYS_NDIR_H
1054 # include <sys/ndir.h>
1055 # endif /* SYSNDIR */
1056 # ifdef HAVE_SYS_DIR_H
1057 # include <sys/dir.h>
1058 # endif /* SYSDIR */
1059 # ifdef HAVE_NDIR_H
1060 # include <ndir.h>
1061 # endif
1062 #endif /* HAVE_DIRENT_H */
1063 ],[
1064 struct dirent d; int z; z = d.d_ino;
1065 ], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
1066 AC_MSG_RESULT($bash_cv_dirent_has_dino)
1067 if test $bash_cv_dirent_has_dino = yes; then
1068 AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
1069 fi
1070 ])
1071
1072 AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
1073 [AC_REQUIRE([AC_HEADER_DIRENT])
1074 AC_MSG_CHECKING(for struct dirent.d_fileno)
1075 AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
1076 [AC_TRY_COMPILE([
1077 #include <stdio.h>
1078 #include <sys/types.h>
1079 #ifdef HAVE_UNISTD_H
1080 # include <unistd.h>
1081 #endif /* HAVE_UNISTD_H */
1082 #if defined(HAVE_DIRENT_H)
1083 # include <dirent.h>
1084 #else
1085 # define dirent direct
1086 # ifdef HAVE_SYS_NDIR_H
1087 # include <sys/ndir.h>
1088 # endif /* SYSNDIR */
1089 # ifdef HAVE_SYS_DIR_H
1090 # include <sys/dir.h>
1091 # endif /* SYSDIR */
1092 # ifdef HAVE_NDIR_H
1093 # include <ndir.h>
1094 # endif
1095 #endif /* HAVE_DIRENT_H */
1096 ],[
1097 struct dirent d; int z; z = d.d_fileno;
1098 ], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
1099 AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
1100 if test $bash_cv_dirent_has_d_fileno = yes; then
1101 AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
1102 fi
1103 ])
1104
1105 AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
1106 [AC_REQUIRE([AC_HEADER_DIRENT])
1107 AC_MSG_CHECKING(for struct dirent.d_namlen)
1108 AC_CACHE_VAL(bash_cv_dirent_has_d_namlen,
1109 [AC_TRY_COMPILE([
1110 #include <stdio.h>
1111 #include <sys/types.h>
1112 #ifdef HAVE_UNISTD_H
1113 # include <unistd.h>
1114 #endif /* HAVE_UNISTD_H */
1115 #if defined(HAVE_DIRENT_H)
1116 # include <dirent.h>
1117 #else
1118 # define dirent direct
1119 # ifdef HAVE_SYS_NDIR_H
1120 # include <sys/ndir.h>
1121 # endif /* SYSNDIR */
1122 # ifdef HAVE_SYS_DIR_H
1123 # include <sys/dir.h>
1124 # endif /* SYSDIR */
1125 # ifdef HAVE_NDIR_H
1126 # include <ndir.h>
1127 # endif
1128 #endif /* HAVE_DIRENT_H */
1129 ],[
1130 struct dirent d; int z; z = d.d_namlen;
1131 ], bash_cv_dirent_has_d_namlen=yes, bash_cv_dirent_has_d_namlen=no)])
1132 AC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
1133 if test $bash_cv_dirent_has_d_namlen = yes; then
1134 AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
1135 fi
1136 ])
1137
1138 AC_DEFUN(BASH_STRUCT_TIMEVAL,
1139 [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1140 AC_CACHE_VAL(bash_cv_struct_timeval,
1141 [
1142 AC_EGREP_HEADER(struct timeval, sys/time.h,
1143 bash_cv_struct_timeval=yes,
1144 AC_EGREP_HEADER(struct timeval, time.h,
1145 bash_cv_struct_timeval=yes,
1146 bash_cv_struct_timeval=no))
1147 ])
1148 AC_MSG_RESULT($bash_cv_struct_timeval)
1149 if test $bash_cv_struct_timeval = yes; then
1150 AC_DEFINE(HAVE_TIMEVAL)
1151 fi
1152 ])
1153
1154 AC_DEFUN(BASH_STRUCT_TIMEZONE,
1155 [AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h)
1156 AC_CACHE_VAL(bash_cv_struct_timezone,
1157 [
1158 AC_EGREP_HEADER(struct timezone, sys/time.h,
1159 bash_cv_struct_timezone=yes,
1160 AC_EGREP_HEADER(struct timezone, time.h,
1161 bash_cv_struct_timezone=yes,
1162 bash_cv_struct_timezone=no))
1163 ])
1164 AC_MSG_RESULT($bash_cv_struct_timezone)
1165 if test $bash_cv_struct_timezone = yes; then
1166 AC_DEFINE(HAVE_STRUCT_TIMEZONE)
1167 fi
1168 ])
1169
1170 AC_DEFUN(BASH_STRUCT_WINSIZE,
1171 [AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1172 AC_CACHE_VAL(bash_cv_struct_winsize_header,
1173 [AC_TRY_COMPILE([#include <sys/types.h>
1174 #include <sys/ioctl.h>], [struct winsize x;],
1175 bash_cv_struct_winsize_header=ioctl_h,
1176 [AC_TRY_COMPILE([#include <sys/types.h>
1177 #include <termios.h>], [struct winsize x;],
1178 bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
1179 ])])
1180 if test $bash_cv_struct_winsize_header = ioctl_h; then
1181 AC_MSG_RESULT(sys/ioctl.h)
1182 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1183 elif test $bash_cv_struct_winsize_header = termios_h; then
1184 AC_MSG_RESULT(termios.h)
1185 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1186 else
1187 AC_MSG_RESULT(not found)
1188 fi
1189 ])
1190
1191 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1192 AC_DEFUN(BASH_SYS_SIGNAL_VINTAGE,
1193 [AC_REQUIRE([AC_TYPE_SIGNAL])
1194 AC_MSG_CHECKING(for type of signal functions)
1195 AC_CACHE_VAL(bash_cv_signal_vintage,
1196 [
1197 AC_TRY_LINK([#include <signal.h>],[
1198 sigset_t ss;
1199 struct sigaction sa;
1200 sigemptyset(&ss); sigsuspend(&ss);
1201 sigaction(SIGINT, &sa, (struct sigaction *) 0);
1202 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1203 ], bash_cv_signal_vintage=posix,
1204 [
1205 AC_TRY_LINK([#include <signal.h>], [
1206 int mask = sigmask(SIGINT);
1207 sigsetmask(mask); sigblock(mask); sigpause(mask);
1208 ], bash_cv_signal_vintage=4.2bsd,
1209 [
1210 AC_TRY_LINK([
1211 #include <signal.h>
1212 RETSIGTYPE foo() { }], [
1213 int mask = sigmask(SIGINT);
1214 sigset(SIGINT, foo); sigrelse(SIGINT);
1215 sighold(SIGINT); sigpause(SIGINT);
1216 ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
1217 )]
1218 )]
1219 )
1220 ])
1221 AC_MSG_RESULT($bash_cv_signal_vintage)
1222 if test "$bash_cv_signal_vintage" = posix; then
1223 AC_DEFINE(HAVE_POSIX_SIGNALS)
1224 elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1225 AC_DEFINE(HAVE_BSD_SIGNALS)
1226 elif test "$bash_cv_signal_vintage" = svr3; then
1227 AC_DEFINE(HAVE_USG_SIGHOLD)
1228 fi
1229 ])
1230
1231 dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1232 AC_DEFUN(BASH_SYS_PGRP_SYNC,
1233 [AC_REQUIRE([AC_FUNC_GETPGRP])
1234 AC_MSG_CHECKING(whether pgrps need synchronization)
1235 AC_CACHE_VAL(bash_cv_pgrp_pipe,
1236 [AC_TRY_RUN([
1237 #ifdef HAVE_UNISTD_H
1238 # include <unistd.h>
1239 #endif
1240 main()
1241 {
1242 # ifdef GETPGRP_VOID
1243 # define getpgID() getpgrp()
1244 # else
1245 # define getpgID() getpgrp(0)
1246 # define setpgid(x,y) setpgrp(x,y)
1247 # endif
1248 int pid1, pid2, fds[2];
1249 int status;
1250 char ok;
1251
1252 switch (pid1 = fork()) {
1253 case -1:
1254 exit(1);
1255 case 0:
1256 setpgid(0, getpid());
1257 exit(0);
1258 }
1259 setpgid(pid1, pid1);
1260
1261 sleep(2); /* let first child die */
1262
1263 if (pipe(fds) < 0)
1264 exit(2);
1265
1266 switch (pid2 = fork()) {
1267 case -1:
1268 exit(3);
1269 case 0:
1270 setpgid(0, pid1);
1271 ok = getpgID() == pid1;
1272 write(fds[1], &ok, 1);
1273 exit(0);
1274 }
1275 setpgid(pid2, pid1);
1276
1277 close(fds[1]);
1278 if (read(fds[0], &ok, 1) != 1)
1279 exit(4);
1280 wait(&status);
1281 wait(&status);
1282 exit(ok ? 0 : 5);
1283 }
1284 ], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
1285 [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1286 bash_cv_pgrp_pipe=no])
1287 ])
1288 AC_MSG_RESULT($bash_cv_pgrp_pipe)
1289 if test $bash_cv_pgrp_pipe = yes; then
1290 AC_DEFINE(PGRP_PIPE)
1291 fi
1292 ])
1293
1294 AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,
1295 [AC_REQUIRE([AC_TYPE_SIGNAL])
1296 AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1297 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
1298 AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
1299 [AC_TRY_RUN([
1300 #include <signal.h>
1301 #ifdef HAVE_UNISTD_H
1302 #include <unistd.h>
1303 #endif
1304
1305 typedef RETSIGTYPE sigfunc();
1306
1307 int nsigint;
1308
1309 #ifdef HAVE_POSIX_SIGNALS
1310 sigfunc *
1311 set_signal_handler(sig, handler)
1312 int sig;
1313 sigfunc *handler;
1314 {
1315 struct sigaction act, oact;
1316 act.sa_handler = handler;
1317 act.sa_flags = 0;
1318 sigemptyset (&act.sa_mask);
1319 sigemptyset (&oact.sa_mask);
1320 sigaction (sig, &act, &oact);
1321 return (oact.sa_handler);
1322 }
1323 #else
1324 #define set_signal_handler(s, h) signal(s, h)
1325 #endif
1326
1327 RETSIGTYPE
1328 sigint(s)
1329 int s;
1330 {
1331 nsigint++;
1332 }
1333
1334 main()
1335 {
1336 nsigint = 0;
1337 set_signal_handler(SIGINT, sigint);
1338 kill((int)getpid(), SIGINT);
1339 kill((int)getpid(), SIGINT);
1340 exit(nsigint != 2);
1341 }
1342 ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
1343 [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
1344 bash_cv_must_reinstall_sighandlers=no]
1345 )])
1346 AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
1347 if test $bash_cv_must_reinstall_sighandlers = yes; then
1348 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
1349 fi
1350 ])
1351
1352 dnl check that some necessary job control definitions are present
1353 AC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,
1354 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1355 AC_MSG_CHECKING(for presence of necessary job control definitions)
1356 AC_CACHE_VAL(bash_cv_job_control_missing,
1357 [AC_TRY_RUN([
1358 #include <sys/types.h>
1359 #ifdef HAVE_SYS_WAIT_H
1360 #include <sys/wait.h>
1361 #endif
1362 #ifdef HAVE_UNISTD_H
1363 #include <unistd.h>
1364 #endif
1365 #include <signal.h>
1366
1367 /* Add more tests in here as appropriate. */
1368 main()
1369 {
1370 /* signal type */
1371 #if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
1372 exit(1);
1373 #endif
1374
1375 /* signals and tty control. */
1376 #if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
1377 exit (1);
1378 #endif
1379
1380 /* process control */
1381 #if !defined (WNOHANG) || !defined (WUNTRACED)
1382 exit(1);
1383 #endif
1384
1385 /* Posix systems have tcgetpgrp and waitpid. */
1386 #if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
1387 exit(1);
1388 #endif
1389
1390 #if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
1391 exit(1);
1392 #endif
1393
1394 /* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
1395 #if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
1396 exit(1);
1397 #endif
1398
1399 exit(0);
1400 }], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
1401 [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
1402 bash_cv_job_control_missing=missing]
1403 )])
1404 AC_MSG_RESULT($bash_cv_job_control_missing)
1405 if test $bash_cv_job_control_missing = missing; then
1406 AC_DEFINE(JOB_CONTROL_MISSING)
1407 fi
1408 ])
1409
1410 dnl check whether named pipes are present
1411 dnl this requires a previous check for mkfifo, but that is awkward to specify
1412 AC_DEFUN(BASH_SYS_NAMED_PIPES,
1413 [AC_MSG_CHECKING(for presence of named pipes)
1414 AC_CACHE_VAL(bash_cv_sys_named_pipes,
1415 [AC_TRY_RUN([
1416 #include <sys/types.h>
1417 #include <sys/stat.h>
1418 #ifdef HAVE_UNISTD_H
1419 #include <unistd.h>
1420 #endif
1421
1422 /* Add more tests in here as appropriate. */
1423 main()
1424 {
1425 int fd, err;
1426
1427 #if defined (HAVE_MKFIFO)
1428 exit (0);
1429 #endif
1430
1431 #if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
1432 exit (1);
1433 #endif
1434
1435 #if defined (NeXT)
1436 exit (1);
1437 #endif
1438 err = mkdir("bash-aclocal", 0700);
1439 if (err < 0) {
1440 perror ("mkdir");
1441 exit(1);
1442 }
1443 fd = mknod ("bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
1444 if (fd == -1) {
1445 rmdir ("bash-aclocal");
1446 exit (1);
1447 }
1448 close(fd);
1449 unlink ("bash-aclocal/sh-np-autoconf");
1450 rmdir ("bash-aclocal");
1451 exit(0);
1452 }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
1453 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
1454 bash_cv_sys_named_pipes=missing]
1455 )])
1456 AC_MSG_RESULT($bash_cv_sys_named_pipes)
1457 if test $bash_cv_sys_named_pipes = missing; then
1458 AC_DEFINE(NAMED_PIPES_MISSING)
1459 fi
1460 ])
1461
1462 AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,
1463 [AC_MSG_CHECKING(for default mail directory)
1464 AC_CACHE_VAL(bash_cv_mail_dir,
1465 [if test -d /var/mail; then
1466 bash_cv_mail_dir=/var/mail
1467 elif test -d /var/spool/mail; then
1468 bash_cv_mail_dir=/var/spool/mail
1469 elif test -d /usr/mail; then
1470 bash_cv_mail_dir=/usr/mail
1471 elif test -d /usr/spool/mail; then
1472 bash_cv_mail_dir=/usr/spool/mail
1473 else
1474 bash_cv_mail_dir=unknown
1475 fi
1476 ])
1477 AC_MSG_RESULT($bash_cv_mail_dir)
1478 AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
1479 ])
1480
1481 AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
1482 [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
1483 AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
1484 [AC_TRY_COMPILE([#include <sys/types.h>
1485 #include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
1486 bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
1487 AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
1488 if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
1489 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
1490 fi
1491 ])
1492
1493 AC_DEFUN(BASH_HAVE_TIOCSTAT,
1494 [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
1495 AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
1496 [AC_TRY_COMPILE([#include <sys/types.h>
1497 #include <sys/ioctl.h>], [int x = TIOCSTAT;],
1498 bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
1499 AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
1500 if test $bash_cv_tiocstat_in_ioctl = yes; then
1501 AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
1502 fi
1503 ])
1504
1505 AC_DEFUN(BASH_HAVE_FIONREAD,
1506 [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
1507 AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
1508 [AC_TRY_COMPILE([#include <sys/types.h>
1509 #include <sys/ioctl.h>], [int x = FIONREAD;],
1510 bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
1511 AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
1512 if test $bash_cv_fionread_in_ioctl = yes; then
1513 AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
1514 fi
1515 ])
1516
1517 dnl
1518 dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
1519 dnl require a definition of speed_t each time <termcap.h> is included,
1520 dnl but you can only get speed_t if you include <termios.h> (on some
1521 dnl versions) or <sys/types.h> (on others).
1522 dnl
1523 AC_DEFUN(BASH_CHECK_SPEED_T,
1524 [AC_MSG_CHECKING(for speed_t in sys/types.h)
1525 AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
1526 [AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
1527 bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
1528 AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
1529 if test $bash_cv_speed_t_in_sys_types = yes; then
1530 AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1531 fi
1532 ])
1533
1534 AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
1535 [AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
1536 AC_CACHE_VAL(bash_cv_getpw_declared,
1537 [AC_EGREP_CPP(getpwuid,
1538 [
1539 #include <sys/types.h>
1540 #ifdef HAVE_UNISTD_H
1541 # include <unistd.h>
1542 #endif
1543 #include <pwd.h>
1544 ],
1545 bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
1546 AC_MSG_RESULT($bash_cv_getpw_declared)
1547 if test $bash_cv_getpw_declared = yes; then
1548 AC_DEFINE(HAVE_GETPW_DECLS)
1549 fi
1550 ])
1551
1552 AC_DEFUN(BASH_CHECK_DEV_FD,
1553 [AC_MSG_CHECKING(whether /dev/fd is available)
1554 AC_CACHE_VAL(bash_cv_dev_fd,
1555 [bash_cv_dev_fd=""
1556 if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then
1557 # check for systems like FreeBSD 5 that only provide /dev/fd/[012]
1558 if (exec test -r /dev/fd/3 3</dev/null) ; then
1559 bash_cv_dev_fd=standard
1560 else
1561 bash_cv_dev_fd=absent
1562 fi
1563 fi
1564 if test -z "$bash_cv_dev_fd" ; then
1565 if test -d /proc/self/fd && (exec test -r /proc/self/fd/0 < /dev/null) ; then
1566 bash_cv_dev_fd=whacky
1567 else
1568 bash_cv_dev_fd=absent
1569 fi
1570 fi
1571 ])
1572 AC_MSG_RESULT($bash_cv_dev_fd)
1573 if test $bash_cv_dev_fd = "standard"; then
1574 AC_DEFINE(HAVE_DEV_FD)
1575 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1576 elif test $bash_cv_dev_fd = "whacky"; then
1577 AC_DEFINE(HAVE_DEV_FD)
1578 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1579 fi
1580 ])
1581
1582 AC_DEFUN(BASH_CHECK_DEV_STDIN,
1583 [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
1584 AC_CACHE_VAL(bash_cv_dev_stdin,
1585 [if test -d /dev/fd && (exec test -r /dev/stdin < /dev/null) ; then
1586 bash_cv_dev_stdin=present
1587 elif test -d /proc/self/fd && (exec test -r /dev/stdin < /dev/null) ; then
1588 bash_cv_dev_stdin=present
1589 else
1590 bash_cv_dev_stdin=absent
1591 fi
1592 ])
1593 AC_MSG_RESULT($bash_cv_dev_stdin)
1594 if test $bash_cv_dev_stdin = "present"; then
1595 AC_DEFINE(HAVE_DEV_STDIN)
1596 fi
1597 ])
1598
1599 dnl
1600 dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1601 dnl
1602 AC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,
1603 [AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1604 AC_CACHE_VAL(bash_cv_kernel_rlimit,
1605 [AC_TRY_COMPILE([
1606 #include <sys/types.h>
1607 #include <sys/resource.h>
1608 ],
1609 [
1610 int f;
1611 f = RLIMIT_DATA;
1612 ], bash_cv_kernel_rlimit=no,
1613 [AC_TRY_COMPILE([
1614 #include <sys/types.h>
1615 #define _KERNEL
1616 #include <sys/resource.h>
1617 #undef _KERNEL
1618 ],
1619 [
1620 int f;
1621 f = RLIMIT_DATA;
1622 ], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
1623 )])
1624 AC_MSG_RESULT($bash_cv_kernel_rlimit)
1625 if test $bash_cv_kernel_rlimit = yes; then
1626 AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1627 fi
1628 ])
1629
1630 dnl
1631 dnl Check for 64-bit off_t -- used for malloc alignment
1632 dnl
1633 dnl C does not allow duplicate case labels, so the compile will fail if
1634 dnl sizeof(off_t) is > 4.
1635 dnl
1636 AC_DEFUN(BASH_CHECK_OFF_T_64,
1637 [AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1638 AC_TRY_COMPILE([
1639 #ifdef HAVE_UNISTD_H
1640 #include <unistd.h>
1641 #endif
1642 #include <sys/types.h>
1643 ],[
1644 switch (0) case 0: case (sizeof (off_t) <= 4):;
1645 ], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
1646 if test $bash_cv_off_t_64 = yes; then
1647 AC_DEFINE(HAVE_OFF_T_64)
1648 fi])
1649
1650 AC_DEFUN(BASH_CHECK_RTSIGS,
1651 [AC_MSG_CHECKING(for unusable real-time signals due to large values)
1652 AC_CACHE_VAL(bash_cv_unusable_rtsigs,
1653 [AC_TRY_RUN([
1654 #include <sys/types.h>
1655 #include <signal.h>
1656
1657 #ifndef NSIG
1658 # define NSIG 64
1659 #endif
1660
1661 main ()
1662 {
1663 int n_sigs = 2 * NSIG;
1664 #ifdef SIGRTMIN
1665 int rtmin = SIGRTMIN;
1666 #else
1667 int rtmin = 0;
1668 #endif
1669
1670 exit(rtmin < n_sigs);
1671 }], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no,
1672 [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
1673 bash_cv_unusable_rtsigs=yes]
1674 )])
1675 AC_MSG_RESULT($bash_cv_unusable_rtsigs)
1676 if test $bash_cv_unusable_rtsigs = yes; then
1677 AC_DEFINE(UNUSABLE_RT_SIGNALS)
1678 fi
1679 ])
1680
1681 dnl
1682 dnl check for availability of multibyte characters and functions
1683 dnl
1684 dnl geez, I wish I didn't have to check for all of this stuff separately
1685 dnl
1686 AC_DEFUN(BASH_CHECK_MULTIBYTE,
1687 [
1688 AC_CHECK_HEADERS(wctype.h)
1689 AC_CHECK_HEADERS(wchar.h)
1690 AC_CHECK_HEADERS(langinfo.h)
1691
1692 AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
1693 AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
1694 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
1695
1696 AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
1697 AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
1698 AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
1699 AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1700 AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))
1701
1702 dnl checks for both mbrtowc and mbstate_t
1703 AC_FUNC_MBRTOWC
1704 if test $ac_cv_func_mbrtowc = yes; then
1705 AC_DEFINE(HAVE_MBSTATE_T)
1706 fi
1707
1708 AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
1709
1710 AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
1711 [AC_TRY_LINK(
1712 [#include <langinfo.h>],
1713 [char* cs = nl_langinfo(CODESET);],
1714 bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])
1715 if test $bash_cv_langinfo_codeset = yes; then
1716 AC_DEFINE(HAVE_LANGINFO_CODESET)
1717 fi
1718
1719 dnl check for wchar_t in <wchar.h>
1720 AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
1721 [AC_TRY_COMPILE(
1722 [#include <wchar.h>
1723 ],
1724 [
1725 wchar_t foo;
1726 foo = 0;
1727 ], bash_cv_type_wchar_t=yes, bash_cv_type_wchar_t=no)])
1728 if test $bash_cv_type_wchar_t = yes; then
1729 AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
1730 fi
1731
1732 dnl check for wctype_t in <wctype.h>
1733 AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
1734 [AC_TRY_COMPILE(
1735 [#include <wctype.h>],
1736 [
1737 wctype_t foo;
1738 foo = 0;
1739 ], bash_cv_type_wctype_t=yes, bash_cv_type_wctype_t=no)])
1740 if test $bash_cv_type_wctype_t = yes; then
1741 AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
1742 fi
1743
1744 dnl check for wint_t in <wctype.h>
1745 AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
1746 [AC_TRY_COMPILE(
1747 [#include <wctype.h>],
1748 [
1749 wint_t foo;
1750 foo = 0;
1751 ], bash_cv_type_wint_t=yes, bash_cv_type_wint_t=no)])
1752 if test $bash_cv_type_wint_t = yes; then
1753 AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
1754 fi
1755
1756 ])
1757
1758 dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1759 dnl require:
1760 dnl AC_PROG_CC
1761 dnl BASH_CHECK_LIB_TERMCAP
1762
1763 AC_DEFUN([RL_LIB_READLINE_VERSION],
1764 [
1765 AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1766
1767 AC_MSG_CHECKING([version of installed readline library])
1768
1769 # What a pain in the ass this is.
1770
1771 # save cpp and ld options
1772 _save_CFLAGS="$CFLAGS"
1773 _save_LDFLAGS="$LDFLAGS"
1774 _save_LIBS="$LIBS"
1775
1776 # Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
1777 # allows the caller to do something like $_rl_prefix=$withval if the user
1778 # specifies --with-installed-readline=PREFIX as an argument to configure
1779
1780 if test -z "$ac_cv_rl_prefix"; then
1781 test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1782 fi
1783
1784 eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1785 eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1786
1787 LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1788 CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1789 LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1790
1791 AC_CACHE_VAL(ac_cv_rl_version,
1792 [AC_TRY_RUN([
1793 #include <stdio.h>
1794 #include <readline/readline.h>
1795
1796 extern int rl_gnu_readline_p;
1797
1798 main()
1799 {
1800 FILE *fp;
1801 fp = fopen("conftest.rlv", "w");
1802 if (fp == 0)
1803 exit(1);
1804 if (rl_gnu_readline_p != 1)
1805 fprintf(fp, "0.0\n");
1806 else
1807 fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
1808 fclose(fp);
1809 exit(0);
1810 }
1811 ],
1812 ac_cv_rl_version=`cat conftest.rlv`,
1813 ac_cv_rl_version='0.0',
1814 ac_cv_rl_version='4.2')])
1815
1816 CFLAGS="$_save_CFLAGS"
1817 LDFLAGS="$_save_LDFLAGS"
1818 LIBS="$_save_LIBS"
1819
1820 RL_MAJOR=0
1821 RL_MINOR=0
1822
1823 # (
1824 case "$ac_cv_rl_version" in
1825 2*|3*|4*|5*|6*|7*|8*|9*)
1826 RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
1827 RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
1828 ;;
1829 esac
1830
1831 # (((
1832 case $RL_MAJOR in
1833 [[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
1834 [[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
1835 *) _RL_MAJOR=00 ;;
1836 esac
1837
1838 # (((
1839 case $RL_MINOR in
1840 [[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
1841 [[0-9]]) _RL_MINOR=0$RL_MINOR ;;
1842 *) _RL_MINOR=00 ;;
1843 esac
1844
1845 RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1846
1847 # Readline versions greater than 4.2 have these defines in readline.h
1848
1849 if test $ac_cv_rl_version = '0.0' ; then
1850 AC_MSG_WARN([Could not test version of installed readline library.])
1851 elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1852 # set these for use by the caller
1853 RL_PREFIX=$ac_cv_rl_prefix
1854 RL_LIBDIR=$ac_cv_rl_libdir
1855 RL_INCLUDEDIR=$ac_cv_rl_includedir
1856 AC_MSG_RESULT($ac_cv_rl_version)
1857 else
1858
1859 AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1860 AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1861 AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1862
1863 AC_SUBST(RL_VERSION)
1864 AC_SUBST(RL_MAJOR)
1865 AC_SUBST(RL_MINOR)
1866
1867 # set these for use by the caller
1868 RL_PREFIX=$ac_cv_rl_prefix
1869 RL_LIBDIR=$ac_cv_rl_libdir
1870 RL_INCLUDEDIR=$ac_cv_rl_includedir
1871
1872 AC_MSG_RESULT($ac_cv_rl_version)
1873
1874 fi
1875 ])
1876
1877 AC_DEFUN(BASH_FUNC_CTYPE_NONASCII,
1878 [
1879 AC_MSG_CHECKING(whether the ctype macros accept non-ascii characters)
1880 AC_CACHE_VAL(bash_cv_func_ctype_nonascii,
1881 [AC_TRY_RUN([
1882 #ifdef HAVE_LOCALE_H
1883 #include <locale.h>
1884 #endif
1885 #include <stdio.h>
1886 #include <ctype.h>
1887
1888 main(c, v)
1889 int c;
1890 char *v[];
1891 {
1892 char *deflocale;
1893 unsigned char x;
1894 int r1, r2;
1895
1896 #ifdef HAVE_SETLOCALE
1897 /* We take a shot here. If that locale is not known, try the
1898 system default. We try this one because '\342' (226) is
1899 known to be a printable character in that locale. */
1900 deflocale = setlocale(LC_ALL, "en_US.ISO8859-1");
1901 if (deflocale == 0)
1902 deflocale = setlocale(LC_ALL, "");
1903 #endif
1904
1905 x = '\342';
1906 r1 = isprint(x);
1907 x -= 128;
1908 r2 = isprint(x);
1909 exit (r1 == 0 || r2 == 0);
1910 }
1911 ], bash_cv_func_ctype_nonascii=yes, bash_cv_func_ctype_nonascii=no,
1912 [AC_MSG_WARN(cannot check ctype macros if cross compiling -- defaulting to no)
1913 bash_cv_func_ctype_nonascii=no]
1914 )])
1915 AC_MSG_RESULT($bash_cv_func_ctype_nonascii)
1916 if test $bash_cv_func_ctype_nonascii = yes; then
1917 AC_DEFINE(CTYPE_NON_ASCII)
1918 fi
1919 ])
1920
1921 AC_DEFUN(BASH_CHECK_WCONTINUED,
1922 [
1923 AC_MSG_CHECKING(whether WCONTINUED flag to waitpid is unavailable or available but broken)
1924 AC_CACHE_VAL(bash_cv_wcontinued_broken,
1925 [AC_TRY_RUN([
1926 #include <sys/types.h>
1927 #include <sys/wait.h>
1928 #include <unistd.h>
1929 #include <errno.h>
1930
1931 #ifndef errno
1932 extern int errno;
1933 #endif
1934 main()
1935 {
1936 int x;
1937
1938 x = waitpid(-1, (int *)0, WNOHANG|WCONTINUED);
1939 if (x == -1 && errno == EINVAL)
1940 exit (1);
1941 else
1942 exit (0);
1943 }
1944 ], bash_cv_wcontinued_broken=no,bash_cv_wcontinued_broken=yes,
1945 [AC_MSG_WARN(cannot check WCONTINUED if cross compiling -- defaulting to no)
1946 bash_cv_wcontinued_broken=no]
1947 )])
1948 AC_MSG_RESULT($bash_cv_wcontinued_broken)
1949 if test $bash_cv_wcontinued_broken = yes; then
1950 AC_DEFINE(WCONTINUED_BROKEN)
1951 fi
1952 ])
1953
1954 dnl
1955 dnl tests added for bashdb
1956 dnl
1957
1958
1959 AC_DEFUN([AM_PATH_LISPDIR],
1960 [AC_ARG_WITH(lispdir, AC_HELP_STRING([--with-lispdir], [override the default lisp directory]),
1961 [ lispdir="$withval"
1962 AC_MSG_CHECKING([where .elc files should go])
1963 AC_MSG_RESULT([$lispdir])],
1964 [
1965 # If set to t, that means we are running in a shell under Emacs.
1966 # If you have an Emacs named "t", then use the full path.
1967 test x"$EMACS" = xt && EMACS=
1968 AC_CHECK_PROGS(EMACS, emacs xemacs, no)
1969 if test $EMACS != "no"; then
1970 if test x${lispdir+set} != xset; then
1971 AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
1972 am_cv_lispdir=`$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' | sed -n -e 's,/$,,' -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}'`
1973 if test -z "$am_cv_lispdir"; then
1974 am_cv_lispdir='${datadir}/emacs/site-lisp'
1975 fi
1976 ])
1977 lispdir="$am_cv_lispdir"
1978 fi
1979 fi
1980 ])
1981 AC_SUBST(lispdir)
1982 ])
1983
1984 dnl
1985 dnl tests added for gettext
1986 dnl
1987 # codeset.m4 serial AM1 (gettext-0.10.40)
1988 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
1989 dnl This file is free software, distributed under the terms of the GNU
1990 dnl General Public License. As a special exception to the GNU General
1991 dnl Public License, this file may be distributed as part of a program
1992 dnl that contains a configuration script generated by Autoconf, under
1993 dnl the same distribution terms as the rest of that program.
1994
1995 dnl From Bruno Haible.
1996
1997 AC_DEFUN([AM_LANGINFO_CODESET],
1998 [
1999 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2000 [AC_TRY_LINK([#include <langinfo.h>],
2001 [char* cs = nl_langinfo(CODESET);],
2002 am_cv_langinfo_codeset=yes,
2003 am_cv_langinfo_codeset=no)
2004 ])
2005 if test $am_cv_langinfo_codeset = yes; then
2006 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2007 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2008 fi
2009 ])
2010 # gettext.m4 serial 20 (gettext-0.12)
2011 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
2012 dnl This file is free software, distributed under the terms of the GNU
2013 dnl General Public License. As a special exception to the GNU General
2014 dnl Public License, this file may be distributed as part of a program
2015 dnl that contains a configuration script generated by Autoconf, under
2016 dnl the same distribution terms as the rest of that program.
2017 dnl
2018 dnl This file can can be used in projects which are not available under
2019 dnl the GNU General Public License or the GNU Library General Public
2020 dnl License but which still want to provide support for the GNU gettext
2021 dnl functionality.
2022 dnl Please note that the actual code of the GNU gettext library is covered
2023 dnl by the GNU Library General Public License, and the rest of the GNU
2024 dnl gettext package package is covered by the GNU General Public License.
2025 dnl They are *not* in the public domain.
2026
2027 dnl Authors:
2028 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
2029 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
2030
2031 dnl Macro to add for using GNU gettext.
2032
2033 dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
2034 dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
2035 dnl default (if it is not specified or empty) is 'no-libtool'.
2036 dnl INTLSYMBOL should be 'external' for packages with no intl directory,
2037 dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
2038 dnl If INTLSYMBOL is 'use-libtool', then a libtool library
2039 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
2040 dnl depending on --{enable,disable}-{shared,static} and on the presence of
2041 dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
2042 dnl $(top_builddir)/intl/libintl.a will be created.
2043 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
2044 dnl implementations (in libc or libintl) without the ngettext() function
2045 dnl will be ignored. If NEEDSYMBOL is specified and is
2046 dnl 'need-formatstring-macros', then GNU gettext implementations that don't
2047 dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
2048 dnl INTLDIR is used to find the intl libraries. If empty,
2049 dnl the value `$(top_builddir)/intl/' is used.
2050 dnl
2051 dnl The result of the configuration is one of three cases:
2052 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
2053 dnl and used.
2054 dnl Catalog format: GNU --> install in $(datadir)
2055 dnl Catalog extension: .mo after installation, .gmo in source tree
2056 dnl 2) GNU gettext has been found in the system's C library.
2057 dnl Catalog format: GNU --> install in $(datadir)
2058 dnl Catalog extension: .mo after installation, .gmo in source tree
2059 dnl 3) No internationalization, always use English msgid.
2060 dnl Catalog format: none
2061 dnl Catalog extension: none
2062 dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur.
2063 dnl The use of .gmo is historical (it was needed to avoid overwriting the
2064 dnl GNU format catalogs when building on a platform with an X/Open gettext),
2065 dnl but we keep it in order not to force irrelevant filename changes on the
2066 dnl maintainers.
2067 dnl
2068 AC_DEFUN([AM_GNU_GETTEXT],
2069 [
2070 dnl Argument checking.
2071 ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
2072 [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
2073 ])])])])])
2074 ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
2075 [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
2076 ])])])])
2077 define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
2078 define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
2079
2080 AC_REQUIRE([AM_PO_SUBDIRS])dnl
2081 ifelse(gt_included_intl, yes, [
2082 AC_REQUIRE([AM_INTL_SUBDIR])dnl
2083 ])
2084
2085 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2086 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2087 AC_REQUIRE([AC_LIB_RPATH])
2088
2089 dnl Sometimes libintl requires libiconv, so first search for libiconv.
2090 dnl Ideally we would do this search only after the
2091 dnl if test "$USE_NLS" = "yes"; then
2092 dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2093 dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
2094 dnl the configure script would need to contain the same shell code
2095 dnl again, outside any 'if'. There are two solutions:
2096 dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
2097 dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
2098 dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
2099 dnl documented, we avoid it.
2100 ifelse(gt_included_intl, yes, , [
2101 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2102 ])
2103
2104 dnl Set USE_NLS.
2105 AM_NLS
2106
2107 ifelse(gt_included_intl, yes, [
2108 BUILD_INCLUDED_LIBINTL=no
2109 USE_INCLUDED_LIBINTL=no
2110 ])
2111 LIBINTL=
2112 LTLIBINTL=
2113 POSUB=
2114
2115 dnl If we use NLS figure out what method
2116 if test "$USE_NLS" = "yes"; then
2117 gt_use_preinstalled_gnugettext=no
2118 ifelse(gt_included_intl, yes, [
2119 AC_MSG_CHECKING([whether included gettext is requested])
2120 AC_ARG_WITH(included-gettext,
2121 [ --with-included-gettext use the GNU gettext library included here],
2122 nls_cv_force_use_gnu_gettext=$withval,
2123 nls_cv_force_use_gnu_gettext=no)
2124 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2125
2126 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2127 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2128 ])
2129 dnl User does not insist on using GNU NLS library. Figure out what
2130 dnl to use. If GNU gettext is available we use this. Else we have
2131 dnl to fall back to GNU NLS library.
2132
2133 dnl Add a version number to the cache macros.
2134 define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
2135 define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
2136 define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
2137
2138 AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
2139 [AC_TRY_LINK([#include <libintl.h>
2140 ]ifelse([$2], [need-formatstring-macros],
2141 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2142 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2143 #endif
2144 changequote(,)dnl
2145 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2146 changequote([,])dnl
2147 ], [])[extern int _nl_msg_cat_cntr;
2148 extern int *_nl_domain_bindings;],
2149 [bindtextdomain ("", "");
2150 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings],
2151 gt_cv_func_gnugettext_libc=yes,
2152 gt_cv_func_gnugettext_libc=no)])
2153
2154 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2155 dnl Sometimes libintl requires libiconv, so first search for libiconv.
2156 ifelse(gt_included_intl, yes, , [
2157 AM_ICONV_LINK
2158 ])
2159 dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
2160 dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv])
2161 dnl because that would add "-liconv" to LIBINTL and LTLIBINTL
2162 dnl even if libiconv doesn't exist.
2163 AC_LIB_LINKFLAGS_BODY([intl])
2164 AC_CACHE_CHECK([for GNU gettext in libintl],
2165 gt_cv_func_gnugettext_libintl,
2166 [gt_save_CPPFLAGS="$CPPFLAGS"
2167 CPPFLAGS="$CPPFLAGS $INCINTL"
2168 gt_save_LIBS="$LIBS"
2169 LIBS="$LIBS $LIBINTL"
2170 dnl Now see whether libintl exists and does not depend on libiconv.
2171 AC_TRY_LINK([#include <libintl.h>
2172 ]ifelse([$2], [need-formatstring-macros],
2173 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2174 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2175 #endif
2176 changequote(,)dnl
2177 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2178 changequote([,])dnl
2179 ], [])[extern int _nl_msg_cat_cntr;
2180 extern
2181 #ifdef __cplusplus
2182 "C"
2183 #endif
2184 const char *_nl_expand_alias ();],
2185 [bindtextdomain ("", "");
2186 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2187 gt_cv_func_gnugettext_libintl=yes,
2188 gt_cv_func_gnugettext_libintl=no)
2189 dnl Now see whether libintl exists and depends on libiconv.
2190 if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
2191 LIBS="$LIBS $LIBICONV"
2192 AC_TRY_LINK([#include <libintl.h>
2193 ]ifelse([$2], [need-formatstring-macros],
2194 [#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
2195 #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
2196 #endif
2197 changequote(,)dnl
2198 typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
2199 changequote([,])dnl
2200 ], [])[extern int _nl_msg_cat_cntr;
2201 extern
2202 #ifdef __cplusplus
2203 "C"
2204 #endif
2205 const char *_nl_expand_alias ();],
2206 [bindtextdomain ("", "");
2207 return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)],
2208 [LIBINTL="$LIBINTL $LIBICONV"
2209 LTLIBINTL="$LTLIBINTL $LTLIBICONV"
2210 gt_cv_func_gnugettext_libintl=yes
2211 ])
2212 fi
2213 CPPFLAGS="$gt_save_CPPFLAGS"
2214 LIBS="$gt_save_LIBS"])
2215 fi
2216
2217 dnl If an already present or preinstalled GNU gettext() is found,
2218 dnl use it. But if this macro is used in GNU gettext, and GNU
2219 dnl gettext is already preinstalled in libintl, we update this
2220 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
2221 if test "$gt_cv_func_gnugettext_libc" = "yes" \
2222 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
2223 && test "$PACKAGE" != gettext-runtime \
2224 && test "$PACKAGE" != gettext-tools; }; then
2225 gt_use_preinstalled_gnugettext=yes
2226 else
2227 dnl Reset the values set by searching for libintl.
2228 LIBINTL=
2229 LTLIBINTL=
2230 INCINTL=
2231 fi
2232
2233 ifelse(gt_included_intl, yes, [
2234 if test "$gt_use_preinstalled_gnugettext" != "yes"; then
2235 dnl GNU gettext is not found in the C library.
2236 dnl Fall back on included GNU gettext library.
2237 nls_cv_use_gnu_gettext=yes
2238 fi
2239 fi
2240
2241 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2242 dnl Mark actions used to generate GNU NLS library.
2243 BUILD_INCLUDED_LIBINTL=yes
2244 USE_INCLUDED_LIBINTL=yes
2245 LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
2246 LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
2247 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2248 fi
2249
2250 if test "$gt_use_preinstalled_gnugettext" = "yes" \
2251 || test "$nls_cv_use_gnu_gettext" = "yes"; then
2252 dnl Mark actions to use GNU gettext tools.
2253 CATOBJEXT=.gmo
2254 fi
2255 ])
2256
2257 if test "$gt_use_preinstalled_gnugettext" = "yes" \
2258 || test "$nls_cv_use_gnu_gettext" = "yes"; then
2259 AC_DEFINE(ENABLE_NLS, 1,
2260 [Define to 1 if translation of program messages to the user's native language
2261 is requested.])
2262 else
2263 USE_NLS=no
2264 fi
2265 fi
2266
2267 AC_MSG_CHECKING([whether to use NLS])
2268 AC_MSG_RESULT([$USE_NLS])
2269 if test "$USE_NLS" = "yes"; then
2270 AC_MSG_CHECKING([where the gettext function comes from])
2271 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2272 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2273 gt_source="external libintl"
2274 else
2275 gt_source="libc"
2276 fi
2277 else
2278 gt_source="included intl directory"
2279 fi
2280 AC_MSG_RESULT([$gt_source])
2281 fi
2282
2283 if test "$USE_NLS" = "yes"; then
2284
2285 if test "$gt_use_preinstalled_gnugettext" = "yes"; then
2286 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2287 AC_MSG_CHECKING([how to link with libintl])
2288 AC_MSG_RESULT([$LIBINTL])
2289 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
2290 fi
2291
2292 dnl For backward compatibility. Some packages may be using this.
2293 AC_DEFINE(HAVE_GETTEXT, 1,
2294 [Define if the GNU gettext() function is already present or preinstalled.])
2295 AC_DEFINE(HAVE_DCGETTEXT, 1,
2296 [Define if the GNU dcgettext() function is already present or preinstalled.])
2297 fi
2298
2299 dnl We need to process the po/ directory.
2300 POSUB=po
2301 fi
2302
2303 ifelse(gt_included_intl, yes, [
2304 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2305 dnl to 'yes' because some of the testsuite requires it.
2306 if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
2307 BUILD_INCLUDED_LIBINTL=yes
2308 fi
2309
2310 dnl Make all variables we use known to autoconf.
2311 AC_SUBST(BUILD_INCLUDED_LIBINTL)
2312 AC_SUBST(USE_INCLUDED_LIBINTL)
2313 AC_SUBST(CATOBJEXT)
2314
2315 dnl For backward compatibility. Some configure.ins may be using this.
2316 nls_cv_header_intl=
2317 nls_cv_header_libgt=
2318
2319 dnl For backward compatibility. Some Makefiles may be using this.
2320 DATADIRNAME=share
2321 AC_SUBST(DATADIRNAME)
2322
2323 dnl For backward compatibility. Some Makefiles may be using this.
2324 INSTOBJEXT=.mo
2325 AC_SUBST(INSTOBJEXT)
2326
2327 dnl For backward compatibility. Some Makefiles may be using this.
2328 GENCAT=gencat
2329 AC_SUBST(GENCAT)
2330
2331 dnl For backward compatibility. Some Makefiles may be using this.
2332 if test "$USE_INCLUDED_LIBINTL" = yes; then
2333 INTLOBJS="\$(GETTOBJS)"
2334 fi
2335 AC_SUBST(INTLOBJS)
2336
2337 dnl Enable libtool support if the surrounding package wishes it.
2338 INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
2339 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2340 ])
2341
2342 dnl For backward compatibility. Some Makefiles may be using this.
2343 INTLLIBS="$LIBINTL"
2344 AC_SUBST(INTLLIBS)
2345
2346 dnl Make all documented variables known to autoconf.
2347 AC_SUBST(LIBINTL)
2348 AC_SUBST(LTLIBINTL)
2349 AC_SUBST(POSUB)
2350 ])
2351
2352
2353 dnl Checks for all prerequisites of the intl subdirectory,
2354 dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
2355 dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
2356 AC_DEFUN([AM_INTL_SUBDIR],
2357 [
2358 AC_REQUIRE([AC_PROG_INSTALL])dnl
2359 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
2360 AC_REQUIRE([AC_PROG_CC])dnl
2361 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2362 AC_REQUIRE([AC_PROG_RANLIB])dnl
2363 AC_REQUIRE([AC_ISC_POSIX])dnl
2364 AC_REQUIRE([AC_HEADER_STDC])dnl
2365 AC_REQUIRE([AC_C_CONST])dnl
2366 AC_REQUIRE([AC_C_INLINE])dnl
2367 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2368 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2369 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2370 AC_REQUIRE([AC_FUNC_MMAP])dnl
2371 AC_REQUIRE([jm_GLIBC21])dnl
2372 AC_REQUIRE([gt_INTDIV0])dnl
2373 AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
2374 AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
2375 AC_REQUIRE([gt_INTTYPES_PRI])dnl
2376
2377 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2378 stdlib.h string.h unistd.h sys/param.h])
2379 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
2380 geteuid getgid getuid mempcpy munmap putenv setenv setlocale localeconv stpcpy \
2381 strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
2382 __fsetlocking])
2383
2384 AM_ICONV
2385 AM_LANGINFO_CODESET
2386 if test $ac_cv_header_locale_h = yes; then
2387 AM_LC_MESSAGES
2388 fi
2389
2390 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2391 dnl because plural.y uses bison specific features. It requires at least
2392 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2393 dnl compile.
2394 dnl bison is only needed for the maintainer (who touches plural.y). But in
2395 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2396 dnl the rule in general Makefile. Now, some people carelessly touch the
2397 dnl files or have a broken "make" program, hence the plural.c rule will
2398 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2399 dnl present or too old.
2400 AC_CHECK_PROGS([INTLBISON], [bison])
2401 if test -z "$INTLBISON"; then
2402 ac_verc_fail=yes
2403 else
2404 dnl Found it, now check the version.
2405 AC_MSG_CHECKING([version of bison])
2406 changequote(<<,>>)dnl
2407 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2408 case $ac_prog_version in
2409 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2410 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2411 changequote([,])dnl
2412 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2413 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2414 esac
2415 AC_MSG_RESULT([$ac_prog_version])
2416 fi
2417 if test $ac_verc_fail = yes; then
2418 INTLBISON=:
2419 fi
2420 ])
2421
2422
2423 dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
2424 AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
2425 # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40)
2426 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2427 dnl This file is free software, distributed under the terms of the GNU
2428 dnl General Public License. As a special exception to the GNU General
2429 dnl Public License, this file may be distributed as part of a program
2430 dnl that contains a configuration script generated by Autoconf, under
2431 dnl the same distribution terms as the rest of that program.
2432
2433 # Test for the GNU C Library, version 2.1 or newer.
2434 # From Bruno Haible.
2435
2436 AC_DEFUN([jm_GLIBC21],
2437 [
2438 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2439 ac_cv_gnu_library_2_1,
2440 [AC_EGREP_CPP([Lucky GNU user],
2441 [
2442 #include <features.h>
2443 #ifdef __GNU_LIBRARY__
2444 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2445 Lucky GNU user
2446 #endif
2447 #endif
2448 ],
2449 ac_cv_gnu_library_2_1=yes,
2450 ac_cv_gnu_library_2_1=no)
2451 ]
2452 )
2453 AC_SUBST(GLIBC21)
2454 GLIBC21="$ac_cv_gnu_library_2_1"
2455 ]
2456 )
2457 # iconv.m4 serial AM4 (gettext-0.11.3)
2458 dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
2459 dnl This file is free software, distributed under the terms of the GNU
2460 dnl General Public License. As a special exception to the GNU General
2461 dnl Public License, this file may be distributed as part of a program
2462 dnl that contains a configuration script generated by Autoconf, under
2463 dnl the same distribution terms as the rest of that program.
2464
2465 dnl From Bruno Haible.
2466
2467 AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
2468 [
2469 dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
2470 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2471 AC_REQUIRE([AC_LIB_RPATH])
2472
2473 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2474 dnl accordingly.
2475 AC_LIB_LINKFLAGS_BODY([iconv])
2476 ])
2477
2478 AC_DEFUN([AM_ICONV_LINK],
2479 [
2480 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2481 dnl those with the standalone portable GNU libiconv installed).
2482
2483 dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
2484 dnl accordingly.
2485 AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
2486
2487 dnl Add $INCICONV to CPPFLAGS before performing the following checks,
2488 dnl because if the user has installed libiconv and not disabled its use
2489 dnl via --without-libiconv-prefix, he wants to use it. The first
2490 dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
2491 am_save_CPPFLAGS="$CPPFLAGS"
2492 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
2493
2494 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2495 am_cv_func_iconv="no, consider installing GNU libiconv"
2496 am_cv_lib_iconv=no
2497 AC_TRY_LINK([#include <stdlib.h>
2498 #include <iconv.h>],
2499 [iconv_t cd = iconv_open("","");
2500 iconv(cd,NULL,NULL,NULL,NULL);
2501 iconv_close(cd);],
2502 am_cv_func_iconv=yes)
2503 if test "$am_cv_func_iconv" != yes; then
2504 am_save_LIBS="$LIBS"
2505 LIBS="$LIBS $LIBICONV"
2506 AC_TRY_LINK([#include <stdlib.h>
2507 #include <iconv.h>],
2508 [iconv_t cd = iconv_open("","");
2509 iconv(cd,NULL,NULL,NULL,NULL);
2510 iconv_close(cd);],
2511 am_cv_lib_iconv=yes
2512 am_cv_func_iconv=yes)
2513 LIBS="$am_save_LIBS"
2514 fi
2515 ])
2516 if test "$am_cv_func_iconv" = yes; then
2517 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2518 fi
2519 if test "$am_cv_lib_iconv" = yes; then
2520 AC_MSG_CHECKING([how to link with libiconv])
2521 AC_MSG_RESULT([$LIBICONV])
2522 else
2523 dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
2524 dnl either.
2525 CPPFLAGS="$am_save_CPPFLAGS"
2526 LIBICONV=
2527 LTLIBICONV=
2528 fi
2529 AC_SUBST(LIBICONV)
2530 AC_SUBST(LTLIBICONV)
2531 ])
2532
2533 AC_DEFUN([AM_ICONV],
2534 [
2535 AM_ICONV_LINK
2536 if test "$am_cv_func_iconv" = yes; then
2537 AC_MSG_CHECKING([for iconv declaration])
2538 AC_CACHE_VAL(am_cv_proto_iconv, [
2539 AC_TRY_COMPILE([
2540 #include <stdlib.h>
2541 #include <iconv.h>
2542 extern
2543 #ifdef __cplusplus
2544 "C"
2545 #endif
2546 #if defined(__STDC__) || defined(__cplusplus)
2547 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2548 #else
2549 size_t iconv();
2550 #endif
2551 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2552 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);"])
2553 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2554 AC_MSG_RESULT([$]{ac_t:-
2555 }[$]am_cv_proto_iconv)
2556 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2557 [Define as const if the declaration of iconv() needs const.])
2558 fi
2559 ])
2560 # intdiv0.m4 serial 1 (gettext-0.11.3)
2561 dnl Copyright (C) 2002 Free Software Foundation, Inc.
2562 dnl This file is free software, distributed under the terms of the GNU
2563 dnl General Public License. As a special exception to the GNU General
2564 dnl Public License, this file may be distributed as part of a program
2565 dnl that contains a configuration script generated by Autoconf, under
2566 dnl the same distribution terms as the rest of that program.
2567
2568 dnl From Bruno Haible.
2569
2570 AC_DEFUN([gt_INTDIV0],
2571 [
2572 AC_REQUIRE([AC_PROG_CC])dnl
2573 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2574
2575 AC_CACHE_CHECK([whether integer division by zero raises SIGFPE],
2576 gt_cv_int_divbyzero_sigfpe,
2577 [
2578 AC_TRY_RUN([
2579 #include <stdlib.h>
2580 #include <signal.h>
2581
2582 static void
2583 #ifdef __cplusplus
2584 sigfpe_handler (int sig)
2585 #else
2586 sigfpe_handler (sig) int sig;
2587 #endif
2588 {
2589 /* Exit with code 0 if SIGFPE, with code 1 if any other signal. */
2590 exit (sig != SIGFPE);
2591 }
2592
2593 int x = 1;
2594 int y = 0;
2595 int z;
2596 int nan;
2597
2598 int main ()
2599 {
2600 signal (SIGFPE, sigfpe_handler);
2601 /* IRIX and AIX (when "xlc -qcheck" is used) yield signal SIGTRAP. */
2602 #if (defined (__sgi) || defined (_AIX)) && defined (SIGTRAP)
2603 signal (SIGTRAP, sigfpe_handler);
2604 #endif
2605 /* Linux/SPARC yields signal SIGILL. */
2606 #if defined (__sparc__) && defined (__linux__)
2607 signal (SIGILL, sigfpe_handler);
2608 #endif
2609
2610 z = x / y;
2611 nan = y / y;
2612 exit (1);
2613 }
2614 ], gt_cv_int_divbyzero_sigfpe=yes, gt_cv_int_divbyzero_sigfpe=no,
2615 [
2616 # Guess based on the CPU.
2617 case "$host_cpu" in
2618 alpha* | i[34567]86 | m68k | s390*)
2619 gt_cv_int_divbyzero_sigfpe="guessing yes";;
2620 *)
2621 gt_cv_int_divbyzero_sigfpe="guessing no";;
2622 esac
2623 ])
2624 ])
2625 case "$gt_cv_int_divbyzero_sigfpe" in
2626 *yes) value=1;;
2627 *) value=0;;
2628 esac
2629 AC_DEFINE_UNQUOTED(INTDIV0_RAISES_SIGFPE, $value,
2630 [Define if integer division by zero raises signal SIGFPE.])
2631 ])
2632 # inttypes.m4 serial 1 (gettext-0.11.4)
2633 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2634 dnl This file is free software, distributed under the terms of the GNU
2635 dnl General Public License. As a special exception to the GNU General
2636 dnl Public License, this file may be distributed as part of a program
2637 dnl that contains a configuration script generated by Autoconf, under
2638 dnl the same distribution terms as the rest of that program.
2639
2640 dnl From Paul Eggert.
2641
2642 # Define HAVE_INTTYPES_H if <inttypes.h> exists and doesn't clash with
2643 # <sys/types.h>.
2644
2645 AC_DEFUN([gt_HEADER_INTTYPES_H],
2646 [
2647 AC_CACHE_CHECK([for inttypes.h], gt_cv_header_inttypes_h,
2648 [
2649 AC_TRY_COMPILE(
2650 [#include <sys/types.h>
2651 #include <inttypes.h>],
2652 [], gt_cv_header_inttypes_h=yes, gt_cv_header_inttypes_h=no)
2653 ])
2654 if test $gt_cv_header_inttypes_h = yes; then
2655 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
2656 [Define if <inttypes.h> exists and doesn't clash with <sys/types.h>.])
2657 fi
2658 ])
2659 # inttypes_h.m4 serial 5 (gettext-0.12)
2660 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
2661 dnl This file is free software, distributed under the terms of the GNU
2662 dnl General Public License. As a special exception to the GNU General
2663 dnl Public License, this file may be distributed as part of a program
2664 dnl that contains a configuration script generated by Autoconf, under
2665 dnl the same distribution terms as the rest of that program.
2666
2667 dnl From Paul Eggert.
2668
2669 # Define HAVE_INTTYPES_H_WITH_UINTMAX if <inttypes.h> exists,
2670 # doesn't clash with <sys/types.h>, and declares uintmax_t.
2671
2672 AC_DEFUN([jm_AC_HEADER_INTTYPES_H],
2673 [
2674 AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
2675 [AC_TRY_COMPILE(
2676 [#include <sys/types.h>
2677 #include <inttypes.h>],
2678 [uintmax_t i = (uintmax_t) -1;],
2679 jm_ac_cv_header_inttypes_h=yes,
2680 jm_ac_cv_header_inttypes_h=no)])
2681 if test $jm_ac_cv_header_inttypes_h = yes; then
2682 AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H_WITH_UINTMAX, 1,
2683 [Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
2684 and declares uintmax_t. ])
2685 fi
2686 ])
2687 # inttypes-pri.m4 serial 1 (gettext-0.11.4)
2688 dnl Copyright (C) 1997-2002 Free Software Foundation, Inc.
2689 dnl This file is free software, distributed under the terms of the GNU
2690 dnl General Public License. As a special exception to the GNU General
2691 dnl Public License, this file may be distributed as part of a program
2692 dnl that contains a configuration script generated by Autoconf, under
2693 dnl the same distribution terms as the rest of that program.
2694
2695 dnl From Bruno Haible.
2696
2697 # Define PRI_MACROS_BROKEN if <inttypes.h> exists and defines the PRI*
2698 # macros to non-string values. This is the case on AIX 4.3.3.
2699
2700 AC_DEFUN([gt_INTTYPES_PRI],
2701 [
2702 AC_REQUIRE([gt_HEADER_INTTYPES_H])
2703 if test $gt_cv_header_inttypes_h = yes; then
2704 AC_CACHE_CHECK([whether the inttypes.h PRIxNN macros are broken],
2705 gt_cv_inttypes_pri_broken,
2706 [
2707 AC_TRY_COMPILE([#include <inttypes.h>
2708 #ifdef PRId32
2709 char *p = PRId32;
2710 #endif
2711 ], [], gt_cv_inttypes_pri_broken=no, gt_cv_inttypes_pri_broken=yes)
2712 ])
2713 fi
2714 if test "$gt_cv_inttypes_pri_broken" = yes; then
2715 AC_DEFINE_UNQUOTED(PRI_MACROS_BROKEN, 1,
2716 [Define if <inttypes.h> exists and defines unusable PRI* macros.])
2717 fi
2718 ])
2719 # isc-posix.m4 serial 2 (gettext-0.11.2)
2720 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2721 dnl This file is free software, distributed under the terms of the GNU
2722 dnl General Public License. As a special exception to the GNU General
2723 dnl Public License, this file may be distributed as part of a program
2724 dnl that contains a configuration script generated by Autoconf, under
2725 dnl the same distribution terms as the rest of that program.
2726
2727 # This file is not needed with autoconf-2.53 and newer. Remove it in 2005.
2728
2729 # This test replaces the one in autoconf.
2730 # Currently this macro should have the same name as the autoconf macro
2731 # because gettext's gettext.m4 (distributed in the automake package)
2732 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
2733 # give these diagnostics:
2734 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2735 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2736
2737 undefine([AC_ISC_POSIX])
2738
2739 AC_DEFUN([AC_ISC_POSIX],
2740 [
2741 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2742 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2743 ]
2744 )
2745 # lcmessage.m4 serial 3 (gettext-0.11.3)
2746 dnl Copyright (C) 1995-2002 Free Software Foundation, Inc.
2747 dnl This file is free software, distributed under the terms of the GNU
2748 dnl General Public License. As a special exception to the GNU General
2749 dnl Public License, this file may be distributed as part of a program
2750 dnl that contains a configuration script generated by Autoconf, under
2751 dnl the same distribution terms as the rest of that program.
2752 dnl
2753 dnl This file can can be used in projects which are not available under
2754 dnl the GNU General Public License or the GNU Library General Public
2755 dnl License but which still want to provide support for the GNU gettext
2756 dnl functionality.
2757 dnl Please note that the actual code of the GNU gettext library is covered
2758 dnl by the GNU Library General Public License, and the rest of the GNU
2759 dnl gettext package package is covered by the GNU General Public License.
2760 dnl They are *not* in the public domain.
2761
2762 dnl Authors:
2763 dnl Ulrich Drepper <drepper@cygnus.com>, 1995.
2764
2765 # Check whether LC_MESSAGES is available in <locale.h>.
2766
2767 AC_DEFUN([AM_LC_MESSAGES],
2768 [
2769 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2770 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2771 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2772 if test $am_cv_val_LC_MESSAGES = yes; then
2773 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2774 [Define if your <locale.h> file defines LC_MESSAGES.])
2775 fi
2776 ])
2777 # lib-ld.m4 serial 2 (gettext-0.12)
2778 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
2779 dnl This file is free software, distributed under the terms of the GNU
2780 dnl General Public License. As a special exception to the GNU General
2781 dnl Public License, this file may be distributed as part of a program
2782 dnl that contains a configuration script generated by Autoconf, under
2783 dnl the same distribution terms as the rest of that program.
2784
2785 dnl Subroutines of libtool.m4,
2786 dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
2787 dnl with libtool.m4.
2788
2789 dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
2790 AC_DEFUN([AC_LIB_PROG_LD_GNU],
2791 [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
2792 [# I'd rather use --version here, but apparently some GNU ld's only accept -v.
2793 if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
2794 acl_cv_prog_gnu_ld=yes
2795 else
2796 acl_cv_prog_gnu_ld=no
2797 fi])
2798 with_gnu_ld=$acl_cv_prog_gnu_ld
2799 ])
2800
2801 dnl From libtool-1.4. Sets the variable LD.
2802 AC_DEFUN([AC_LIB_PROG_LD],
2803 [AC_ARG_WITH(gnu-ld,
2804 [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
2805 test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
2806 AC_REQUIRE([AC_PROG_CC])dnl
2807 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2808 # Prepare PATH_SEPARATOR.
2809 # The user is always right.
2810 if test "${PATH_SEPARATOR+set}" != set; then
2811 echo "#! /bin/sh" >conf$$.sh
2812 echo "exit 0" >>conf$$.sh
2813 chmod +x conf$$.sh
2814 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
2815 PATH_SEPARATOR=';'
2816 else
2817 PATH_SEPARATOR=:
2818 fi
2819 rm -f conf$$.sh
2820 fi
2821 ac_prog=ld
2822 if test "$GCC" = yes; then
2823 # Check if gcc -print-prog-name=ld gives a path.
2824 AC_MSG_CHECKING([for ld used by GCC])
2825 case $host in
2826 *-*-mingw*)
2827 # gcc leaves a trailing carriage return which upsets mingw
2828 ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
2829 *)
2830 ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
2831 esac
2832 case $ac_prog in
2833 # Accept absolute paths.
2834 [[\\/]* | [A-Za-z]:[\\/]*)]
2835 [re_direlt='/[^/][^/]*/\.\./']
2836 # Canonicalize the path of ld
2837 ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
2838 while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
2839 ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
2840 done
2841 test -z "$LD" && LD="$ac_prog"
2842 ;;
2843 "")
2844 # If it fails, then pretend we aren't using GCC.
2845 ac_prog=ld
2846 ;;
2847 *)
2848 # If it is relative, then search for the first ld in PATH.
2849 with_gnu_ld=unknown
2850 ;;
2851 esac
2852 elif test "$with_gnu_ld" = yes; then
2853 AC_MSG_CHECKING([for GNU ld])
2854 else
2855 AC_MSG_CHECKING([for non-GNU ld])
2856 fi
2857 AC_CACHE_VAL(acl_cv_path_LD,
2858 [if test -z "$LD"; then
2859 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
2860 for ac_dir in $PATH; do
2861 test -z "$ac_dir" && ac_dir=.
2862 if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
2863 acl_cv_path_LD="$ac_dir/$ac_prog"
2864 # Check to see if the program is GNU ld. I'd rather use --version,
2865 # but apparently some GNU ld's only accept -v.
2866 # Break only if it was the GNU/non-GNU ld that we prefer.
2867 if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
2868 test "$with_gnu_ld" != no && break
2869 else
2870 test "$with_gnu_ld" != yes && break
2871 fi
2872 fi
2873 done
2874 IFS="$ac_save_ifs"
2875 else
2876 acl_cv_path_LD="$LD" # Let the user override the test with a path.
2877 fi])
2878 LD="$acl_cv_path_LD"
2879 if test -n "$LD"; then
2880 AC_MSG_RESULT($LD)
2881 else
2882 AC_MSG_RESULT(no)
2883 fi
2884 test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
2885 AC_LIB_PROG_LD_GNU
2886 ])
2887 # lib-link.m4 serial 4 (gettext-0.12)
2888 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
2889 dnl This file is free software, distributed under the terms of the GNU
2890 dnl General Public License. As a special exception to the GNU General
2891 dnl Public License, this file may be distributed as part of a program
2892 dnl that contains a configuration script generated by Autoconf, under
2893 dnl the same distribution terms as the rest of that program.
2894
2895 dnl From Bruno Haible.
2896
2897 dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
2898 dnl the libraries corresponding to explicit and implicit dependencies.
2899 dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
2900 dnl augments the CPPFLAGS variable.
2901 AC_DEFUN([AC_LIB_LINKFLAGS],
2902 [
2903 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2904 AC_REQUIRE([AC_LIB_RPATH])
2905 define([Name],[translit([$1],[./-], [___])])
2906 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2907 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2908 AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
2909 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2910 ac_cv_lib[]Name[]_libs="$LIB[]NAME"
2911 ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
2912 ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
2913 ])
2914 LIB[]NAME="$ac_cv_lib[]Name[]_libs"
2915 LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
2916 INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
2917 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2918 AC_SUBST([LIB]NAME)
2919 AC_SUBST([LTLIB]NAME)
2920 dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
2921 dnl results of this search when this library appears as a dependency.
2922 HAVE_LIB[]NAME=yes
2923 undefine([Name])
2924 undefine([NAME])
2925 ])
2926
2927 dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
2928 dnl searches for libname and the libraries corresponding to explicit and
2929 dnl implicit dependencies, together with the specified include files and
2930 dnl the ability to compile and link the specified testcode. If found, it
2931 dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
2932 dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
2933 dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
2934 dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
2935 AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
2936 [
2937 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
2938 AC_REQUIRE([AC_LIB_RPATH])
2939 define([Name],[translit([$1],[./-], [___])])
2940 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
2941 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
2942
2943 dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
2944 dnl accordingly.
2945 AC_LIB_LINKFLAGS_BODY([$1], [$2])
2946
2947 dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
2948 dnl because if the user has installed lib[]Name and not disabled its use
2949 dnl via --without-lib[]Name-prefix, he wants to use it.
2950 ac_save_CPPFLAGS="$CPPFLAGS"
2951 AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
2952
2953 AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
2954 ac_save_LIBS="$LIBS"
2955 LIBS="$LIBS $LIB[]NAME"
2956 AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
2957 LIBS="$ac_save_LIBS"
2958 ])
2959 if test "$ac_cv_lib[]Name" = yes; then
2960 HAVE_LIB[]NAME=yes
2961 AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
2962 AC_MSG_CHECKING([how to link with lib[]$1])
2963 AC_MSG_RESULT([$LIB[]NAME])
2964 else
2965 HAVE_LIB[]NAME=no
2966 dnl If $LIB[]NAME didn't lead to a usable library, we don't need
2967 dnl $INC[]NAME either.
2968 CPPFLAGS="$ac_save_CPPFLAGS"
2969 LIB[]NAME=
2970 LTLIB[]NAME=
2971 fi
2972 AC_SUBST([HAVE_LIB]NAME)
2973 AC_SUBST([LIB]NAME)
2974 AC_SUBST([LTLIB]NAME)
2975 undefine([Name])
2976 undefine([NAME])
2977 ])
2978
2979 dnl Determine the platform dependent parameters needed to use rpath:
2980 dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
2981 dnl hardcode_direct, hardcode_minus_L.
2982 AC_DEFUN([AC_LIB_RPATH],
2983 [
2984 AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
2985 AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
2986 AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
2987 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
2988 AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
2989 CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
2990 ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
2991 . ./conftest.sh
2992 rm -f ./conftest.sh
2993 acl_cv_rpath=done
2994 ])
2995 wl="$acl_cv_wl"
2996 libext="$acl_cv_libext"
2997 shlibext="$acl_cv_shlibext"
2998 hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
2999 hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
3000 hardcode_direct="$acl_cv_hardcode_direct"
3001 hardcode_minus_L="$acl_cv_hardcode_minus_L"
3002 dnl Determine whether the user wants rpath handling at all.
3003 AC_ARG_ENABLE(rpath,
3004 [ --disable-rpath do not hardcode runtime library paths],
3005 :, enable_rpath=yes)
3006 ])
3007
3008 dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
3009 dnl the libraries corresponding to explicit and implicit dependencies.
3010 dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
3011 AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
3012 [
3013 define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
3014 [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
3015 dnl By default, look in $includedir and $libdir.
3016 use_additional=yes
3017 AC_LIB_WITH_FINAL_PREFIX([
3018 eval additional_includedir=\"$includedir\"
3019 eval additional_libdir=\"$libdir\"
3020 ])
3021 AC_LIB_ARG_WITH([lib$1-prefix],
3022 [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
3023 --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
3024 [
3025 if test "X$withval" = "Xno"; then
3026 use_additional=no
3027 else
3028 if test "X$withval" = "X"; then
3029 AC_LIB_WITH_FINAL_PREFIX([
3030 eval additional_includedir=\"$includedir\"
3031 eval additional_libdir=\"$libdir\"
3032 ])
3033 else
3034 additional_includedir="$withval/include"
3035 additional_libdir="$withval/lib"
3036 fi
3037 fi
3038 ])
3039 dnl Search the library and its dependencies in $additional_libdir and
3040 dnl $LDFLAGS. Using breadth-first-seach.
3041 LIB[]NAME=
3042 LTLIB[]NAME=
3043 INC[]NAME=
3044 rpathdirs=
3045 ltrpathdirs=
3046 names_already_handled=
3047 names_next_round='$1 $2'
3048 while test -n "$names_next_round"; do
3049 names_this_round="$names_next_round"
3050 names_next_round=
3051 for name in $names_this_round; do
3052 already_handled=
3053 for n in $names_already_handled; do
3054 if test "$n" = "$name"; then
3055 already_handled=yes
3056 break
3057 fi
3058 done
3059 if test -z "$already_handled"; then
3060 names_already_handled="$names_already_handled $name"
3061 dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
3062 dnl or AC_LIB_HAVE_LINKFLAGS call.
3063 uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
3064 eval value=\"\$HAVE_LIB$uppername\"
3065 if test -n "$value"; then
3066 if test "$value" = yes; then
3067 eval value=\"\$LIB$uppername\"
3068 test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
3069 eval value=\"\$LTLIB$uppername\"
3070 test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
3071 else
3072 dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
3073 dnl that this library doesn't exist. So just drop it.
3074 :
3075 fi
3076 else
3077 dnl Search the library lib$name in $additional_libdir and $LDFLAGS
3078 dnl and the already constructed $LIBNAME/$LTLIBNAME.
3079 found_dir=
3080 found_la=
3081 found_so=
3082 found_a=
3083 if test $use_additional = yes; then
3084 if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
3085 found_dir="$additional_libdir"
3086 found_so="$additional_libdir/lib$name.$shlibext"
3087 if test -f "$additional_libdir/lib$name.la"; then
3088 found_la="$additional_libdir/lib$name.la"
3089 fi
3090 else
3091 if test -f "$additional_libdir/lib$name.$libext"; then
3092 found_dir="$additional_libdir"
3093 found_a="$additional_libdir/lib$name.$libext"
3094 if test -f "$additional_libdir/lib$name.la"; then
3095 found_la="$additional_libdir/lib$name.la"
3096 fi
3097 fi
3098 fi
3099 fi
3100 if test "X$found_dir" = "X"; then
3101 for x in $LDFLAGS $LTLIB[]NAME; do
3102 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3103 case "$x" in
3104 -L*)
3105 dir=`echo "X$x" | sed -e 's/^X-L//'`
3106 if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
3107 found_dir="$dir"
3108 found_so="$dir/lib$name.$shlibext"
3109 if test -f "$dir/lib$name.la"; then
3110 found_la="$dir/lib$name.la"
3111 fi
3112 else
3113 if test -f "$dir/lib$name.$libext"; then
3114 found_dir="$dir"
3115 found_a="$dir/lib$name.$libext"
3116 if test -f "$dir/lib$name.la"; then
3117 found_la="$dir/lib$name.la"
3118 fi
3119 fi
3120 fi
3121 ;;
3122 esac
3123 if test "X$found_dir" != "X"; then
3124 break
3125 fi
3126 done
3127 fi
3128 if test "X$found_dir" != "X"; then
3129 dnl Found the library.
3130 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
3131 if test "X$found_so" != "X"; then
3132 dnl Linking with a shared library. We attempt to hardcode its
3133 dnl directory into the executable's runpath, unless it's the
3134 dnl standard /usr/lib.
3135 if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
3136 dnl No hardcoding is needed.
3137 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3138 else
3139 dnl Use an explicit option to hardcode DIR into the resulting
3140 dnl binary.
3141 dnl Potentially add DIR to ltrpathdirs.
3142 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3143 haveit=
3144 for x in $ltrpathdirs; do
3145 if test "X$x" = "X$found_dir"; then
3146 haveit=yes
3147 break
3148 fi
3149 done
3150 if test -z "$haveit"; then
3151 ltrpathdirs="$ltrpathdirs $found_dir"
3152 fi
3153 dnl The hardcoding into $LIBNAME is system dependent.
3154 if test "$hardcode_direct" = yes; then
3155 dnl Using DIR/libNAME.so during linking hardcodes DIR into the
3156 dnl resulting binary.
3157 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3158 else
3159 if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
3160 dnl Use an explicit option to hardcode DIR into the resulting
3161 dnl binary.
3162 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3163 dnl Potentially add DIR to rpathdirs.
3164 dnl The rpathdirs will be appended to $LIBNAME at the end.
3165 haveit=
3166 for x in $rpathdirs; do
3167 if test "X$x" = "X$found_dir"; then
3168 haveit=yes
3169 break
3170 fi
3171 done
3172 if test -z "$haveit"; then
3173 rpathdirs="$rpathdirs $found_dir"
3174 fi
3175 else
3176 dnl Rely on "-L$found_dir".
3177 dnl But don't add it if it's already contained in the LDFLAGS
3178 dnl or the already constructed $LIBNAME
3179 haveit=
3180 for x in $LDFLAGS $LIB[]NAME; do
3181 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3182 if test "X$x" = "X-L$found_dir"; then
3183 haveit=yes
3184 break
3185 fi
3186 done
3187 if test -z "$haveit"; then
3188 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
3189 fi
3190 if test "$hardcode_minus_L" != no; then
3191 dnl FIXME: Not sure whether we should use
3192 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3193 dnl here.
3194 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
3195 else
3196 dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
3197 dnl here, because this doesn't fit in flags passed to the
3198 dnl compiler. So give up. No hardcoding. This affects only
3199 dnl very old systems.
3200 dnl FIXME: Not sure whether we should use
3201 dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
3202 dnl here.
3203 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3204 fi
3205 fi
3206 fi
3207 fi
3208 else
3209 if test "X$found_a" != "X"; then
3210 dnl Linking with a static library.
3211 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
3212 else
3213 dnl We shouldn't come here, but anyway it's good to have a
3214 dnl fallback.
3215 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
3216 fi
3217 fi
3218 dnl Assume the include files are nearby.
3219 additional_includedir=
3220 case "$found_dir" in
3221 */lib | */lib/)
3222 basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
3223 additional_includedir="$basedir/include"
3224 ;;
3225 esac
3226 if test "X$additional_includedir" != "X"; then
3227 dnl Potentially add $additional_includedir to $INCNAME.
3228 dnl But don't add it
3229 dnl 1. if it's the standard /usr/include,
3230 dnl 2. if it's /usr/local/include and we are using GCC on Linux,
3231 dnl 3. if it's already present in $CPPFLAGS or the already
3232 dnl constructed $INCNAME,
3233 dnl 4. if it doesn't exist as a directory.
3234 if test "X$additional_includedir" != "X/usr/include"; then
3235 haveit=
3236 if test "X$additional_includedir" = "X/usr/local/include"; then
3237 if test -n "$GCC"; then
3238 case $host_os in
3239 linux*) haveit=yes;;
3240 esac
3241 fi
3242 fi
3243 if test -z "$haveit"; then
3244 for x in $CPPFLAGS $INC[]NAME; do
3245 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3246 if test "X$x" = "X-I$additional_includedir"; then
3247 haveit=yes
3248 break
3249 fi
3250 done
3251 if test -z "$haveit"; then
3252 if test -d "$additional_includedir"; then
3253 dnl Really add $additional_includedir to $INCNAME.
3254 INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
3255 fi
3256 fi
3257 fi
3258 fi
3259 fi
3260 dnl Look for dependencies.
3261 if test -n "$found_la"; then
3262 dnl Read the .la file. It defines the variables
3263 dnl dlname, library_names, old_library, dependency_libs, current,
3264 dnl age, revision, installed, dlopen, dlpreopen, libdir.
3265 save_libdir="$libdir"
3266 case "$found_la" in
3267 */* | *\\*) . "$found_la" ;;
3268 *) . "./$found_la" ;;
3269 esac
3270 libdir="$save_libdir"
3271 dnl We use only dependency_libs.
3272 for dep in $dependency_libs; do
3273 case "$dep" in
3274 -L*)
3275 additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
3276 dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
3277 dnl But don't add it
3278 dnl 1. if it's the standard /usr/lib,
3279 dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
3280 dnl 3. if it's already present in $LDFLAGS or the already
3281 dnl constructed $LIBNAME,
3282 dnl 4. if it doesn't exist as a directory.
3283 if test "X$additional_libdir" != "X/usr/lib"; then
3284 haveit=
3285 if test "X$additional_libdir" = "X/usr/local/lib"; then
3286 if test -n "$GCC"; then
3287 case $host_os in
3288 linux*) haveit=yes;;
3289 esac
3290 fi
3291 fi
3292 if test -z "$haveit"; then
3293 haveit=
3294 for x in $LDFLAGS $LIB[]NAME; do
3295 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3296 if test "X$x" = "X-L$additional_libdir"; then
3297 haveit=yes
3298 break
3299 fi
3300 done
3301 if test -z "$haveit"; then
3302 if test -d "$additional_libdir"; then
3303 dnl Really add $additional_libdir to $LIBNAME.
3304 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
3305 fi
3306 fi
3307 haveit=
3308 for x in $LDFLAGS $LTLIB[]NAME; do
3309 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3310 if test "X$x" = "X-L$additional_libdir"; then
3311 haveit=yes
3312 break
3313 fi
3314 done
3315 if test -z "$haveit"; then
3316 if test -d "$additional_libdir"; then
3317 dnl Really add $additional_libdir to $LTLIBNAME.
3318 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
3319 fi
3320 fi
3321 fi
3322 fi
3323 ;;
3324 -R*)
3325 dir=`echo "X$dep" | sed -e 's/^X-R//'`
3326 if test "$enable_rpath" != no; then
3327 dnl Potentially add DIR to rpathdirs.
3328 dnl The rpathdirs will be appended to $LIBNAME at the end.
3329 haveit=
3330 for x in $rpathdirs; do
3331 if test "X$x" = "X$dir"; then
3332 haveit=yes
3333 break
3334 fi
3335 done
3336 if test -z "$haveit"; then
3337 rpathdirs="$rpathdirs $dir"
3338 fi
3339 dnl Potentially add DIR to ltrpathdirs.
3340 dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
3341 haveit=
3342 for x in $ltrpathdirs; do
3343 if test "X$x" = "X$dir"; then
3344 haveit=yes
3345 break
3346 fi
3347 done
3348 if test -z "$haveit"; then
3349 ltrpathdirs="$ltrpathdirs $dir"
3350 fi
3351 fi
3352 ;;
3353 -l*)
3354 dnl Handle this in the next round.
3355 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
3356 ;;
3357 *.la)
3358 dnl Handle this in the next round. Throw away the .la's
3359 dnl directory; it is already contained in a preceding -L
3360 dnl option.
3361 names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
3362 ;;
3363 *)
3364 dnl Most likely an immediate library name.
3365 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
3366 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
3367 ;;
3368 esac
3369 done
3370 fi
3371 else
3372 dnl Didn't find the library; assume it is in the system directories
3373 dnl known to the linker and runtime loader. (All the system
3374 dnl directories known to the linker should also be known to the
3375 dnl runtime loader, otherwise the system is severely misconfigured.)
3376 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
3377 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
3378 fi
3379 fi
3380 fi
3381 done
3382 done
3383 if test "X$rpathdirs" != "X"; then
3384 if test -n "$hardcode_libdir_separator"; then
3385 dnl Weird platform: only the last -rpath option counts, the user must
3386 dnl pass all path elements in one option. We can arrange that for a
3387 dnl single library, but not when more than one $LIBNAMEs are used.
3388 alldirs=
3389 for found_dir in $rpathdirs; do
3390 alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
3391 done
3392 dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
3393 acl_save_libdir="$libdir"
3394 libdir="$alldirs"
3395 eval flag=\"$hardcode_libdir_flag_spec\"
3396 libdir="$acl_save_libdir"
3397 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3398 else
3399 dnl The -rpath options are cumulative.
3400 for found_dir in $rpathdirs; do
3401 acl_save_libdir="$libdir"
3402 libdir="$found_dir"
3403 eval flag=\"$hardcode_libdir_flag_spec\"
3404 libdir="$acl_save_libdir"
3405 LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
3406 done
3407 fi
3408 fi
3409 if test "X$ltrpathdirs" != "X"; then
3410 dnl When using libtool, the option that works for both libraries and
3411 dnl executables is -R. The -R options are cumulative.
3412 for found_dir in $ltrpathdirs; do
3413 LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
3414 done
3415 fi
3416 ])
3417
3418 dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
3419 dnl unless already present in VAR.
3420 dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
3421 dnl contains two or three consecutive elements that belong together.
3422 AC_DEFUN([AC_LIB_APPENDTOVAR],
3423 [
3424 for element in [$2]; do
3425 haveit=
3426 for x in $[$1]; do
3427 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3428 if test "X$x" = "X$element"; then
3429 haveit=yes
3430 break
3431 fi
3432 done
3433 if test -z "$haveit"; then
3434 [$1]="${[$1]}${[$1]:+ }$element"
3435 fi
3436 done
3437 ])
3438 # lib-prefix.m4 serial 2 (gettext-0.12)
3439 dnl Copyright (C) 2001-2003 Free Software Foundation, Inc.
3440 dnl This file is free software, distributed under the terms of the GNU
3441 dnl General Public License. As a special exception to the GNU General
3442 dnl Public License, this file may be distributed as part of a program
3443 dnl that contains a configuration script generated by Autoconf, under
3444 dnl the same distribution terms as the rest of that program.
3445
3446 dnl From Bruno Haible.
3447
3448 dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
3449 dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
3450 dnl require excessive bracketing.
3451 ifdef([AC_HELP_STRING],
3452 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
3453 [AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
3454
3455 dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
3456 dnl to access previously installed libraries. The basic assumption is that
3457 dnl a user will want packages to use other packages he previously installed
3458 dnl with the same --prefix option.
3459 dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
3460 dnl libraries, but is otherwise very convenient.
3461 AC_DEFUN([AC_LIB_PREFIX],
3462 [
3463 AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
3464 AC_REQUIRE([AC_PROG_CC])
3465 AC_REQUIRE([AC_CANONICAL_HOST])
3466 AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
3467 dnl By default, look in $includedir and $libdir.
3468 use_additional=yes
3469 AC_LIB_WITH_FINAL_PREFIX([
3470 eval additional_includedir=\"$includedir\"
3471 eval additional_libdir=\"$libdir\"
3472 ])
3473 AC_LIB_ARG_WITH([lib-prefix],
3474 [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
3475 --without-lib-prefix don't search for libraries in includedir and libdir],
3476 [
3477 if test "X$withval" = "Xno"; then
3478 use_additional=no
3479 else
3480 if test "X$withval" = "X"; then
3481 AC_LIB_WITH_FINAL_PREFIX([
3482 eval additional_includedir=\"$includedir\"
3483 eval additional_libdir=\"$libdir\"
3484 ])
3485 else
3486 additional_includedir="$withval/include"
3487 additional_libdir="$withval/lib"
3488 fi
3489 fi
3490 ])
3491 if test $use_additional = yes; then
3492 dnl Potentially add $additional_includedir to $CPPFLAGS.
3493 dnl But don't add it
3494 dnl 1. if it's the standard /usr/include,
3495 dnl 2. if it's already present in $CPPFLAGS,
3496 dnl 3. if it's /usr/local/include and we are using GCC on Linux,
3497 dnl 4. if it doesn't exist as a directory.
3498 if test "X$additional_includedir" != "X/usr/include"; then
3499 haveit=
3500 for x in $CPPFLAGS; do
3501 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3502 if test "X$x" = "X-I$additional_includedir"; then
3503 haveit=yes
3504 break
3505 fi
3506 done
3507 if test -z "$haveit"; then
3508 if test "X$additional_includedir" = "X/usr/local/include"; then
3509 if test -n "$GCC"; then
3510 case $host_os in
3511 linux*) haveit=yes;;
3512 esac
3513 fi
3514 fi
3515 if test -z "$haveit"; then
3516 if test -d "$additional_includedir"; then
3517 dnl Really add $additional_includedir to $CPPFLAGS.
3518 CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
3519 fi
3520 fi
3521 fi
3522 fi
3523 dnl Potentially add $additional_libdir to $LDFLAGS.
3524 dnl But don't add it
3525 dnl 1. if it's the standard /usr/lib,
3526 dnl 2. if it's already present in $LDFLAGS,
3527 dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
3528 dnl 4. if it doesn't exist as a directory.
3529 if test "X$additional_libdir" != "X/usr/lib"; then
3530 haveit=
3531 for x in $LDFLAGS; do
3532 AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
3533 if test "X$x" = "X-L$additional_libdir"; then
3534 haveit=yes
3535 break
3536 fi
3537 done
3538 if test -z "$haveit"; then
3539 if test "X$additional_libdir" = "X/usr/local/lib"; then
3540 if test -n "$GCC"; then
3541 case $host_os in
3542 linux*) haveit=yes;;
3543 esac
3544 fi
3545 fi
3546 if test -z "$haveit"; then
3547 if test -d "$additional_libdir"; then
3548 dnl Really add $additional_libdir to $LDFLAGS.
3549 LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
3550 fi
3551 fi
3552 fi
3553 fi
3554 fi
3555 ])
3556
3557 dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
3558 dnl acl_final_exec_prefix, containing the values to which $prefix and
3559 dnl $exec_prefix will expand at the end of the configure script.
3560 AC_DEFUN([AC_LIB_PREPARE_PREFIX],
3561 [
3562 dnl Unfortunately, prefix and exec_prefix get only finally determined
3563 dnl at the end of configure.
3564 if test "X$prefix" = "XNONE"; then
3565 acl_final_prefix="$ac_default_prefix"
3566 else
3567 acl_final_prefix="$prefix"
3568 fi
3569 if test "X$exec_prefix" = "XNONE"; then
3570 acl_final_exec_prefix='${prefix}'
3571 else
3572 acl_final_exec_prefix="$exec_prefix"
3573 fi
3574 acl_save_prefix="$prefix"
3575 prefix="$acl_final_prefix"
3576 eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
3577 prefix="$acl_save_prefix"
3578 ])
3579
3580 dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
3581 dnl variables prefix and exec_prefix bound to the values they will have
3582 dnl at the end of the configure script.
3583 AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
3584 [
3585 acl_save_prefix="$prefix"
3586 prefix="$acl_final_prefix"
3587 acl_save_exec_prefix="$exec_prefix"
3588 exec_prefix="$acl_final_exec_prefix"
3589 $1
3590 exec_prefix="$acl_save_exec_prefix"
3591 prefix="$acl_save_prefix"
3592 ])
3593 # nls.m4 serial 1 (gettext-0.12)
3594 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3595 dnl This file is free software, distributed under the terms of the GNU
3596 dnl General Public License. As a special exception to the GNU General
3597 dnl Public License, this file may be distributed as part of a program
3598 dnl that contains a configuration script generated by Autoconf, under
3599 dnl the same distribution terms as the rest of that program.
3600 dnl
3601 dnl This file can can be used in projects which are not available under
3602 dnl the GNU General Public License or the GNU Library General Public
3603 dnl License but which still want to provide support for the GNU gettext
3604 dnl functionality.
3605 dnl Please note that the actual code of the GNU gettext library is covered
3606 dnl by the GNU Library General Public License, and the rest of the GNU
3607 dnl gettext package package is covered by the GNU General Public License.
3608 dnl They are *not* in the public domain.
3609
3610 dnl Authors:
3611 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3612 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3613
3614 AC_DEFUN([AM_NLS],
3615 [
3616 AC_MSG_CHECKING([whether NLS is requested])
3617 dnl Default is enabled NLS
3618 AC_ARG_ENABLE(nls,
3619 [ --disable-nls do not use Native Language Support],
3620 USE_NLS=$enableval, USE_NLS=yes)
3621 AC_MSG_RESULT($USE_NLS)
3622 AC_SUBST(USE_NLS)
3623 ])
3624
3625 AC_DEFUN([AM_MKINSTALLDIRS],
3626 [
3627 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
3628 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
3629 dnl Try to locate it.
3630 MKINSTALLDIRS=
3631 if test -n "$ac_aux_dir"; then
3632 case "$ac_aux_dir" in
3633 /*) MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" ;;
3634 *) MKINSTALLDIRS="\$(top_builddir)/$ac_aux_dir/mkinstalldirs" ;;
3635 esac
3636 fi
3637 if test -z "$MKINSTALLDIRS"; then
3638 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
3639 fi
3640 AC_SUBST(MKINSTALLDIRS)
3641 ])
3642 # po.m4 serial 1 (gettext-0.12)
3643 dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
3644 dnl This file is free software, distributed under the terms of the GNU
3645 dnl General Public License. As a special exception to the GNU General
3646 dnl Public License, this file may be distributed as part of a program
3647 dnl that contains a configuration script generated by Autoconf, under
3648 dnl the same distribution terms as the rest of that program.
3649 dnl
3650 dnl This file can can be used in projects which are not available under
3651 dnl the GNU General Public License or the GNU Library General Public
3652 dnl License but which still want to provide support for the GNU gettext
3653 dnl functionality.
3654 dnl Please note that the actual code of the GNU gettext library is covered
3655 dnl by the GNU Library General Public License, and the rest of the GNU
3656 dnl gettext package package is covered by the GNU General Public License.
3657 dnl They are *not* in the public domain.
3658
3659 dnl Authors:
3660 dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
3661 dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
3662
3663 dnl Checks for all prerequisites of the po subdirectory.
3664 AC_DEFUN([AM_PO_SUBDIRS],
3665 [
3666 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
3667 AC_REQUIRE([AC_PROG_INSTALL])dnl
3668 AC_REQUIRE([AM_MKINSTALLDIRS])dnl
3669 AC_REQUIRE([AM_NLS])dnl
3670
3671 dnl Perform the following tests also if --disable-nls has been given,
3672 dnl because they are needed for "make dist" to work.
3673
3674 dnl Search for GNU msgfmt in the PATH.
3675 dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions.
3676 dnl The second test excludes FreeBSD msgfmt.
3677 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
3678 [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 &&
3679 (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)],
3680 :)
3681 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
3682
3683 dnl Search for GNU xgettext 0.12 or newer in the PATH.
3684 dnl The first test excludes Solaris xgettext and early GNU xgettext versions.
3685 dnl The second test excludes FreeBSD xgettext.
3686 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
3687 [$ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3688 (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)],
3689 :)
3690 dnl Remove leftover from FreeBSD xgettext call.
3691 rm -f messages.po
3692
3693 dnl Search for GNU msgmerge 0.11 or newer in the PATH.
3694 AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge,
3695 [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :)
3696
3697 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3698 dnl Test whether we really found GNU msgfmt.
3699 if test "$GMSGFMT" != ":"; then
3700 dnl If it is no GNU msgfmt we define it as : so that the
3701 dnl Makefiles still can work.
3702 if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 &&
3703 (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
3704 : ;
3705 else
3706 GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'`
3707 AC_MSG_RESULT(
3708 [found $GMSGFMT program is not GNU msgfmt; ignore it])
3709 GMSGFMT=":"
3710 fi
3711 fi
3712
3713 dnl This could go away some day; the PATH_PROG_WITH_TEST already does it.
3714 dnl Test whether we really found GNU xgettext.
3715 if test "$XGETTEXT" != ":"; then
3716 dnl If it is no GNU xgettext we define it as : so that the
3717 dnl Makefiles still can work.
3718 if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >/dev/null 2>&1 &&
3719 (if $XGETTEXT --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then
3720 : ;
3721 else
3722 AC_MSG_RESULT(
3723 [found xgettext program is not GNU xgettext; ignore it])
3724 XGETTEXT=":"
3725 fi
3726 dnl Remove leftover from FreeBSD xgettext call.
3727 rm -f messages.po
3728 fi
3729
3730 AC_OUTPUT_COMMANDS([
3731 for ac_file in $CONFIG_FILES; do
3732 # Support "outfile[:infile[:infile...]]"
3733 case "$ac_file" in
3734 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
3735 esac
3736 # PO directories have a Makefile.in generated from Makefile.in.in.
3737 case "$ac_file" in */Makefile.in)
3738 # Adjust a relative srcdir.
3739 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
3740 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
3741 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
3742 # In autoconf-2.13 it is called $ac_given_srcdir.
3743 # In autoconf-2.50 it is called $srcdir.
3744 test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir"
3745 case "$ac_given_srcdir" in
3746 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
3747 /*) top_srcdir="$ac_given_srcdir" ;;
3748 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
3749 esac
3750 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
3751 rm -f "$ac_dir/POTFILES"
3752 test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES"
3753 cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES"
3754 POMAKEFILEDEPS="POTFILES.in"
3755 # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend
3756 # on $ac_dir but don't depend on user-specified configuration
3757 # parameters.
3758 if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then
3759 # The LINGUAS file contains the set of available languages.
3760 if test -n "$OBSOLETE_ALL_LINGUAS"; then
3761 test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete"
3762 fi
3763 ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"`
3764 # Hide the ALL_LINGUAS assigment from automake.
3765 eval 'ALL_LINGUAS''=$ALL_LINGUAS_'
3766 POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS"
3767 else
3768 # The set of available languages was given in configure.in.
3769 eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS'
3770 fi
3771 case "$ac_given_srcdir" in
3772 .) srcdirpre= ;;
3773 *) srcdirpre='$(srcdir)/' ;;
3774 esac
3775 POFILES=
3776 GMOFILES=
3777 UPDATEPOFILES=
3778 DUMMYPOFILES=
3779 for lang in $ALL_LINGUAS; do
3780 POFILES="$POFILES $srcdirpre$lang.po"
3781 GMOFILES="$GMOFILES $srcdirpre$lang.gmo"
3782 UPDATEPOFILES="$UPDATEPOFILES $lang.po-update"
3783 DUMMYPOFILES="$DUMMYPOFILES $lang.nop"
3784 done
3785 # CATALOGS depends on both $ac_dir and the user's LINGUAS
3786 # environment variable.
3787 INST_LINGUAS=
3788 if test -n "$ALL_LINGUAS"; then
3789 for presentlang in $ALL_LINGUAS; do
3790 useit=no
3791 if test "%UNSET%" != "$LINGUAS"; then
3792 desiredlanguages="$LINGUAS"
3793 else
3794 desiredlanguages="$ALL_LINGUAS"
3795 fi
3796 for desiredlang in $desiredlanguages; do
3797 # Use the presentlang catalog if desiredlang is
3798 # a. equal to presentlang, or
3799 # b. a variant of presentlang (because in this case,
3800 # presentlang can be used as a fallback for messages
3801 # which are not translated in the desiredlang catalog).
3802 case "$desiredlang" in
3803 "$presentlang"*) useit=yes;;
3804 esac
3805 done
3806 if test $useit = yes; then
3807 INST_LINGUAS="$INST_LINGUAS $presentlang"
3808 fi
3809 done
3810 fi
3811 CATALOGS=
3812 if test -n "$INST_LINGUAS"; then
3813 for lang in $INST_LINGUAS; do
3814 CATALOGS="$CATALOGS $lang.gmo"
3815 done
3816 fi
3817 test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile"
3818 sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
3819 for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do
3820 if test -f "$f"; then
3821 case "$f" in
3822 *.orig | *.bak | *~) ;;
3823 *) cat "$f" >> "$ac_dir/Makefile" ;;
3824 esac
3825 fi
3826 done
3827 fi
3828 ;;
3829 esac
3830 done],
3831 [# Capture the value of obsolete ALL_LINGUAS because we need it to compute
3832 # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it
3833 # from automake.
3834 eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"'
3835 # Capture the value of LINGUAS because we need it to compute CATALOGS.
3836 LINGUAS="${LINGUAS-%UNSET%}"
3837 ])
3838 ])
3839 # progtest.m4 serial 3 (gettext-0.12)
3840 dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
3841 dnl This file is free software, distributed under the terms of the GNU
3842 dnl General Public License. As a special exception to the GNU General
3843 dnl Public License, this file may be distributed as part of a program
3844 dnl that contains a configuration script generated by Autoconf, under
3845 dnl the same distribution terms as the rest of that program.
3846 dnl
3847 dnl This file can can be used in projects which are not available under
3848 dnl the GNU General Public License or the GNU Library General Public
3849 dnl License but which still want to provide support for the GNU gettext
3850 dnl functionality.
3851 dnl Please note that the actual code of the GNU gettext library is covered
3852 dnl by the GNU Library General Public License, and the rest of the GNU
3853 dnl gettext package package is covered by the GNU General Public License.
3854 dnl They are *not* in the public domain.
3855
3856 dnl Authors:
3857 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
3858
3859 # Search path for a program which passes the given test.
3860
3861 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
3862 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
3863 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
3864 [
3865 # Prepare PATH_SEPARATOR.
3866 # The user is always right.
3867 if test "${PATH_SEPARATOR+set}" != set; then
3868 echo "#! /bin/sh" >conf$$.sh
3869 echo "exit 0" >>conf$$.sh
3870 chmod +x conf$$.sh
3871 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
3872 PATH_SEPARATOR=';'
3873 else
3874 PATH_SEPARATOR=:
3875 fi
3876 rm -f conf$$.sh
3877 fi
3878
3879 # Find out how to test for executable files. Don't use a zero-byte file,
3880 # as systems may use methods other than mode bits to determine executability.
3881 cat >conf$$.file <<_ASEOF
3882 #! /bin/sh
3883 exit 0
3884 _ASEOF
3885 chmod +x conf$$.file
3886 if test -x conf$$.file >/dev/null 2>&1; then
3887 ac_executable_p="test -x"
3888 else
3889 ac_executable_p="test -f"
3890 fi
3891 rm -f conf$$.file
3892
3893 # Extract the first word of "$2", so it can be a program name with args.
3894 set dummy $2; ac_word=[$]2
3895 AC_MSG_CHECKING([for $ac_word])
3896 AC_CACHE_VAL(ac_cv_path_$1,
3897 [case "[$]$1" in
3898 [[\\/]]* | ?:[[\\/]]*)
3899 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
3900 ;;
3901 *)
3902 ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
3903 for ac_dir in ifelse([$5], , $PATH, [$5]); do
3904 IFS="$ac_save_IFS"
3905 test -z "$ac_dir" && ac_dir=.
3906 for ac_exec_ext in '' $ac_executable_extensions; do
3907 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
3908 if [$3]; then
3909 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
3910 break 2
3911 fi
3912 fi
3913 done
3914 done
3915 IFS="$ac_save_IFS"
3916 dnl If no 4th arg is given, leave the cache variable unset,
3917 dnl so AC_PATH_PROGS will keep looking.
3918 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
3919 ])dnl
3920 ;;
3921 esac])dnl
3922 $1="$ac_cv_path_$1"
3923 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
3924 AC_MSG_RESULT([$]$1)
3925 else
3926 AC_MSG_RESULT(no)
3927 fi
3928 AC_SUBST($1)dnl
3929 ])
3930 # stdint_h.m4 serial 3 (gettext-0.12)
3931 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3932 dnl This file is free software, distributed under the terms of the GNU
3933 dnl General Public License. As a special exception to the GNU General
3934 dnl Public License, this file may be distributed as part of a program
3935 dnl that contains a configuration script generated by Autoconf, under
3936 dnl the same distribution terms as the rest of that program.
3937
3938 dnl From Paul Eggert.
3939
3940 # Define HAVE_STDINT_H_WITH_UINTMAX if <stdint.h> exists,
3941 # doesn't clash with <sys/types.h>, and declares uintmax_t.
3942
3943 AC_DEFUN([jm_AC_HEADER_STDINT_H],
3944 [
3945 AC_CACHE_CHECK([for stdint.h], jm_ac_cv_header_stdint_h,
3946 [AC_TRY_COMPILE(
3947 [#include <sys/types.h>
3948 #include <stdint.h>],
3949 [uintmax_t i = (uintmax_t) -1;],
3950 jm_ac_cv_header_stdint_h=yes,
3951 jm_ac_cv_header_stdint_h=no)])
3952 if test $jm_ac_cv_header_stdint_h = yes; then
3953 AC_DEFINE_UNQUOTED(HAVE_STDINT_H_WITH_UINTMAX, 1,
3954 [Define if <stdint.h> exists, doesn't clash with <sys/types.h>,
3955 and declares uintmax_t. ])
3956 fi
3957 ])
3958 # uintmax_t.m4 serial 7 (gettext-0.12)
3959 dnl Copyright (C) 1997-2003 Free Software Foundation, Inc.
3960 dnl This file is free software, distributed under the terms of the GNU
3961 dnl General Public License. As a special exception to the GNU General
3962 dnl Public License, this file may be distributed as part of a program
3963 dnl that contains a configuration script generated by Autoconf, under
3964 dnl the same distribution terms as the rest of that program.
3965
3966 dnl From Paul Eggert.
3967
3968 AC_PREREQ(2.13)
3969
3970 # Define uintmax_t to 'unsigned long' or 'unsigned long long'
3971 # if it is not already defined in <stdint.h> or <inttypes.h>.
3972
3973 AC_DEFUN([jm_AC_TYPE_UINTMAX_T],
3974 [
3975 AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
3976 AC_REQUIRE([jm_AC_HEADER_STDINT_H])
3977 if test $jm_ac_cv_header_inttypes_h = no && test $jm_ac_cv_header_stdint_h = no; then
3978 AC_REQUIRE([jm_AC_TYPE_UNSIGNED_LONG_LONG])
3979 test $ac_cv_type_unsigned_long_long = yes \
3980 && ac_type='unsigned long long' \
3981 || ac_type='unsigned long'
3982 AC_DEFINE_UNQUOTED(uintmax_t, $ac_type,
3983 [Define to unsigned long or unsigned long long
3984 if <stdint.h> and <inttypes.h> don't define.])
3985 else
3986 AC_DEFINE(HAVE_UINTMAX_T, 1,
3987 [Define if you have the 'uintmax_t' type in <stdint.h> or <inttypes.h>.])
3988 fi
3989 ])
3990 # ulonglong.m4 serial 2 (fileutils-4.0.32, gettext-0.10.40)
3991 dnl Copyright (C) 1999-2002 Free Software Foundation, Inc.
3992 dnl This file is free software, distributed under the terms of the GNU
3993 dnl General Public License. As a special exception to the GNU General
3994 dnl Public License, this file may be distributed as part of a program
3995 dnl that contains a configuration script generated by Autoconf, under
3996 dnl the same distribution terms as the rest of that program.
3997
3998 dnl From Paul Eggert.
3999
4000 AC_DEFUN([jm_AC_TYPE_UNSIGNED_LONG_LONG],
4001 [
4002 AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
4003 [AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
4004 [unsigned long long ullmax = (unsigned long long) -1;
4005 return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
4006 ac_cv_type_unsigned_long_long=yes,
4007 ac_cv_type_unsigned_long_long=no)])
4008 if test $ac_cv_type_unsigned_long_long = yes; then
4009 AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1,
4010 [Define if you have the unsigned long long type.])
4011 fi
4012 ])
4013
4014 dnl From gnulib
4015 AC_DEFUN([BASH_FUNC_FPURGE],
4016 [
4017 AC_CHECK_FUNCS_ONCE([fpurge])
4018 AC_CHECK_FUNCS_ONCE([__fpurge])
4019 AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
4020 ])