This commit was generated by cvs2svn to track changes on a CVS vendor
[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() calls popen()])
689 AC_CACHE_VAL(bash_cv_getcwd_calls_popen,
690 [AC_TRY_RUN([
691 #include <stdio.h>
692 #ifdef HAVE_UNISTD_H
693 #include <unistd.h>
694 #endif
695
696 #ifndef __STDC__
697 #ifndef const
698 #define const
699 #endif
700 #endif
701
702 int popen_called;
703
704 FILE *
705 popen(command, type)
706 const char *command;
707 const char *type;
708 {
709 popen_called = 1;
710 return (FILE *)NULL;
711 }
712
713 FILE *_popen(command, type)
714 const char *command;
715 const char *type;
716 {
717 return (popen (command, type));
718 }
719
720 int
721 pclose(stream)
722 FILE *stream;
723 {
724 return 0;
725 }
726
727 int
728 _pclose(stream)
729 FILE *stream;
730 {
731 return 0;
732 }
733
734 main()
735 {
736 char lbuf[32];
737 popen_called = 0;
738 getcwd(lbuf, 32);
739 exit (popen_called);
740 }
741 ], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
742 [AC_MSG_WARN(cannot check whether getcwd calls popen if cross compiling -- defaulting to no)
743 bash_cv_getcwd_calls_popen=no]
744 )])
745 AC_MSG_RESULT($bash_cv_getcwd_calls_popen)
746 if test $bash_cv_getcwd_calls_popen = yes; then
747 AC_DEFINE(GETCWD_BROKEN)
748 AC_LIBOBJ(getcwd)
749 fi
750 ])
751
752 dnl
753 dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
754 dnl system, we can't use AC_PREREQ
755 dnl
756 AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
757 [if test "X$bash_cv_have_gethostbyname" = "X"; then
758 _bash_needmsg=yes
759 else
760 AC_MSG_CHECKING(for gethostbyname in socket library)
761 _bash_needmsg=
762 fi
763 AC_CACHE_VAL(bash_cv_have_gethostbyname,
764 [AC_TRY_LINK([#include <netdb.h>],
765 [ struct hostent *hp;
766 hp = gethostbyname("localhost");
767 ], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)]
768 )
769 if test "X$_bash_needmsg" = Xyes; then
770 AC_MSG_CHECKING(for gethostbyname in socket library)
771 fi
772 AC_MSG_RESULT($bash_cv_have_gethostbyname)
773 if test "$bash_cv_have_gethostbyname" = yes; then
774 AC_DEFINE(HAVE_GETHOSTBYNAME)
775 fi
776 ])
777
778 AC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH,
779 [AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
780 AC_CACHE_VAL(bash_cv_fnm_extmatch,
781 [AC_TRY_RUN([
782 #include <fnmatch.h>
783
784 main()
785 {
786 #ifdef FNM_EXTMATCH
787 exit (0);
788 #else
789 exit (1);
790 #endif
791 }
792 ], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no,
793 [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
794 bash_cv_fnm_extmatch=no])
795 ])
796 AC_MSG_RESULT($bash_cv_fnm_extmatch)
797 if test $bash_cv_fnm_extmatch = yes; then
798 AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
799 fi
800 ])
801
802 AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
803 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
804 AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
805 AC_CACHE_VAL(bash_cv_func_sigsetjmp,
806 [AC_TRY_RUN([
807 #ifdef HAVE_UNISTD_H
808 #include <unistd.h>
809 #endif
810 #include <sys/types.h>
811 #include <signal.h>
812 #include <setjmp.h>
813
814 main()
815 {
816 #if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
817 exit (1);
818 #else
819
820 int code;
821 sigset_t set, oset;
822 sigjmp_buf xx;
823
824 /* get the mask */
825 sigemptyset(&set);
826 sigemptyset(&oset);
827 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set);
828 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
829
830 /* save it */
831 code = sigsetjmp(xx, 1);
832 if (code)
833 exit(0); /* could get sigmask and compare to oset here. */
834
835 /* change it */
836 sigaddset(&set, SIGINT);
837 sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
838
839 /* and siglongjmp */
840 siglongjmp(xx, 10);
841 exit(1);
842 #endif
843 }], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
844 [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing)
845 bash_cv_func_sigsetjmp=missing]
846 )])
847 AC_MSG_RESULT($bash_cv_func_sigsetjmp)
848 if test $bash_cv_func_sigsetjmp = present; then
849 AC_DEFINE(HAVE_POSIX_SIGSETJMP)
850 fi
851 ])
852
853 AC_DEFUN(BASH_FUNC_STRCOLL,
854 [
855 AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
856 AC_CACHE_VAL(bash_cv_func_strcoll_broken,
857 [AC_TRY_RUN([
858 #include <stdio.h>
859 #if defined (HAVE_LOCALE_H)
860 #include <locale.h>
861 #endif
862
863 main(c, v)
864 int c;
865 char *v[];
866 {
867 int r1, r2;
868 char *deflocale, *defcoll;
869
870 #ifdef HAVE_SETLOCALE
871 deflocale = setlocale(LC_ALL, "");
872 defcoll = setlocale(LC_COLLATE, "");
873 #endif
874
875 #ifdef HAVE_STRCOLL
876 /* These two values are taken from tests/glob-test. */
877 r1 = strcoll("abd", "aXd");
878 #else
879 r1 = 0;
880 #endif
881 r2 = strcmp("abd", "aXd");
882
883 /* These two should both be greater than 0. It is permissible for
884 a system to return different values, as long as the sign is the
885 same. */
886
887 /* Exit with 1 (failure) if these two values are both > 0, since
888 this tests whether strcoll(3) is broken with respect to strcmp(3)
889 in the default locale. */
890 exit (r1 > 0 && r2 > 0);
891 }
892 ], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
893 [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
894 bash_cv_func_strcoll_broken=no]
895 )])
896 AC_MSG_RESULT($bash_cv_func_strcoll_broken)
897 if test $bash_cv_func_strcoll_broken = yes; then
898 AC_DEFINE(STRCOLL_BROKEN)
899 fi
900 ])
901
902 AC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT,
903 [AC_MSG_CHECKING([for printf floating point output in hex notation])
904 AC_CACHE_VAL(bash_cv_printf_a_format,
905 [AC_TRY_RUN([
906 #include <stdio.h>
907 #include <string.h>
908
909 int
910 main()
911 {
912 double y = 0.0;
913 char abuf[1024];
914
915 sprintf(abuf, "%A", y);
916 exit(strchr(abuf, 'P') == (char *)0);
917 }
918 ], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no,
919 [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
920 bash_cv_printf_a_format=no]
921 )])
922 AC_MSG_RESULT($bash_cv_printf_a_format)
923 if test $bash_cv_printf_a_format = yes; then
924 AC_DEFINE(HAVE_PRINTF_A_FORMAT)
925 fi
926 ])
927
928 AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
929 [
930 AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
931 #include <sys/types.h>
932 #include <termios.h>
933 ])
934 ])
935
936 AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
937 [
938 AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
939 #include <sys/types.h>
940 #include <termio.h>
941 ])
942 ])
943
944 dnl
945 dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
946 dnl
947 dnl sets bash_cv_struct_stat_st_blocks
948 dnl
949 dnl unused for now; we'll see how AC_CHECK_MEMBERS works
950 dnl
951 AC_DEFUN(BASH_STRUCT_ST_BLOCKS,
952 [
953 AC_MSG_CHECKING([for struct stat.st_blocks])
954 AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
955 [AC_TRY_COMPILE(
956 [
957 #include <sys/types.h>
958 #include <sys/stat.h>
959 ],
960 [
961 main()
962 {
963 static struct stat a;
964 if (a.st_blocks) return 0;
965 return 0;
966 }
967 ], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no)
968 ])
969 AC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
970 if test "$bash_cv_struct_stat_st_blocks" = "yes"; then
971 AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
972 fi
973 ])
974
975 AC_DEFUN(BASH_CHECK_LIB_TERMCAP,
976 [
977 if test "X$bash_cv_termcap_lib" = "X"; then
978 _bash_needmsg=yes
979 else
980 AC_MSG_CHECKING(which library has the termcap functions)
981 _bash_needmsg=
982 fi
983 AC_CACHE_VAL(bash_cv_termcap_lib,
984 [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
985 [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
986 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
987 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
988 bash_cv_termcap_lib=gnutermcap)])])])])
989 if test "X$_bash_needmsg" = "Xyes"; then
990 AC_MSG_CHECKING(which library has the termcap functions)
991 fi
992 AC_MSG_RESULT(using $bash_cv_termcap_lib)
993 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
994 LDFLAGS="$LDFLAGS -L./lib/termcap"
995 TERMCAP_LIB="./lib/termcap/libtermcap.a"
996 TERMCAP_DEP="./lib/termcap/libtermcap.a"
997 elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
998 TERMCAP_LIB=-ltermcap
999 TERMCAP_DEP=
1000 elif test $bash_cv_termcap_lib = libtinfo; then
1001 TERMCAP_LIB=-ltinfo
1002 TERMCAP_DEP=
1003 elif test $bash_cv_termcap_lib = libncurses; then
1004 TERMCAP_LIB=-lncurses
1005 TERMCAP_DEP=
1006 else
1007 TERMCAP_LIB=-lcurses
1008 TERMCAP_DEP=
1009 fi
1010 ])
1011
1012 dnl
1013 dnl Check for the presence of getpeername in libsocket.
1014 dnl If libsocket is present, check for libnsl and add it to LIBS if
1015 dnl it's there, since most systems with libsocket require linking
1016 dnl with libnsl as well. This should only be called if getpeername
1017 dnl was not found in libc.
1018 dnl
1019 dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
1020 dnl AS WELL
1021 dnl
1022 AC_DEFUN(BASH_CHECK_LIB_SOCKET,
1023 [
1024 if test "X$bash_cv_have_socklib" = "X"; then
1025 _bash_needmsg=
1026 else
1027 AC_MSG_CHECKING(for socket library)
1028 _bash_needmsg=yes
1029 fi
1030 AC_CACHE_VAL(bash_cv_have_socklib,
1031 [AC_CHECK_LIB(socket, getpeername,
1032 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
1033 if test "X$_bash_needmsg" = Xyes; then
1034 AC_MSG_RESULT($bash_cv_have_socklib)
1035 _bash_needmsg=
1036 fi
1037 if test $bash_cv_have_socklib = yes; then
1038 # check for libnsl, add it to LIBS if present
1039 if test "X$bash_cv_have_libnsl" = "X"; then
1040 _bash_needmsg=
1041 else
1042 AC_MSG_CHECKING(for libnsl)
1043 _bash_needmsg=yes
1044 fi
1045 AC_CACHE_VAL(bash_cv_have_libnsl,
1046 [AC_CHECK_LIB(nsl, t_open,
1047 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1048 if test "X$_bash_needmsg" = Xyes; then
1049 AC_MSG_RESULT($bash_cv_have_libnsl)
1050 _bash_needmsg=
1051 fi
1052 if test $bash_cv_have_libnsl = yes; then
1053 LIBS="-lsocket -lnsl $LIBS"
1054 else
1055 LIBS="-lsocket $LIBS"
1056 fi
1057 AC_DEFINE(HAVE_LIBSOCKET)
1058 AC_DEFINE(HAVE_GETPEERNAME)
1059 fi
1060 ])
1061
1062 AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
1063 [AC_REQUIRE([AC_HEADER_DIRENT])
1064 AC_MSG_CHECKING(if struct dirent has a d_ino member)
1065 AC_CACHE_VAL(bash_cv_dirent_has_dino,
1066 [AC_TRY_COMPILE([
1067 #include <stdio.h>
1068 #include <sys/types.h>
1069 #ifdef HAVE_UNISTD_H
1070 # include <unistd.h>
1071 #endif /* HAVE_UNISTD_H */
1072 #if defined(HAVE_DIRENT_H)
1073 # include <dirent.h>
1074 #else
1075 # define dirent direct
1076 # ifdef HAVE_SYS_NDIR_H
1077 # include <sys/ndir.h>
1078 # endif /* SYSNDIR */
1079 # ifdef HAVE_SYS_DIR_H
1080 # include <sys/dir.h>
1081 # endif /* SYSDIR */
1082 # ifdef HAVE_NDIR_H
1083 # include <ndir.h>
1084 # endif
1085 #endif /* HAVE_DIRENT_H */
1086 ],[
1087 struct dirent d; int z; z = d.d_ino;
1088 ], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)])
1089 AC_MSG_RESULT($bash_cv_dirent_has_dino)
1090 if test $bash_cv_dirent_has_dino = yes; then
1091 AC_DEFINE(STRUCT_DIRENT_HAS_D_INO)
1092 fi
1093 ])
1094
1095 AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
1096 [AC_REQUIRE([AC_HEADER_DIRENT])
1097 AC_MSG_CHECKING(if struct dirent has a d_fileno member)
1098 AC_CACHE_VAL(bash_cv_dirent_has_d_fileno,
1099 [AC_TRY_COMPILE([
1100 #include <stdio.h>
1101 #include <sys/types.h>
1102 #ifdef HAVE_UNISTD_H
1103 # include <unistd.h>
1104 #endif /* HAVE_UNISTD_H */
1105 #if defined(HAVE_DIRENT_H)
1106 # include <dirent.h>
1107 #else
1108 # define dirent direct
1109 # ifdef HAVE_SYS_NDIR_H
1110 # include <sys/ndir.h>
1111 # endif /* SYSNDIR */
1112 # ifdef HAVE_SYS_DIR_H
1113 # include <sys/dir.h>
1114 # endif /* SYSDIR */
1115 # ifdef HAVE_NDIR_H
1116 # include <ndir.h>
1117 # endif
1118 #endif /* HAVE_DIRENT_H */
1119 ],[
1120 struct dirent d; int z; z = d.d_fileno;
1121 ], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)])
1122 AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
1123 if test $bash_cv_dirent_has_d_fileno = yes; then
1124 AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO)
1125 fi
1126 ])
1127
1128 AC_DEFUN(BASH_STRUCT_TIMEVAL,
1129 [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1130 AC_CACHE_VAL(bash_cv_struct_timeval,
1131 [
1132 AC_EGREP_HEADER(struct timeval, sys/time.h,
1133 bash_cv_struct_timeval=yes,
1134 AC_EGREP_HEADER(struct timeval, time.h,
1135 bash_cv_struct_timeval=yes,
1136 bash_cv_struct_timeval=no))
1137 ])
1138 AC_MSG_RESULT($bash_cv_struct_timeval)
1139 if test $bash_cv_struct_timeval = yes; then
1140 AC_DEFINE(HAVE_TIMEVAL)
1141 fi
1142 ])
1143
1144 AC_DEFUN(BASH_STRUCT_WINSIZE,
1145 [AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1146 AC_CACHE_VAL(bash_cv_struct_winsize_header,
1147 [AC_TRY_COMPILE([#include <sys/types.h>
1148 #include <sys/ioctl.h>], [struct winsize x;],
1149 bash_cv_struct_winsize_header=ioctl_h,
1150 [AC_TRY_COMPILE([#include <sys/types.h>
1151 #include <termios.h>], [struct winsize x;],
1152 bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other)
1153 ])])
1154 if test $bash_cv_struct_winsize_header = ioctl_h; then
1155 AC_MSG_RESULT(sys/ioctl.h)
1156 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1157 elif test $bash_cv_struct_winsize_header = termios_h; then
1158 AC_MSG_RESULT(termios.h)
1159 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1160 else
1161 AC_MSG_RESULT(not found)
1162 fi
1163 ])
1164
1165 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1166 AC_DEFUN(BASH_SYS_SIGNAL_VINTAGE,
1167 [AC_REQUIRE([AC_TYPE_SIGNAL])
1168 AC_MSG_CHECKING(for type of signal functions)
1169 AC_CACHE_VAL(bash_cv_signal_vintage,
1170 [
1171 AC_TRY_LINK([#include <signal.h>],[
1172 sigset_t ss;
1173 struct sigaction sa;
1174 sigemptyset(&ss); sigsuspend(&ss);
1175 sigaction(SIGINT, &sa, (struct sigaction *) 0);
1176 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1177 ], bash_cv_signal_vintage=posix,
1178 [
1179 AC_TRY_LINK([#include <signal.h>], [
1180 int mask = sigmask(SIGINT);
1181 sigsetmask(mask); sigblock(mask); sigpause(mask);
1182 ], bash_cv_signal_vintage=4.2bsd,
1183 [
1184 AC_TRY_LINK([
1185 #include <signal.h>
1186 RETSIGTYPE foo() { }], [
1187 int mask = sigmask(SIGINT);
1188 sigset(SIGINT, foo); sigrelse(SIGINT);
1189 sighold(SIGINT); sigpause(SIGINT);
1190 ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7
1191 )]
1192 )]
1193 )
1194 ])
1195 AC_MSG_RESULT($bash_cv_signal_vintage)
1196 if test "$bash_cv_signal_vintage" = posix; then
1197 AC_DEFINE(HAVE_POSIX_SIGNALS)
1198 elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1199 AC_DEFINE(HAVE_BSD_SIGNALS)
1200 elif test "$bash_cv_signal_vintage" = svr3; then
1201 AC_DEFINE(HAVE_USG_SIGHOLD)
1202 fi
1203 ])
1204
1205 dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1206 AC_DEFUN(BASH_SYS_PGRP_SYNC,
1207 [AC_REQUIRE([AC_FUNC_GETPGRP])
1208 AC_MSG_CHECKING(whether pgrps need synchronization)
1209 AC_CACHE_VAL(bash_cv_pgrp_pipe,
1210 [AC_TRY_RUN([
1211 #ifdef HAVE_UNISTD_H
1212 # include <unistd.h>
1213 #endif
1214 main()
1215 {
1216 # ifdef GETPGRP_VOID
1217 # define getpgID() getpgrp()
1218 # else
1219 # define getpgID() getpgrp(0)
1220 # define setpgid(x,y) setpgrp(x,y)
1221 # endif
1222 int pid1, pid2, fds[2];
1223 int status;
1224 char ok;
1225
1226 switch (pid1 = fork()) {
1227 case -1:
1228 exit(1);
1229 case 0:
1230 setpgid(0, getpid());
1231 exit(0);
1232 }
1233 setpgid(pid1, pid1);
1234
1235 sleep(2); /* let first child die */
1236
1237 if (pipe(fds) < 0)
1238 exit(2);
1239
1240 switch (pid2 = fork()) {
1241 case -1:
1242 exit(3);
1243 case 0:
1244 setpgid(0, pid1);
1245 ok = getpgID() == pid1;
1246 write(fds[1], &ok, 1);
1247 exit(0);
1248 }
1249 setpgid(pid2, pid1);
1250
1251 close(fds[1]);
1252 if (read(fds[0], &ok, 1) != 1)
1253 exit(4);
1254 wait(&status);
1255 wait(&status);
1256 exit(ok ? 0 : 5);
1257 }
1258 ], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
1259 [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1260 bash_cv_pgrp_pipe=no])
1261 ])
1262 AC_MSG_RESULT($bash_cv_pgrp_pipe)
1263 if test $bash_cv_pgrp_pipe = yes; then
1264 AC_DEFINE(PGRP_PIPE)
1265 fi
1266 ])
1267
1268 AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,
1269 [AC_REQUIRE([AC_TYPE_SIGNAL])
1270 AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1271 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
1272 AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
1273 [AC_TRY_RUN([
1274 #include <signal.h>
1275 #ifdef HAVE_UNISTD_H
1276 #include <unistd.h>
1277 #endif
1278
1279 typedef RETSIGTYPE sigfunc();
1280
1281 int nsigint;
1282
1283 #ifdef HAVE_POSIX_SIGNALS
1284 sigfunc *
1285 set_signal_handler(sig, handler)
1286 int sig;
1287 sigfunc *handler;
1288 {
1289 struct sigaction act, oact;
1290 act.sa_handler = handler;
1291 act.sa_flags = 0;
1292 sigemptyset (&act.sa_mask);
1293 sigemptyset (&oact.sa_mask);
1294 sigaction (sig, &act, &oact);
1295 return (oact.sa_handler);
1296 }
1297 #else
1298 #define set_signal_handler(s, h) signal(s, h)
1299 #endif
1300
1301 RETSIGTYPE
1302 sigint(s)
1303 int s;
1304 {
1305 nsigint++;
1306 }
1307
1308 main()
1309 {
1310 nsigint = 0;
1311 set_signal_handler(SIGINT, sigint);
1312 kill((int)getpid(), SIGINT);
1313 kill((int)getpid(), SIGINT);
1314 exit(nsigint != 2);
1315 }
1316 ], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
1317 [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
1318 bash_cv_must_reinstall_sighandlers=no]
1319 )])
1320 AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
1321 if test $bash_cv_must_reinstall_sighandlers = yes; then
1322 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
1323 fi
1324 ])
1325
1326 dnl check that some necessary job control definitions are present
1327 AC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,
1328 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1329 AC_MSG_CHECKING(for presence of necessary job control definitions)
1330 AC_CACHE_VAL(bash_cv_job_control_missing,
1331 [AC_TRY_RUN([
1332 #include <sys/types.h>
1333 #ifdef HAVE_SYS_WAIT_H
1334 #include <sys/wait.h>
1335 #endif
1336 #ifdef HAVE_UNISTD_H
1337 #include <unistd.h>
1338 #endif
1339 #include <signal.h>
1340
1341 /* Add more tests in here as appropriate. */
1342 main()
1343 {
1344 /* signal type */
1345 #if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
1346 exit(1);
1347 #endif
1348
1349 /* signals and tty control. */
1350 #if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
1351 exit (1);
1352 #endif
1353
1354 /* process control */
1355 #if !defined (WNOHANG) || !defined (WUNTRACED)
1356 exit(1);
1357 #endif
1358
1359 /* Posix systems have tcgetpgrp and waitpid. */
1360 #if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
1361 exit(1);
1362 #endif
1363
1364 #if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
1365 exit(1);
1366 #endif
1367
1368 /* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
1369 #if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
1370 exit(1);
1371 #endif
1372
1373 exit(0);
1374 }], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
1375 [AC_MSG_WARN(cannot check job control if cross-compiling -- defaulting to missing)
1376 bash_cv_job_control_missing=missing]
1377 )])
1378 AC_MSG_RESULT($bash_cv_job_control_missing)
1379 if test $bash_cv_job_control_missing = missing; then
1380 AC_DEFINE(JOB_CONTROL_MISSING)
1381 fi
1382 ])
1383
1384 dnl check whether named pipes are present
1385 dnl this requires a previous check for mkfifo, but that is awkward to specify
1386 AC_DEFUN(BASH_SYS_NAMED_PIPES,
1387 [AC_MSG_CHECKING(for presence of named pipes)
1388 AC_CACHE_VAL(bash_cv_sys_named_pipes,
1389 [AC_TRY_RUN([
1390 #include <sys/types.h>
1391 #include <sys/stat.h>
1392 #ifdef HAVE_UNISTD_H
1393 #include <unistd.h>
1394 #endif
1395
1396 /* Add more tests in here as appropriate. */
1397 main()
1398 {
1399 int fd, err;
1400
1401 #if defined (HAVE_MKFIFO)
1402 exit (0);
1403 #endif
1404
1405 #if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
1406 exit (1);
1407 #endif
1408
1409 #if defined (NeXT)
1410 exit (1);
1411 #endif
1412 err = mkdir("/tmp/bash-aclocal", 0700);
1413 if (err < 0) {
1414 perror ("mkdir");
1415 exit(1);
1416 }
1417 fd = mknod ("/tmp/bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
1418 if (fd == -1) {
1419 rmdir ("/tmp/bash-aclocal");
1420 exit (1);
1421 }
1422 close(fd);
1423 unlink ("/tmp/bash-aclocal/sh-np-autoconf");
1424 rmdir ("/tmp/bash-aclocal");
1425 exit(0);
1426 }], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
1427 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
1428 bash_cv_sys_named_pipes=missing]
1429 )])
1430 AC_MSG_RESULT($bash_cv_sys_named_pipes)
1431 if test $bash_cv_sys_named_pipes = missing; then
1432 AC_DEFINE(NAMED_PIPES_MISSING)
1433 fi
1434 ])
1435
1436 AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,
1437 [AC_MSG_CHECKING(for default mail directory)
1438 AC_CACHE_VAL(bash_cv_mail_dir,
1439 [if test -d /var/mail; then
1440 bash_cv_mail_dir=/var/mail
1441 elif test -d /var/spool/mail; then
1442 bash_cv_mail_dir=/var/spool/mail
1443 elif test -d /usr/mail; then
1444 bash_cv_mail_dir=/usr/mail
1445 elif test -d /usr/spool/mail; then
1446 bash_cv_mail_dir=/usr/spool/mail
1447 else
1448 bash_cv_mail_dir=unknown
1449 fi
1450 ])
1451 AC_MSG_RESULT($bash_cv_mail_dir)
1452 AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
1453 ])
1454
1455 AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
1456 [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
1457 AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
1458 [AC_TRY_COMPILE([#include <sys/types.h>
1459 #include <sys/ioctl.h>], [int x = TIOCGWINSZ;],
1460 bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)])
1461 AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
1462 if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
1463 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
1464 fi
1465 ])
1466
1467 AC_DEFUN(BASH_HAVE_TIOCSTAT,
1468 [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
1469 AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
1470 [AC_TRY_COMPILE([#include <sys/types.h>
1471 #include <sys/ioctl.h>], [int x = TIOCSTAT;],
1472 bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)])
1473 AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
1474 if test $bash_cv_tiocstat_in_ioctl = yes; then
1475 AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
1476 fi
1477 ])
1478
1479 AC_DEFUN(BASH_HAVE_FIONREAD,
1480 [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
1481 AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
1482 [AC_TRY_COMPILE([#include <sys/types.h>
1483 #include <sys/ioctl.h>], [int x = FIONREAD;],
1484 bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)])
1485 AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
1486 if test $bash_cv_fionread_in_ioctl = yes; then
1487 AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
1488 fi
1489 ])
1490
1491 dnl
1492 dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
1493 dnl require a definition of speed_t each time <termcap.h> is included,
1494 dnl but you can only get speed_t if you include <termios.h> (on some
1495 dnl versions) or <sys/types.h> (on others).
1496 dnl
1497 AC_DEFUN(BASH_CHECK_SPEED_T,
1498 [AC_MSG_CHECKING(for speed_t in sys/types.h)
1499 AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
1500 [AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;],
1501 bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)])
1502 AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
1503 if test $bash_cv_speed_t_in_sys_types = yes; then
1504 AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1505 fi
1506 ])
1507
1508 AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
1509 [AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
1510 AC_CACHE_VAL(bash_cv_getpw_declared,
1511 [AC_EGREP_CPP(getpwuid,
1512 [
1513 #include <sys/types.h>
1514 #ifdef HAVE_UNISTD_H
1515 # include <unistd.h>
1516 #endif
1517 #include <pwd.h>
1518 ],
1519 bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
1520 AC_MSG_RESULT($bash_cv_getpw_declared)
1521 if test $bash_cv_getpw_declared = yes; then
1522 AC_DEFINE(HAVE_GETPW_DECLS)
1523 fi
1524 ])
1525
1526 AC_DEFUN(BASH_CHECK_DEV_FD,
1527 [AC_MSG_CHECKING(whether /dev/fd is available)
1528 AC_CACHE_VAL(bash_cv_dev_fd,
1529 [if test -d /dev/fd && test -r /dev/fd/0; then
1530 bash_cv_dev_fd=standard
1531 elif test -d /proc/self/fd && test -r /proc/self/fd/0; then
1532 bash_cv_dev_fd=whacky
1533 else
1534 bash_cv_dev_fd=absent
1535 fi
1536 ])
1537 AC_MSG_RESULT($bash_cv_dev_fd)
1538 if test $bash_cv_dev_fd = "standard"; then
1539 AC_DEFINE(HAVE_DEV_FD)
1540 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1541 elif test $bash_cv_dev_fd = "whacky"; then
1542 AC_DEFINE(HAVE_DEV_FD)
1543 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1544 fi
1545 ])
1546
1547 AC_DEFUN(BASH_CHECK_DEV_STDIN,
1548 [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
1549 AC_CACHE_VAL(bash_cv_dev_stdin,
1550 [if test -d /dev/fd && test -r /dev/stdin; then
1551 bash_cv_dev_stdin=present
1552 elif test -d /proc/self/fd && test -r /dev/stdin; then
1553 bash_cv_dev_stdin=present
1554 else
1555 bash_cv_dev_stdin=absent
1556 fi
1557 ])
1558 AC_MSG_RESULT($bash_cv_dev_stdin)
1559 if test $bash_cv_dev_stdin = "present"; then
1560 AC_DEFINE(HAVE_DEV_STDIN)
1561 fi
1562 ])
1563
1564 dnl
1565 dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1566 dnl
1567 AC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,
1568 [AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1569 AC_CACHE_VAL(bash_cv_kernel_rlimit,
1570 [AC_TRY_COMPILE([
1571 #include <sys/types.h>
1572 #include <sys/resource.h>
1573 ],
1574 [
1575 int f;
1576 f = RLIMIT_DATA;
1577 ], bash_cv_kernel_rlimit=no,
1578 [AC_TRY_COMPILE([
1579 #include <sys/types.h>
1580 #define _KERNEL
1581 #include <sys/resource.h>
1582 #undef _KERNEL
1583 ],
1584 [
1585 int f;
1586 f = RLIMIT_DATA;
1587 ], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
1588 )])
1589 AC_MSG_RESULT($bash_cv_kernel_rlimit)
1590 if test $bash_cv_kernel_rlimit = yes; then
1591 AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1592 fi
1593 ])
1594
1595 dnl
1596 dnl Check for 64-bit off_t -- used for malloc alignment
1597 dnl
1598 dnl C does not allow duplicate case labels, so the compile will fail if
1599 dnl sizeof(off_t) is > 4.
1600 dnl
1601 AC_DEFUN(BASH_CHECK_OFF_T_64,
1602 [AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1603 AC_TRY_COMPILE([
1604 #ifdef HAVE_UNISTD_H
1605 #include <unistd.h>
1606 #endif
1607 #include <sys/types.h>
1608 ],[
1609 switch (0) case 0: case (sizeof (off_t) <= 4):;
1610 ], bash_cv_off_t_64=no, bash_cv_off_t_64=yes))
1611 if test $bash_cv_off_t_64 = yes; then
1612 AC_DEFINE(HAVE_OFF_T_64)
1613 fi])
1614
1615 AC_DEFUN(BASH_CHECK_RTSIGS,
1616 [AC_MSG_CHECKING(for unusable real-time signals due to large values)
1617 AC_CACHE_VAL(bash_cv_unusable_rtsigs,
1618 [AC_TRY_RUN([
1619 #include <sys/types.h>
1620 #include <signal.h>
1621
1622 #ifndef NSIG
1623 # define NSIG 64
1624 #endif
1625
1626 main ()
1627 {
1628 int n_sigs = 2 * NSIG;
1629 #ifdef SIGRTMIN
1630 int rtmin = SIGRTMIN;
1631 #else
1632 int rtmin = 0;
1633 #endif
1634
1635 exit(rtmin < n_sigs);
1636 }], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no,
1637 [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
1638 bash_cv_unusable_rtsigs=yes]
1639 )])
1640 AC_MSG_RESULT($bash_cv_unusable_rtsigs)
1641 if test $bash_cv_unusable_rtsigs = yes; then
1642 AC_DEFINE(UNUSABLE_RT_SIGNALS)
1643 fi
1644 ])
1645
1646 dnl
1647 dnl check for availability of multibyte characters and functions
1648 dnl
1649 AC_DEFUN(BASH_CHECK_MULTIBYTE,
1650 [
1651 AC_CHECK_HEADERS(wctype.h)
1652 AC_CHECK_HEADERS(wchar.h)
1653 AC_CHECK_HEADERS(langinfo.h)
1654
1655 AC_CHECK_FUNC(mbrtowc, AC_DEFINE(HAVE_MBRTOWC))
1656 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
1657 AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1658 if test "$ac_cv_func_wcwidth" = no && test "$ac_cv_header_wchar_h" = yes; then
1659 WCWIDTH_OBJ=wcwidth.o
1660 else
1661 WCWIDTH_OBJ=
1662 fi
1663 AC_SUBST(WCWIDTH_OBJ)
1664
1665 AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t,
1666 [AC_TRY_LINK(
1667 [#include <wchar.h>],
1668 [int
1669 main ()
1670 {
1671 mbstate_t ps;
1672 return 0;
1673 }], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)])
1674 if test $bash_cv_have_mbstate_t = yes; then
1675 AC_DEFINE(HAVE_MBSTATE_T)
1676 fi
1677
1678 AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset,
1679 [AC_TRY_LINK(
1680 [#include <langinfo.h>],
1681 [char* cs = nl_langinfo(CODESET);],
1682 bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)])
1683 if test $bash_cv_langinfo_codeset = yes; then
1684 AC_DEFINE(HAVE_LANGINFO_CODESET)
1685 fi
1686
1687 ])
1688
1689 dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1690 dnl require:
1691 dnl AC_PROG_CC
1692 dnl BASH_CHECK_LIB_TERMCAP
1693
1694 AC_DEFUN(RL_LIB_READLINE_VERSION,
1695 [
1696 AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1697
1698 AC_MSG_CHECKING([version of installed readline library])
1699
1700 # What a pain in the ass this is.
1701
1702 # save cpp and ld options
1703 _save_CFLAGS="$CFLAGS"
1704 _save_LDFLAGS="$LDFLAGS"
1705 _save_LIBS="$LIBS"
1706
1707 # Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
1708 # allows the caller to do something like $_rl_prefix=$withval if the user
1709 # specifies --with-installed-readline=PREFIX as an argument to configure
1710
1711 if test -z "$ac_cv_rl_prefix"; then
1712 test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1713 fi
1714
1715 eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1716 eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1717
1718 LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1719 CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1720 LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1721
1722 AC_TRY_RUN([
1723 #include <stdio.h>
1724 #include <readline/readline.h>
1725
1726 main()
1727 {
1728 FILE *fp;
1729 fp = fopen("conftest.rlv", "w");
1730 if (fp == 0) exit(1);
1731 fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
1732 fclose(fp);
1733 exit(0);
1734 }
1735 ],
1736 ac_cv_rl_version=`cat conftest.rlv`,
1737 ac_cv_rl_version='0.0',
1738 ac_cv_rl_version='4.2')
1739
1740 CFLAGS="$_save_CFLAGS"
1741 LDFLAGS="$_save_LDFLAGS"
1742 LIBS="$_save_LIBS"
1743
1744 RL_MAJOR=0
1745 RL_MINOR=0
1746
1747 # (
1748 case "$ac_cv_rl_version" in
1749 2*|3*|4*|5*|6*|7*|8*|9*)
1750 RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
1751 RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
1752 ;;
1753 esac
1754
1755 # (((
1756 case $RL_MAJOR in
1757 [[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
1758 [[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
1759 *) _RL_MAJOR=00 ;;
1760 esac
1761
1762 # (((
1763 case $RL_MINOR in
1764 [[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
1765 [[0-9]]) _RL_MINOR=0$RL_MINOR ;;
1766 *) _RL_MINOR=00 ;;
1767 esac
1768
1769 RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1770
1771 # Readline versions greater than 4.2 have these defines in readline.h
1772
1773 if test $ac_cv_rl_version = '0.0' ; then
1774 AC_MSG_WARN([Could not test version of installed readline library.])
1775 elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1776 # set these for use by the caller
1777 RL_PREFIX=$ac_cv_rl_prefix
1778 RL_LIBDIR=$ac_cv_rl_libdir
1779 RL_INCLUDEDIR=$ac_cv_rl_includedir
1780 AC_MSG_RESULT($ac_cv_rl_version)
1781 else
1782
1783 AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1784 AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1785 AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1786
1787 AC_SUBST(RL_VERSION)
1788 AC_SUBST(RL_MAJOR)
1789 AC_SUBST(RL_MINOR)
1790
1791 # set these for use by the caller
1792 RL_PREFIX=$ac_cv_rl_prefix
1793 RL_LIBDIR=$ac_cv_rl_libdir
1794 RL_INCLUDEDIR=$ac_cv_rl_includedir
1795
1796 AC_MSG_RESULT($ac_cv_rl_version)
1797
1798 fi
1799 ])
This page took 0.094435 seconds and 4 git commands to generate.