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