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