2 dnl Bash specific tests
4 dnl Some derived from PDKSH 5.1.3 autoconf tests
6 dnl Copyright (C) 1987-2021 Free Software Foundation, Inc.
10 dnl Check for <inttypes.h>. This is separated out so that it can be
13 dnl BASH_HEADER_INTTYPES
14 AC_DEFUN(BASH_HEADER_INTTYPES,
16 AC_CHECK_HEADERS(inttypes.h)
20 dnl check for typedef'd symbols in header files, but allow the caller to
21 dnl specify the include files to be checked in addition to the default
23 dnl This could be changed to use AC_COMPILE_IFELSE instead of AC_EGREP_CPP
25 dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND])
26 AC_DEFUN(BASH_CHECK_TYPE,
28 AC_REQUIRE([BASH_HEADER_INTTYPES])
29 AC_MSG_CHECKING(for $1)
30 AC_CACHE_VAL(bash_cv_type_$1,
31 [AC_EGREP_CPP($1, [#include <sys/types.h>
45 ], bash_cv_type_$1=yes, bash_cv_type_$1=no)])
46 AC_MSG_RESULT($bash_cv_type_$1)
47 ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then
50 if test $bash_cv_type_$1 = no; then
51 AC_DEFINE_UNQUOTED($1, $3)
56 dnl BASH_CHECK_DECL(FUNC)
58 dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like
61 AC_DEFUN(BASH_CHECK_DECL,
63 AC_REQUIRE([BASH_HEADER_INTTYPES])
67 AC_DEFUN(BASH_DECL_PRINTF,
68 [AC_MSG_CHECKING(for declaration of printf in <stdio.h>)
69 AC_CACHE_VAL(bash_cv_printf_declared,
70 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
73 typedef int (*_bashfunc)(const char *, ...);
75 typedef int (*_bashfunc)();
82 pf = (_bashfunc) printf;
85 ]])], [bash_cv_printf_declared=yes], [bash_cv_printf_declared=no],
86 [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes)
87 bash_cv_printf_declared=yes]
89 AC_MSG_RESULT($bash_cv_printf_declared)
90 if test $bash_cv_printf_declared = yes; then
91 AC_DEFINE(PRINTF_DECLARED)
95 AC_DEFUN(BASH_DECL_SBRK,
96 [AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>)
97 AC_CACHE_VAL(bash_cv_sbrk_declared,
98 [AC_EGREP_HEADER(sbrk, unistd.h,
99 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)])
100 AC_MSG_RESULT($bash_cv_sbrk_declared)
101 if test $bash_cv_sbrk_declared = yes; then
102 AC_DEFINE(SBRK_DECLARED)
107 dnl Check for sys_siglist[] or _sys_siglist[]
109 AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST,
110 [AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h])
111 AC_CACHE_VAL(bash_cv_decl_under_sys_siglist,
112 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
113 #include <sys/types.h>
117 #endif]], [[ char *msg = _sys_siglist[2]; ]])],
118 [bash_cv_decl_under_sys_siglist=yes], [bash_cv_decl_under_sys_siglist=no],
119 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl
120 AC_MSG_RESULT($bash_cv_decl_under_sys_siglist)
121 if test $bash_cv_decl_under_sys_siglist = yes; then
122 AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED)
126 AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
127 [AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
128 AC_MSG_CHECKING([for _sys_siglist in system C library])
129 AC_CACHE_VAL(bash_cv_under_sys_siglist,
130 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
131 #include <sys/types.h>
137 #ifndef UNDER_SYS_SIGLIST_DECLARED
138 extern char *_sys_siglist[];
143 char *msg = (char *)_sys_siglist[2];
147 [bash_cv_under_sys_siglist=yes], [bash_cv_under_sys_siglist=no],
148 [AC_MSG_WARN(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)
149 bash_cv_under_sys_siglist=no]
151 AC_MSG_RESULT($bash_cv_under_sys_siglist)
152 if test $bash_cv_under_sys_siglist = yes; then
153 AC_DEFINE(HAVE_UNDER_SYS_SIGLIST)
157 dnl this defines HAVE_DECL_SYS_SIGLIST
158 AC_DEFUN([BASH_DECL_SYS_SIGLIST],
159 [AC_CHECK_DECLS([sys_siglist],,,
161 /* NetBSD declares sys_siglist in unistd.h. */
168 AC_DEFUN(BASH_SYS_SIGLIST,
169 [AC_REQUIRE([BASH_DECL_SYS_SIGLIST])
170 AC_MSG_CHECKING([for sys_siglist in system C library])
171 AC_CACHE_VAL(bash_cv_sys_siglist,
172 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
173 #include <sys/types.h>
179 #if !HAVE_DECL_SYS_SIGLIST
180 extern char *sys_siglist[];
185 char *msg = sys_siglist[2];
188 ]])], [bash_cv_sys_siglist=yes], [bash_cv_sys_siglist=no],
189 [AC_MSG_WARN(cannot check for sys_siglist if cross compiling -- defaulting to no)
190 bash_cv_sys_siglist=no]
192 AC_MSG_RESULT($bash_cv_sys_siglist)
193 if test $bash_cv_sys_siglist = yes; then
194 AC_DEFINE(HAVE_SYS_SIGLIST)
198 dnl Check for the various permutations of sys_siglist and make sure we
199 dnl compile in siglist.o if they're not defined
200 AC_DEFUN(BASH_CHECK_SYS_SIGLIST, [
201 AC_REQUIRE([BASH_SYS_SIGLIST])
202 AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST])
203 AC_REQUIRE([BASH_FUNC_STRSIGNAL])
204 if test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then
209 AC_SUBST([SIGLIST_O])
212 dnl Check for sys_errlist[] and sys_nerr, check for declaration
213 AC_DEFUN(BASH_SYS_ERRLIST,
214 [AC_MSG_CHECKING([for sys_errlist and sys_nerr])
215 AC_CACHE_VAL(bash_cv_sys_errlist,
216 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
219 extern char *sys_errlist[];
221 char *msg = sys_errlist[sys_nerr - 1];
223 [bash_cv_sys_errlist=yes], [bash_cv_sys_errlist=no]
225 AC_MSG_RESULT($bash_cv_sys_errlist)
226 if test $bash_cv_sys_errlist = yes; then
227 AC_DEFINE(HAVE_SYS_ERRLIST)
232 dnl Check if dup2() does not clear the close on exec flag
234 AC_DEFUN(BASH_FUNC_DUP2_CLOEXEC_CHECK,
235 [AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag)
236 AC_CACHE_VAL(bash_cv_dup2_broken,
237 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
238 #include <sys/types.h>
245 fd1 = open("/dev/null", 2);
246 if (fcntl(fd1, 2, 1) < 0)
251 fl = fcntl(fd2, 1, 0);
252 /* fl will be 1 if dup2 did not reset the close-on-exec flag. */
255 ]])], [bash_cv_dup2_broken=yes], [bash_cv_dup2_broken=no],
256 [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no)
257 bash_cv_dup2_broken=no]
259 AC_MSG_RESULT($bash_cv_dup2_broken)
260 if test $bash_cv_dup2_broken = yes; then
261 AC_DEFINE(DUP2_BROKEN)
265 AC_DEFUN(BASH_FUNC_STRSIGNAL,
266 [AC_MSG_CHECKING([for the existence of strsignal])
267 AC_CACHE_VAL(bash_cv_have_strsignal,
269 [AC_LANG_PROGRAM([[#include <sys/types.h>
271 #include <string.h>]],
272 [[char *s = (char *)strsignal(2);]])],
273 [bash_cv_have_strsignal=yes], [bash_cv_have_strsignal=no])])
274 AC_MSG_RESULT($bash_cv_have_strsignal)
275 if test $bash_cv_have_strsignal = yes; then
276 AC_DEFINE(HAVE_STRSIGNAL)
280 dnl Check to see if opendir will open non-directories (not a nice thing)
281 AC_DEFUN(BASH_FUNC_OPENDIR_CHECK,
282 [AC_REQUIRE([AC_HEADER_DIRENT])dnl
283 AC_MSG_CHECKING(if opendir() opens non-directories)
284 AC_CACHE_VAL(bash_cv_opendir_not_robust,
285 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
287 #include <sys/types.h>
291 #endif /* HAVE_UNISTD_H */
292 #ifdef HAVE_SYS_STAT_H
293 #include <sys/stat.h>
295 #if defined(HAVE_DIRENT_H)
298 # define dirent direct
299 # ifdef HAVE_SYS_NDIR_H
300 # include <sys/ndir.h>
301 # endif /* SYSNDIR */
302 # ifdef HAVE_SYS_DIR_H
303 # include <sys/dir.h>
308 #endif /* HAVE_DIRENT_H */
315 err = mkdir("bash-aclocal", 0700);
320 unlink("bash-aclocal/not_a_directory");
321 fd = open("bash-aclocal/not_a_directory", O_WRONLY|O_CREAT|O_EXCL, 0666);
324 dir = opendir("bash-aclocal/not_a_directory");
325 unlink("bash-aclocal/not_a_directory");
326 rmdir("bash-aclocal");
329 ]])], [bash_cv_opendir_not_robust=yes], [bash_cv_opendir_not_robust=no],
330 [AC_MSG_WARN(cannot check opendir if cross compiling -- defaulting to no)
331 bash_cv_opendir_not_robust=no]
333 AC_MSG_RESULT($bash_cv_opendir_not_robust)
334 if test $bash_cv_opendir_not_robust = yes; then
335 AC_DEFINE(OPENDIR_NOT_ROBUST)
340 dnl A signed 16-bit integer quantity
342 AC_DEFUN(BASH_TYPE_BITS16_T,
344 if test "$ac_cv_sizeof_short" = 2; then
345 AC_CHECK_TYPE(bits16_t, short)
346 elif test "$ac_cv_sizeof_char" = 2; then
347 AC_CHECK_TYPE(bits16_t, char)
349 AC_CHECK_TYPE(bits16_t, short)
354 dnl An unsigned 16-bit integer quantity
356 AC_DEFUN(BASH_TYPE_U_BITS16_T,
358 if test "$ac_cv_sizeof_short" = 2; then
359 AC_CHECK_TYPE(u_bits16_t, unsigned short)
360 elif test "$ac_cv_sizeof_char" = 2; then
361 AC_CHECK_TYPE(u_bits16_t, unsigned char)
363 AC_CHECK_TYPE(u_bits16_t, unsigned short)
368 dnl A signed 32-bit integer quantity
370 AC_DEFUN(BASH_TYPE_BITS32_T,
372 if test "$ac_cv_sizeof_int" = 4; then
373 AC_CHECK_TYPE(bits32_t, int)
374 elif test "$ac_cv_sizeof_long" = 4; then
375 AC_CHECK_TYPE(bits32_t, long)
377 AC_CHECK_TYPE(bits32_t, int)
382 dnl An unsigned 32-bit integer quantity
384 AC_DEFUN(BASH_TYPE_U_BITS32_T,
386 if test "$ac_cv_sizeof_int" = 4; then
387 AC_CHECK_TYPE(u_bits32_t, unsigned int)
388 elif test "$ac_cv_sizeof_long" = 4; then
389 AC_CHECK_TYPE(u_bits32_t, unsigned long)
391 AC_CHECK_TYPE(u_bits32_t, unsigned int)
395 AC_DEFUN(BASH_TYPE_PTRDIFF_T,
397 if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then
398 AC_CHECK_TYPE(ptrdiff_t, int)
399 elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then
400 AC_CHECK_TYPE(ptrdiff_t, long)
401 elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then
402 AC_CHECK_TYPE(ptrdiff_t, [long long])
404 AC_CHECK_TYPE(ptrdiff_t, int)
409 dnl A signed 64-bit quantity
411 AC_DEFUN(BASH_TYPE_BITS64_T,
413 if test "$ac_cv_sizeof_char_p" = 8; then
414 AC_CHECK_TYPE(bits64_t, char *)
415 elif test "$ac_cv_sizeof_double" = 8; then
416 AC_CHECK_TYPE(bits64_t, double)
417 elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then
418 AC_CHECK_TYPE(bits64_t, [long long])
419 elif test "$ac_cv_sizeof_long" = 8; then
420 AC_CHECK_TYPE(bits64_t, long)
422 AC_CHECK_TYPE(bits64_t, double)
426 AC_DEFUN(BASH_SIZEOF_RLIMIT,
427 [AC_MSG_CHECKING(for size of struct rlimit fields)
428 AC_CACHE_VAL(bash_cv_sizeof_rlim_cur,
429 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
430 #ifdef HAVE_SYS_TIME_H
431 #include <sys/time.h>
434 #include <sys/resource.h>
438 exit(sizeof (r.rlim_cur));
440 ]])], [bash_cv_sizeof_rlim_cur=$?], [bash_cv_sizeof_rlim_cur=$?],
441 [AC_MSG_WARN(cannot check size of rlimit fields if cross compiling -- defaulting to long)
442 bash_cv_sizeof_rlim_cur=$ac_cv_sizeof_long]
444 AC_MSG_RESULT($bash_cv_sizeof_rlim_cur)
447 AC_DEFUN(BASH_SIZEOF_QUAD_T,
448 [AC_MSG_CHECKING(for size of quad_t)
449 AC_CACHE_VAL(bash_cv_sizeof_quad_t,
450 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
451 #include <sys/types.h>
454 #include <inttypes.h>
469 ]])], [bash_cv_sizeof_quad_t=$?], [bash_cv_sizeof_quad_t=$?],
470 [AC_MSG_WARN(cannot check size of quad_t if cross compiling -- defaulting to 0)
471 bash_cv_sizeof_quad_t=0]
473 AC_MSG_RESULT($bash_cv_sizeof_quad_t)
477 dnl Type of struct rlimit fields: updated to check POSIX rlim_t and
478 dnl if it doesn't exist determine the best guess based on sizeof(r.rlim_cur)
480 AC_DEFUN(BASH_TYPE_RLIMIT,
481 [AC_MSG_CHECKING(for type of struct rlimit fields)
482 AC_CACHE_VAL(bash_cv_type_rlimit,
483 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
484 #include <sys/types.h>
485 #include <sys/resource.h>]],
488 [bash_cv_type_rlimit=rlim_t], [
491 if test $bash_cv_sizeof_rlim_cur = $ac_cv_sizeof_long; then
492 bash_cv_type_rlimit='unsigned long'
493 elif test $bash_cv_sizeof_rlim_cur = $ac_cv_sizeof_long_long; then
494 bash_cv_type_rlimit='unsigned long long'
495 elif test $bash_cv_sizeof_rlim_cur = $ac_cv_sizeof_int; then
496 bash_cv_type_rlimit='unsigned int'
497 elif test $bash_cv_sizeof_rlim_cur = $bash_cv_sizeof_quad_t; then
498 bash_cv_type_rlimit='quad_t'
500 bash_cv_type_rlimit='unsigned long'
504 AC_MSG_RESULT($bash_cv_type_rlimit)
505 AC_DEFINE_UNQUOTED([RLIMTYPE], [$bash_cv_type_rlimit])
508 AC_DEFUN(BASH_TYPE_SIG_ATOMIC_T,
509 [AC_CACHE_CHECK([for sig_atomic_t in signal.h], ac_cv_have_sig_atomic_t,
512 [[ #include <signal.h> ]],
513 [[ sig_atomic_t x; ]])],
514 [ac_cv_have_sig_atomic_t=yes],[ac_cv_have_sig_atomic_t=no])])
515 if test "$ac_cv_have_sig_atomic_t" = "no"
517 BASH_CHECK_TYPE(sig_atomic_t, [#include <signal.h>], int)
521 AC_DEFUN(BASH_FUNC_LSTAT,
522 [dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an
523 dnl inline function in <sys/stat.h>.
524 AC_CACHE_CHECK([for lstat], bash_cv_func_lstat,
527 #include <sys/types.h>
528 #include <sys/stat.h>
530 [[ lstat(".",(struct stat *)0); ]])],
531 [bash_cv_func_lstat=yes],[bash_cv_func_lstat=no])])
532 if test $bash_cv_func_lstat = yes; then
533 AC_DEFINE(HAVE_LSTAT)
537 AC_DEFUN(BASH_FUNC_INET_ATON,
539 AC_CACHE_CHECK([for inet_aton], bash_cv_func_inet_aton,
540 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
541 #include <sys/types.h>
542 #include <netinet/in.h>
543 #include <arpa/inet.h>
544 struct in_addr ap;]], [[ inet_aton("127.0.0.1", &ap); ]])],
545 [bash_cv_func_inet_aton=yes], [bash_cv_func_inet_aton=no])])
546 if test $bash_cv_func_inet_aton = yes; then
547 AC_DEFINE(HAVE_INET_ATON)
553 AC_DEFUN(BASH_FUNC_GETENV,
554 [AC_MSG_CHECKING(to see if getenv can be redefined)
555 AC_CACHE_VAL(bash_cv_getenv_redef,
556 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
568 #if defined (__linux__) || defined (__bsdi__) || defined (convex)
572 #endif /* !__linux__ && !__bsdi__ && !convex */
580 /* The next allows this program to run, but does not allow bash to link
581 when it redefines getenv. I'm not really interested in figuring out
587 exit(s == 0); /* force optimizer to leave getenv in */
589 ]])], [bash_cv_getenv_redef=yes], [bash_cv_getenv_redef=no],
590 [AC_MSG_WARN(cannot check getenv redefinition if cross compiling -- defaulting to yes)
591 bash_cv_getenv_redef=yes]
593 AC_MSG_RESULT($bash_cv_getenv_redef)
594 if test $bash_cv_getenv_redef = yes; then
595 AC_DEFINE(CAN_REDEFINE_GETENV)
599 # We should check for putenv before calling this
600 AC_DEFUN(BASH_FUNC_STD_PUTENV,
602 AC_REQUIRE([AC_C_PROTOTYPES])
603 AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv,
604 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
617 extern int putenv (char *);
619 extern int putenv ();
621 ]], [[return (putenv == 0);]] )],
622 [bash_cv_std_putenv=yes], [bash_cv_std_putenv=no]
624 if test $bash_cv_std_putenv = yes; then
625 AC_DEFINE(HAVE_STD_PUTENV)
629 # We should check for unsetenv before calling this
630 AC_DEFUN(BASH_FUNC_STD_UNSETENV,
632 AC_REQUIRE([AC_C_PROTOTYPES])
633 AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv,
634 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
647 extern int unsetenv (const char *);
649 extern int unsetenv ();
651 ]], [[return (unsetenv == 0);]] )],
652 [bash_cv_std_unsetenv=yes], [bash_cv_std_unsetenv=no]
654 if test $bash_cv_std_unsetenv = yes; then
655 AC_DEFINE(HAVE_STD_UNSETENV)
659 AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS,
660 [AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize)
661 AC_CACHE_VAL(bash_cv_ulimit_maxfds,
662 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
670 long maxfds = ulimit(4, 0L);
671 exit (maxfds == -1L);
673 ]])], [bash_cv_ulimit_maxfds=yes], [bash_cv_ulimit_maxfds=no],
674 [AC_MSG_WARN(cannot check ulimit if cross compiling -- defaulting to no)
675 bash_cv_ulimit_maxfds=no]
677 AC_MSG_RESULT($bash_cv_ulimit_maxfds)
678 if test $bash_cv_ulimit_maxfds = yes; then
679 AC_DEFINE(ULIMIT_MAXFDS)
683 AC_DEFUN(BASH_FUNC_GETCWD,
684 [AC_MSG_CHECKING([if getcwd() will dynamically allocate memory with 0 size])
685 AC_CACHE_VAL(bash_cv_getcwd_malloc,
686 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
700 ]])], [bash_cv_getcwd_malloc=yes], [bash_cv_getcwd_malloc=no],
701 [AC_MSG_WARN(cannot check whether getcwd allocates memory when cross-compiling -- defaulting to no)
702 bash_cv_getcwd_malloc=no]
704 AC_MSG_RESULT($bash_cv_getcwd_malloc)
705 if test $bash_cv_getcwd_malloc = no; then
706 AC_DEFINE(GETCWD_BROKEN)
712 dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every
713 dnl system, we can't use AC_PREREQ. Only called if we need the socket library
715 AC_DEFUN(BASH_FUNC_GETHOSTBYNAME,
716 [if test "X$bash_cv_have_gethostbyname" = "X"; then
719 AC_MSG_CHECKING(for gethostbyname in socket library)
722 AC_CACHE_VAL(bash_cv_have_gethostbyname,
723 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
727 hp = gethostbyname("localhost");
729 [bash_cv_have_gethostbyname=yes], [bash_cv_have_gethostbyname=no]
731 if test "X$_bash_needmsg" = Xyes; then
732 AC_MSG_CHECKING(for gethostbyname in socket library)
734 AC_MSG_RESULT($bash_cv_have_gethostbyname)
735 if test "$bash_cv_have_gethostbyname" = yes; then
736 AC_DEFINE(HAVE_GETHOSTBYNAME)
740 AC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH,
741 [AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH)
742 AC_CACHE_VAL(bash_cv_fnm_extmatch,
743 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
755 ]])], [bash_cv_fnm_extmatch=yes], [bash_cv_fnm_extmatch=no],
756 [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no)
757 bash_cv_fnm_extmatch=no]
759 AC_MSG_RESULT($bash_cv_fnm_extmatch)
760 if test $bash_cv_fnm_extmatch = yes; then
761 AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH)
765 AC_DEFUN(BASH_FUNC_POSIX_SETJMP,
766 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
767 AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp)
768 AC_CACHE_VAL(bash_cv_func_sigsetjmp,
769 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
773 #include <sys/types.h>
781 #if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS)
786 sigset_t set, oset, nset;
793 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset);
794 /* paranoia -- make sure SIGINT is not blocked */
795 sigdelset (&oset, SIGINT);
796 sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);
799 code = sigsetjmp(xx, 1);
802 sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &nset);
803 /* could compare nset to oset here, but we just look for SIGINT */
804 if (sigismember (&nset, SIGINT))
809 /* change it so that SIGINT is blocked */
810 sigaddset(&set, SIGINT);
811 sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
818 ]])], [bash_cv_func_sigsetjmp=present], [bash_cv_func_sigsetjmp=missing],
819 [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to $bash_cv_posix_signals)
820 if test "$bash_cv_posix_signals" = "yes" ; then
821 bash_cv_func_sigsetjmp=present
823 bash_cv_func_sigsetjmp=missing
826 AC_MSG_RESULT($bash_cv_func_sigsetjmp)
827 if test $bash_cv_func_sigsetjmp = present; then
828 AC_DEFINE(HAVE_POSIX_SIGSETJMP)
832 AC_DEFUN(BASH_FUNC_STRCOLL,
833 [AC_MSG_CHECKING(whether or not strcoll and strcmp differ)
834 AC_CACHE_VAL(bash_cv_func_strcoll_broken,
835 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
837 #if defined (HAVE_LOCALE_H)
849 char *deflocale, *defcoll;
851 #ifdef HAVE_SETLOCALE
852 deflocale = setlocale(LC_ALL, "");
853 defcoll = setlocale(LC_COLLATE, "");
857 /* These two values are taken from tests/glob-test. */
858 r1 = strcoll("abd", "aXd");
862 r2 = strcmp("abd", "aXd");
864 /* These two should both be greater than 0. It is permissible for
865 a system to return different values, as long as the sign is the
868 /* Exit with 1 (failure) if these two values are both > 0, since
869 this tests whether strcoll(3) is broken with respect to strcmp(3)
870 in the default locale. */
871 exit (r1 > 0 && r2 > 0);
873 ]])], [bash_cv_func_strcoll_broken=yes], [bash_cv_func_strcoll_broken=no],
874 [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no)
875 bash_cv_func_strcoll_broken=no]
877 AC_MSG_RESULT($bash_cv_func_strcoll_broken)
878 if test $bash_cv_func_strcoll_broken = yes; then
879 AC_DEFINE(STRCOLL_BROKEN)
883 AC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT,
884 [AC_MSG_CHECKING([for printf floating point output in hex notation])
885 AC_CACHE_VAL(bash_cv_printf_a_format,
886 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
897 sprintf(abuf, "%A", y);
898 exit(strchr(abuf, 'P') == (char *)0);
900 ]])], [bash_cv_printf_a_format=yes], [bash_cv_printf_a_format=no],
901 [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no)
902 bash_cv_printf_a_format=no]
904 AC_MSG_RESULT($bash_cv_printf_a_format)
905 if test $bash_cv_printf_a_format = yes; then
906 AC_DEFINE(HAVE_PRINTF_A_FORMAT)
910 AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC,
912 AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[
913 #include <sys/types.h>
918 AC_DEFUN(BASH_STRUCT_TERMIO_LDISC,
920 AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[
921 #include <sys/types.h>
927 dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS
929 dnl sets bash_cv_struct_stat_st_blocks
931 dnl unused for now; we'll see how AC_CHECK_MEMBERS works
933 AC_DEFUN(BASH_STRUCT_ST_BLOCKS,
935 AC_MSG_CHECKING([for struct stat.st_blocks])
936 AC_CACHE_VAL(bash_cv_struct_stat_st_blocks,
937 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
938 #include <sys/types.h>
939 #include <sys/stat.h>
944 static struct stat a;
945 if (a.st_blocks) return 0;
948 ]])], [bash_cv_struct_stat_st_blocks=yes], [bash_cv_struct_stat_st_blocks=no])
950 AC_MSG_RESULT($bash_cv_struct_stat_st_blocks)
951 if test "$bash_cv_struct_stat_st_blocks" = "yes"; then
952 AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
956 AC_DEFUN([BASH_CHECK_LIB_TERMCAP],
958 if test "X$bash_cv_termcap_lib" = "X"; then
961 AC_MSG_CHECKING(which library has the termcap functions)
964 AC_CACHE_VAL(bash_cv_termcap_lib,
965 [AC_CHECK_FUNC(tgetent, bash_cv_termcap_lib=libc,
966 [AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap,
967 [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo,
968 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses,
969 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses,
970 [AC_CHECK_LIB(ncursesw, tgetent, bash_cv_termcap_lib=libncursesw,
971 bash_cv_termcap_lib=gnutermcap)])])])])])])
972 if test "X$_bash_needmsg" = "Xyes"; then
973 AC_MSG_CHECKING(which library has the termcap functions)
975 AC_MSG_RESULT(using $bash_cv_termcap_lib)
976 if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then
977 LDFLAGS="$LDFLAGS -L./lib/termcap"
978 TERMCAP_LIB="./lib/termcap/libtermcap.a"
979 TERMCAP_DEP="./lib/termcap/libtermcap.a"
980 elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then
981 TERMCAP_LIB=-ltermcap
983 elif test $bash_cv_termcap_lib = libtinfo; then
986 elif test $bash_cv_termcap_lib = libncurses; then
987 TERMCAP_LIB=-lncurses
989 elif test $bash_cv_termcap_lib = libc; then
993 # we assume ncurses is installed somewhere the linker can find it
994 TERMCAP_LIB=-lncurses
1000 dnl Check for the presence of getpeername in libsocket.
1001 dnl If libsocket is present, check for libnsl and add it to LIBS if
1002 dnl it's there, since most systems with libsocket require linking
1003 dnl with libnsl as well. This should only be called if getpeername
1004 dnl was not found in libc.
1006 dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT
1009 AC_DEFUN(BASH_CHECK_LIB_SOCKET,
1011 if test "X$bash_cv_have_socklib" = "X"; then
1014 AC_MSG_CHECKING(for socket library)
1017 AC_CACHE_VAL(bash_cv_have_socklib,
1018 [AC_CHECK_LIB(socket, getpeername,
1019 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)])
1020 if test "X$_bash_needmsg" = Xyes; then
1021 AC_MSG_RESULT($bash_cv_have_socklib)
1024 if test $bash_cv_have_socklib = yes; then
1025 # check for libnsl, add it to LIBS if present
1026 if test "X$bash_cv_have_libnsl" = "X"; then
1029 AC_MSG_CHECKING(for libnsl)
1032 AC_CACHE_VAL(bash_cv_have_libnsl,
1033 [AC_CHECK_LIB(nsl, t_open,
1034 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)])
1035 if test "X$_bash_needmsg" = Xyes; then
1036 AC_MSG_RESULT($bash_cv_have_libnsl)
1039 if test $bash_cv_have_libnsl = yes; then
1040 LIBS="-lsocket -lnsl $LIBS"
1042 LIBS="-lsocket $LIBS"
1044 AC_DEFINE(HAVE_LIBSOCKET)
1045 AC_DEFINE(HAVE_GETPEERNAME)
1049 dnl like _AC_STRUCT_DIRENT(MEMBER) but public
1050 AC_DEFUN(BASH_STRUCT_DIRENT,
1052 AC_REQUIRE([AC_HEADER_DIRENT])
1053 AC_CHECK_MEMBERS(struct dirent.$1, bash_cv_dirent_has_$1=yes, bash_cv_dirent_has_$1=no,
1056 #include <sys/types.h>
1057 #ifdef HAVE_UNISTD_H
1058 # include <unistd.h>
1059 #endif /* HAVE_UNISTD_H */
1060 #if defined(HAVE_DIRENT_H)
1061 # include <dirent.h>
1063 # define dirent direct
1064 # ifdef HAVE_SYS_NDIR_H
1065 # include <sys/ndir.h>
1066 # endif /* SYSNDIR */
1067 # ifdef HAVE_SYS_DIR_H
1068 # include <sys/dir.h>
1069 # endif /* SYSDIR */
1073 #endif /* HAVE_DIRENT_H */
1077 AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
1078 [AC_REQUIRE([AC_HEADER_DIRENT])
1079 AC_MSG_CHECKING(for struct dirent.d_ino)
1080 AC_CACHE_VAL(bash_cv_dirent_has_d_ino, [BASH_STRUCT_DIRENT([d_ino])])
1081 AC_MSG_RESULT($bash_cv_dirent_has_d_ino)
1082 if test $bash_cv_dirent_has_d_ino = yes; then
1083 AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
1087 AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
1088 [AC_REQUIRE([AC_HEADER_DIRENT])
1089 AC_MSG_CHECKING(for struct dirent.d_fileno)
1090 AC_CACHE_VAL(bash_cv_dirent_has_d_fileno, [BASH_STRUCT_DIRENT([d_fileno])])
1091 AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
1092 if test $bash_cv_dirent_has_d_fileno = yes; then
1093 AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
1097 AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
1098 [AC_REQUIRE([AC_HEADER_DIRENT])
1099 AC_MSG_CHECKING(for struct dirent.d_namlen)
1100 AC_CACHE_VAL(bash_cv_dirent_has_d_namlen, [BASH_STRUCT_DIRENT([d_namlen])])
1101 AC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
1102 if test $bash_cv_dirent_has_d_namlen = yes; then
1103 AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
1107 AC_DEFUN(BASH_STRUCT_TIMEVAL,
1108 [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
1109 AC_CACHE_VAL(bash_cv_struct_timeval,
1112 [[#if HAVE_SYS_TIME_H
1113 #include <sys/time.h>
1117 [[static struct timeval x; x.tv_sec = x.tv_usec;]]
1119 bash_cv_struct_timeval=yes,
1120 bash_cv_struct_timeval=no)
1122 AC_MSG_RESULT($bash_cv_struct_timeval)
1123 if test $bash_cv_struct_timeval = yes; then
1124 AC_DEFINE(HAVE_TIMEVAL)
1128 AC_DEFUN(BASH_STRUCT_TIMEZONE,
1129 [AC_MSG_CHECKING(for struct timezone in sys/time.h and time.h)
1130 AC_CACHE_VAL(bash_cv_struct_timezone,
1132 AC_EGREP_HEADER(struct timezone, sys/time.h,
1133 bash_cv_struct_timezone=yes,
1134 AC_EGREP_HEADER(struct timezone, time.h,
1135 bash_cv_struct_timezone=yes,
1136 bash_cv_struct_timezone=no))
1138 AC_MSG_RESULT($bash_cv_struct_timezone)
1139 if test $bash_cv_struct_timezone = yes; then
1140 AC_DEFINE(HAVE_STRUCT_TIMEZONE)
1144 AC_DEFUN(BASH_CHECK_WINSIZE_IOCTL,
1145 [AC_CACHE_VAL(bash_cv_struct_winsize_ioctl,
1146 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1147 #include <sys/types.h>
1148 #include <sys/ioctl.h>
1152 if (sizeof (x) > 0) return (0);
1153 ]] )], [bash_cv_struct_winsize_ioctl=yes], [bash_cv_struct_winsize_ioctl=no])
1157 AC_DEFUN(BASH_CHECK_WINSIZE_TERMIOS,
1158 [AC_CACHE_VAL(bash_cv_struct_winsize_termios,
1159 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1160 #include <sys/types.h>
1161 #include <sys/termios.h>
1165 if (sizeof (x) > 0) return (0);
1166 ]] )], [bash_cv_struct_winsize_termios=yes], [bash_cv_struct_winsize_termios=no])
1170 AC_DEFUN(BASH_STRUCT_WINSIZE,
1171 [AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h)
1172 AC_CACHE_VAL(bash_cv_struct_winsize_header,
1174 BASH_CHECK_WINSIZE_IOCTL
1175 BASH_CHECK_WINSIZE_TERMIOS
1177 if test $bash_cv_struct_winsize_ioctl = yes; then
1178 bash_cv_struct_winsize_header=ioctl_h
1179 elif test $bash_cv_struct_winsize_termios = yes; then
1180 bash_cv_struct_winsize_header=termios_h
1182 bash_cv_struct_winsize_header=other
1185 if test $bash_cv_struct_winsize_header = ioctl_h; then
1186 AC_MSG_RESULT(sys/ioctl.h)
1187 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
1188 elif test $bash_cv_struct_winsize_header = termios_h; then
1189 AC_MSG_RESULT(termios.h)
1190 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS)
1192 AC_MSG_RESULT(not found)
1196 AC_DEFUN(BASH_HAVE_POSIX_SIGNALS,
1197 [AC_CACHE_VAL(bash_cv_posix_signals,
1198 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1202 struct sigaction sa;
1203 sigemptyset(&ss); sigsuspend(&ss);
1204 sigaction(SIGINT, &sa, (struct sigaction *) 0);
1205 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0);
1207 [bash_cv_posix_signals=yes], [bash_cv_posix_signals=no]
1211 AC_DEFUN(BASH_HAVE_BSD_SIGNALS,
1212 [AC_CACHE_VAL(bash_cv_bsd_signals,
1213 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1216 int mask = sigmask(SIGINT);
1217 sigsetmask(mask); sigblock(mask); sigpause(mask);
1219 [bash_cv_bsd_signals=yes], [bash_cv_bsd_signals=no]
1223 AC_DEFUN(BASH_HAVE_SYSV_SIGNALS,
1224 [AC_CACHE_VAL(bash_cv_sysv_signals,
1225 [AC_LINK_IFELSE([AC_LANG_PROGRAM([[
1229 int mask = sigmask(SIGINT);
1230 sigset(SIGINT, foo); sigrelse(SIGINT);
1231 sighold(SIGINT); sigpause(SIGINT);
1233 [bash_cv_sysv_signals=yes], [bash_cv_sysv_signals=no]
1237 dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7)
1238 AC_DEFUN(BASH_SYS_SIGNAL_VINTAGE,
1239 [AC_MSG_CHECKING(for type of signal functions)
1240 AC_CACHE_VAL(bash_cv_signal_vintage,
1242 BASH_HAVE_POSIX_SIGNALS
1243 if test $bash_cv_posix_signals = yes; then
1244 bash_cv_signal_vintage=posix
1246 BASH_HAVE_BSD_SIGNALS
1247 if test $bash_cv_bsd_signals = yes; then
1248 bash_cv_signal_vintage=4.2bsd
1250 BASH_HAVE_SYSV_SIGNALS
1251 if test $bash_cv_sysv_signals = yes; then
1252 bash_cv_signal_vintage=svr3
1254 bash_cv_signal_vintage=v7
1259 AC_MSG_RESULT($bash_cv_signal_vintage)
1260 if test "$bash_cv_signal_vintage" = posix; then
1261 AC_DEFINE(HAVE_POSIX_SIGNALS)
1262 elif test "$bash_cv_signal_vintage" = "4.2bsd"; then
1263 AC_DEFINE(HAVE_BSD_SIGNALS)
1264 elif test "$bash_cv_signal_vintage" = svr3; then
1265 AC_DEFINE(HAVE_USG_SIGHOLD)
1269 dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process.
1270 AC_DEFUN(BASH_SYS_PGRP_SYNC,
1271 [AC_REQUIRE([AC_FUNC_GETPGRP])
1272 AC_MSG_CHECKING(whether pgrps need synchronization)
1273 AC_CACHE_VAL(bash_cv_pgrp_pipe,
1274 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1275 #ifdef HAVE_UNISTD_H
1276 # include <unistd.h>
1278 #ifdef HAVE_SYS_WAIT_H
1279 # include <sys/wait.h>
1285 # ifdef GETPGRP_VOID
1286 # define getpgID() getpgrp()
1288 # define getpgID() getpgrp(0)
1289 # define setpgid(x,y) setpgrp(x,y)
1291 int pid1, pid2, fds[2];
1295 switch (pid1 = fork()) {
1299 setpgid(0, getpid());
1302 setpgid(pid1, pid1);
1304 sleep(2); /* let first child die */
1309 switch (pid2 = fork()) {
1314 ok = getpgID() == pid1;
1315 write(fds[1], &ok, 1);
1318 setpgid(pid2, pid1);
1321 if (read(fds[0], &ok, 1) != 1)
1327 ]])], [bash_cv_pgrp_pipe=no], [bash_cv_pgrp_pipe=yes],
1328 [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no)
1329 bash_cv_pgrp_pipe=no]
1331 AC_MSG_RESULT($bash_cv_pgrp_pipe)
1332 if test $bash_cv_pgrp_pipe = yes; then
1333 AC_DEFINE(PGRP_PIPE)
1337 AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS,
1338 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1339 AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked])
1340 AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers,
1341 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1343 #ifdef HAVE_UNISTD_H
1348 typedef void sigfunc();
1350 volatile int nsigint;
1352 #ifdef HAVE_POSIX_SIGNALS
1354 set_signal_handler(sig, handler)
1358 struct sigaction act, oact;
1359 act.sa_handler = handler;
1361 sigemptyset (&act.sa_mask);
1362 sigemptyset (&oact.sa_mask);
1363 sigaction (sig, &act, &oact);
1364 return (oact.sa_handler);
1367 #define set_signal_handler(s, h) signal(s, h)
1381 set_signal_handler(SIGINT, sigint);
1382 kill((int)getpid(), SIGINT);
1383 kill((int)getpid(), SIGINT);
1386 ]])], [bash_cv_must_reinstall_sighandlers=no], [bash_cv_must_reinstall_sighandlers=yes],
1387 [AC_MSG_WARN(cannot check signal handling if cross compiling -- defaulting to no)
1388 bash_cv_must_reinstall_sighandlers=no]
1390 AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers)
1391 if test $bash_cv_must_reinstall_sighandlers = yes; then
1392 AC_DEFINE(MUST_REINSTALL_SIGHANDLERS)
1396 dnl check that some necessary job control definitions are present
1397 AC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING,
1398 [AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE])
1399 AC_MSG_CHECKING(for presence of necessary job control definitions)
1400 AC_CACHE_VAL(bash_cv_job_control_missing,
1401 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1402 #include <sys/types.h>
1403 #ifdef HAVE_SYS_WAIT_H
1404 #include <sys/wait.h>
1406 #ifdef HAVE_UNISTD_H
1411 /* add more tests in here as appropriate */
1414 #if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS)
1418 /* signals and tty control. */
1419 #if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT)
1423 /* process control */
1424 #if !defined (WNOHANG) || !defined (WUNTRACED)
1428 /* Posix systems have tcgetpgrp and waitpid. */
1429 #if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP)
1433 #if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID)
1437 /* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */
1438 #if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3)
1442 ]], [[ int x; ]] )],
1443 [bash_cv_job_control_missing=present], [bash_cv_job_control_missing=missing]
1445 AC_MSG_RESULT($bash_cv_job_control_missing)
1446 if test $bash_cv_job_control_missing = missing; then
1447 AC_DEFINE(JOB_CONTROL_MISSING)
1451 dnl check whether named pipes are present
1452 dnl this requires a previous check for mkfifo, but that is awkward to specify
1453 AC_DEFUN(BASH_SYS_NAMED_PIPES,
1454 [AC_MSG_CHECKING(for presence of named pipes)
1455 AC_CACHE_VAL(bash_cv_sys_named_pipes,
1456 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1457 #include <sys/types.h>
1458 #include <sys/stat.h>
1459 #ifdef HAVE_UNISTD_H
1465 /* Add more tests in here as appropriate. */
1471 #if defined (HAVE_MKFIFO)
1475 #if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO))
1482 err = mkdir("bash-aclocal", 0700);
1487 fd = mknod ("bash-aclocal/sh-np-autoconf", 0666 | S_IFIFO, 0);
1489 rmdir ("bash-aclocal");
1493 unlink ("bash-aclocal/sh-np-autoconf");
1494 rmdir ("bash-aclocal");
1497 ]])], [bash_cv_sys_named_pipes=present], [bash_cv_sys_named_pipes=missing],
1498 [AC_MSG_WARN(cannot check for named pipes if cross-compiling -- defaulting to missing)
1499 bash_cv_sys_named_pipes=missing]
1501 AC_MSG_RESULT($bash_cv_sys_named_pipes)
1502 if test $bash_cv_sys_named_pipes = missing; then
1503 AC_DEFINE(NAMED_PIPES_MISSING)
1507 AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR,
1508 [AC_MSG_CHECKING(for default mail directory)
1509 AC_CACHE_VAL(bash_cv_mail_dir,
1510 [if test -d /var/mail; then
1511 bash_cv_mail_dir=/var/mail
1512 elif test -d /var/spool/mail; then
1513 bash_cv_mail_dir=/var/spool/mail
1514 elif test -d /usr/mail; then
1515 bash_cv_mail_dir=/usr/mail
1516 elif test -d /usr/spool/mail; then
1517 bash_cv_mail_dir=/usr/spool/mail
1519 bash_cv_mail_dir=unknown
1522 AC_MSG_RESULT($bash_cv_mail_dir)
1523 AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir")
1526 AC_DEFUN(BASH_HAVE_TIOCGWINSZ,
1527 [AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h)
1528 AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl,
1529 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1530 #include <sys/types.h>
1531 #include <sys/ioctl.h>]], [[int x = TIOCGWINSZ;]] )],
1532 [bash_cv_tiocgwinsz_in_ioctl=yes], [bash_cv_tiocgwinsz_in_ioctl=no]
1534 AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl)
1535 if test $bash_cv_tiocgwinsz_in_ioctl = yes; then
1536 AC_DEFINE(GWINSZ_IN_SYS_IOCTL)
1540 AC_DEFUN(BASH_HAVE_TIOCSTAT,
1541 [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h)
1542 AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl,
1543 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1544 #include <sys/types.h>
1545 #include <sys/ioctl.h>]], [[int x = TIOCSTAT;]] )],
1546 [bash_cv_tiocstat_in_ioctl=yes], [bash_cv_tiocstat_in_ioctl=no]
1548 AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl)
1549 if test $bash_cv_tiocstat_in_ioctl = yes; then
1550 AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL)
1554 AC_DEFUN(BASH_HAVE_FIONREAD,
1555 [AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h)
1556 AC_CACHE_VAL(bash_cv_fionread_in_ioctl,
1557 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1558 #include <sys/types.h>
1559 #include <sys/ioctl.h>]], [[int x = FIONREAD;]] )],
1560 [bash_cv_fionread_in_ioctl=yes], [bash_cv_fionread_in_ioctl=no]
1562 AC_MSG_RESULT($bash_cv_fionread_in_ioctl)
1563 if test $bash_cv_fionread_in_ioctl = yes; then
1564 AC_DEFINE(FIONREAD_IN_SYS_IOCTL)
1569 dnl See if speed_t is declared in <sys/types.h>. Some versions of linux
1570 dnl require a definition of speed_t each time <termcap.h> is included,
1571 dnl but you can only get speed_t if you include <termios.h> (on some
1572 dnl versions) or <sys/types.h> (on others).
1574 AC_DEFUN(BASH_CHECK_SPEED_T,
1575 [AC_MSG_CHECKING(for speed_t in sys/types.h)
1576 AC_CACHE_VAL(bash_cv_speed_t_in_sys_types,
1579 [[#include <sys/types.h>]],
1581 [bash_cv_speed_t_in_sys_types=yes],[bash_cv_speed_t_in_sys_types=no])])
1582 AC_MSG_RESULT($bash_cv_speed_t_in_sys_types)
1583 if test $bash_cv_speed_t_in_sys_types = yes; then
1584 AC_DEFINE(SPEED_T_IN_SYS_TYPES)
1588 AC_DEFUN(BASH_CHECK_GETPW_FUNCS,
1589 [AC_MSG_CHECKING(whether getpw functions are declared in pwd.h)
1590 AC_CACHE_VAL(bash_cv_getpw_declared,
1591 [AC_EGREP_CPP(getpwuid,
1593 #include <sys/types.h>
1594 #ifdef HAVE_UNISTD_H
1595 # include <unistd.h>
1599 bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)])
1600 AC_MSG_RESULT($bash_cv_getpw_declared)
1601 if test $bash_cv_getpw_declared = yes; then
1602 AC_DEFINE(HAVE_GETPW_DECLS)
1606 AC_DEFUN(BASH_CHECK_DEV_FD,
1607 [AC_MSG_CHECKING(whether /dev/fd is available)
1608 AC_CACHE_VAL(bash_cv_dev_fd,
1610 if test -d /dev/fd && (exec test -r /dev/fd/0 < /dev/null) ; then
1611 # check for systems like FreeBSD 5 that only provide /dev/fd/[012]
1612 if (exec test -r /dev/fd/3 3</dev/null) ; then
1613 bash_cv_dev_fd=standard
1615 bash_cv_dev_fd=absent
1618 if test -z "$bash_cv_dev_fd" ; then
1619 if test -d /proc/self/fd && (exec test -r /proc/self/fd/0 < /dev/null) ; then
1620 bash_cv_dev_fd=whacky
1622 bash_cv_dev_fd=absent
1626 AC_MSG_RESULT($bash_cv_dev_fd)
1627 if test $bash_cv_dev_fd = "standard"; then
1628 AC_DEFINE(HAVE_DEV_FD)
1629 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/")
1630 elif test $bash_cv_dev_fd = "whacky"; then
1631 AC_DEFINE(HAVE_DEV_FD)
1632 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/")
1636 AC_DEFUN(BASH_CHECK_DEV_STDIN,
1637 [AC_MSG_CHECKING(whether /dev/stdin stdout stderr are available)
1638 AC_CACHE_VAL(bash_cv_dev_stdin,
1639 [if (exec test -r /dev/stdin < /dev/null) ; then
1640 bash_cv_dev_stdin=present
1642 bash_cv_dev_stdin=absent
1645 AC_MSG_RESULT($bash_cv_dev_stdin)
1646 if test $bash_cv_dev_stdin = "present"; then
1647 AC_DEFINE(HAVE_DEV_STDIN)
1652 AC_DEFUN(BASH_CHECK_RLIMIT,
1653 [AC_CACHE_VAL(bash_cv_rlimit,
1654 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1655 #include <sys/types.h>
1656 #include <sys/resource.h>
1662 [bash_cv_rlimit=yes], [bash_cv_rlimit=no]
1667 dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions
1669 AC_DEFUN(BASH_CHECK_KERNEL_RLIMIT,
1670 [AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines])
1671 AC_CACHE_VAL(bash_cv_kernel_rlimit,
1673 if test $bash_cv_rlimit = no; then
1674 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1675 #include <sys/types.h>
1677 #include <sys/resource.h>
1683 ]] )], [bash_cv_kernel_rlimit=yes], [bash_cv_kernel_rlimit=no] )
1686 AC_MSG_RESULT($bash_cv_kernel_rlimit)
1687 if test $bash_cv_kernel_rlimit = yes; then
1688 AC_DEFINE(RLIMIT_NEEDS_KERNEL)
1693 dnl Check for 64-bit off_t -- used for malloc alignment
1695 dnl C does not allow duplicate case labels, so the compile will fail if
1696 dnl sizeof(off_t) is > 4.
1698 AC_DEFUN(BASH_CHECK_OFF_T_64,
1699 [AC_CACHE_CHECK(for 64-bit off_t, bash_cv_off_t_64,
1700 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1701 #ifdef HAVE_UNISTD_H
1704 #include <sys/types.h>
1706 switch (0) case 0: case (sizeof (off_t) <= 4):;
1707 ]] )], [bash_cv_off_t_64=no], [bash_cv_off_t_64=yes]
1709 if test $bash_cv_off_t_64 = yes; then
1710 AC_DEFINE(HAVE_OFF_T_64)
1713 AC_DEFUN(BASH_CHECK_RTSIGS,
1714 [AC_MSG_CHECKING(for unusable real-time signals due to large values)
1715 AC_CACHE_VAL(bash_cv_unusable_rtsigs,
1716 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1717 #include <sys/types.h>
1728 int n_sigs = 2 * NSIG;
1730 int rtmin = SIGRTMIN;
1735 exit(rtmin < n_sigs);
1737 ]])], [bash_cv_unusable_rtsigs=yes], [bash_cv_unusable_rtsigs=no],
1738 [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes)
1739 bash_cv_unusable_rtsigs=yes]
1741 AC_MSG_RESULT($bash_cv_unusable_rtsigs)
1742 if test $bash_cv_unusable_rtsigs = yes; then
1743 AC_DEFINE(UNUSABLE_RT_SIGNALS)
1748 dnl check for availability of multibyte characters and functions
1750 dnl geez, I wish I didn't have to check for all of this stuff separately
1752 AC_DEFUN(BASH_CHECK_MULTIBYTE,
1754 AC_CHECK_HEADERS(wctype.h)
1755 AC_CHECK_HEADERS(wchar.h)
1756 AC_CHECK_HEADERS(langinfo.h)
1758 AC_CHECK_HEADERS(mbstr.h)
1760 AC_CHECK_FUNC(mbrlen, AC_DEFINE(HAVE_MBRLEN))
1761 AC_CHECK_FUNC(mbscasecmp, AC_DEFINE(HAVE_MBSCMP))
1762 AC_CHECK_FUNC(mbscmp, AC_DEFINE(HAVE_MBSCMP))
1763 AC_CHECK_FUNC(mbsnrtowcs, AC_DEFINE(HAVE_MBSNRTOWCS))
1764 AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS))
1766 AC_REPLACE_FUNCS(mbschr)
1768 AC_CHECK_FUNC(wcrtomb, AC_DEFINE(HAVE_WCRTOMB))
1769 AC_CHECK_FUNC(wcscoll, AC_DEFINE(HAVE_WCSCOLL))
1770 AC_CHECK_FUNC(wcsdup, AC_DEFINE(HAVE_WCSDUP))
1771 AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH))
1772 AC_CHECK_FUNC(wctype, AC_DEFINE(HAVE_WCTYPE))
1774 AC_REPLACE_FUNCS(wcswidth)
1776 dnl checks for both mbrtowc and mbstate_t
1778 if test $ac_cv_func_mbrtowc = yes; then
1779 AC_DEFINE(HAVE_MBSTATE_T)
1782 AC_CHECK_FUNCS(iswlower iswupper towlower towupper iswctype)
1784 AC_REQUIRE([AM_LANGINFO_CODESET])
1786 dnl check for wchar_t in <wchar.h>
1787 AC_CACHE_CHECK([for wchar_t in wchar.h], bash_cv_type_wchar_t,
1788 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1789 [#include <wchar.h>]],
1793 ]] )], [bash_cv_type_wchar_t=yes], [bash_cv_type_wchar_t=no]
1795 if test $bash_cv_type_wchar_t = yes; then
1796 AC_DEFINE(HAVE_WCHAR_T, 1, [systems should define this type here])
1799 dnl check for wctype_t in <wctype.h>
1800 AC_CACHE_CHECK([for wctype_t in wctype.h], bash_cv_type_wctype_t,
1801 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1802 [#include <wctype.h>]],
1806 ]] )], [bash_cv_type_wctype_t=yes], [bash_cv_type_wctype_t=no]
1808 if test $bash_cv_type_wctype_t = yes; then
1809 AC_DEFINE(HAVE_WCTYPE_T, 1, [systems should define this type here])
1812 dnl check for wint_t in <wctype.h>
1813 AC_CACHE_CHECK([for wint_t in wctype.h], bash_cv_type_wint_t,
1814 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
1815 [#include <wctype.h>]],
1819 ]] )], [bash_cv_type_wint_t=yes], [bash_cv_type_wint_t=no]
1821 if test $bash_cv_type_wint_t = yes; then
1822 AC_DEFINE(HAVE_WINT_T, 1, [systems should define this type here])
1825 dnl check for broken wcwidth
1826 AC_CACHE_CHECK([for wcwidth broken with unicode combining characters],
1827 bash_cv_wcwidth_broken,
1828 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1843 setlocale(LC_ALL, "en_US.UTF-8");
1844 w = wcwidth (0x0301);
1845 exit (w == 0); /* exit 0 if wcwidth broken */
1847 ]])], [bash_cv_wcwidth_broken=yes], [bash_cv_wcwidth_broken=no],
1848 [bash_cv_wcwidth_broken=no]
1850 if test "$bash_cv_wcwidth_broken" = yes; then
1851 AC_DEFINE(WCWIDTH_BROKEN, 1, [wcwidth is usually not broken])
1854 if test "$am_cv_func_iconv" = yes; then
1856 LIBS="$LIBS $LIBINTL $LIBICONV"
1857 AC_CHECK_FUNCS(locale_charset)
1861 AC_CHECK_SIZEOF(wchar_t, 4)
1865 dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB
1868 dnl BASH_CHECK_LIB_TERMCAP
1870 AC_DEFUN([RL_LIB_READLINE_VERSION],
1872 AC_REQUIRE([BASH_CHECK_LIB_TERMCAP])
1874 AC_MSG_CHECKING([version of installed readline library])
1876 # What a pain in the ass this is.
1878 # save cpp and ld options
1879 _save_CFLAGS="$CFLAGS"
1880 _save_LDFLAGS="$LDFLAGS"
1883 # Don't set ac_cv_rl_prefix if the caller has already assigned a value. This
1884 # allows the caller to do something like $_rl_prefix=$withval if the user
1885 # specifies --with-installed-readline=PREFIX as an argument to configure
1887 if test -z "$ac_cv_rl_prefix"; then
1888 test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix}
1891 eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include
1892 eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib
1894 LIBS="$LIBS -lreadline ${TERMCAP_LIB}"
1895 CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}"
1896 LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}"
1898 AC_CACHE_VAL(ac_cv_rl_version,
1899 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1901 #include <readline/readline.h>
1904 extern int rl_gnu_readline_p;
1910 fp = fopen("conftest.rlv", "w");
1913 if (rl_gnu_readline_p != 1)
1914 fprintf(fp, "0.0\n");
1916 fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0");
1921 [ac_cv_rl_version=`cat conftest.rlv`],
1922 [ac_cv_rl_version='0.0'],
1923 [ac_cv_rl_version='8.0']
1926 CFLAGS="$_save_CFLAGS"
1927 LDFLAGS="$_save_LDFLAGS"
1934 case "$ac_cv_rl_version" in
1935 2*|3*|4*|5*|6*|7*|8*|9*)
1936 RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'`
1937 RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'`
1943 [[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;;
1944 [[0-9]]) _RL_MAJOR=0$RL_MAJOR ;;
1950 [[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;;
1951 [[0-9]]) _RL_MINOR=0$RL_MINOR ;;
1955 RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}"
1957 # Readline versions greater than 4.2 have these defines in readline.h
1959 if test $ac_cv_rl_version = '0.0' ; then
1960 AC_MSG_WARN([Could not test version of installed readline library.])
1961 elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then
1962 # set these for use by the caller
1963 RL_PREFIX=$ac_cv_rl_prefix
1964 RL_LIBDIR=$ac_cv_rl_libdir
1965 RL_INCLUDEDIR=$ac_cv_rl_includedir
1966 AC_MSG_RESULT($ac_cv_rl_version)
1969 AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library])
1970 AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library])
1971 AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library])
1973 AC_SUBST(RL_VERSION)
1977 # set these for use by the caller
1978 RL_PREFIX=$ac_cv_rl_prefix
1979 RL_LIBDIR=$ac_cv_rl_libdir
1980 RL_INCLUDEDIR=$ac_cv_rl_includedir
1982 AC_MSG_RESULT($ac_cv_rl_version)
1987 AC_DEFUN(BASH_CHECK_WCONTINUED,
1989 AC_MSG_CHECKING(whether WCONTINUED flag to waitpid is unavailable or available but broken)
1990 AC_CACHE_VAL(bash_cv_wcontinued_broken,
1991 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
1992 #include <sys/types.h>
1993 #include <sys/wait.h>
2006 x = waitpid(-1, (int *)0, WNOHANG|WCONTINUED);
2007 if (x == -1 && errno == EINVAL)
2012 ]])], [bash_cv_wcontinued_broken=no], [bash_cv_wcontinued_broken=yes],
2013 [AC_MSG_WARN(cannot check WCONTINUED if cross compiling -- defaulting to no)
2014 bash_cv_wcontinued_broken=no]
2016 AC_MSG_RESULT($bash_cv_wcontinued_broken)
2017 if test $bash_cv_wcontinued_broken = yes; then
2018 AC_DEFINE(WCONTINUED_BROKEN)
2023 dnl tests added for bashdb
2027 AC_DEFUN([AM_PATH_LISPDIR],
2028 [AC_ARG_WITH(lispdir, AS_HELP_STRING([--with-lispdir], [override the default lisp directory]),
2029 [ lispdir="$withval"
2030 AC_MSG_CHECKING([where .elc files should go])
2031 AC_MSG_RESULT([$lispdir])],
2033 # If set to t, that means we are running in a shell under Emacs.
2034 # If you have an Emacs named "t", then use the full path.
2035 test x"$EMACS" = xt && EMACS=
2036 AC_CHECK_PROGS(EMACS, emacs xemacs, no)
2037 if test $EMACS != "no"; then
2038 if test x${lispdir+set} != xset; then
2039 AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [dnl
2040 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;}'`
2041 if test -z "$am_cv_lispdir"; then
2042 am_cv_lispdir='${datadir}/emacs/site-lisp'
2045 lispdir="$am_cv_lispdir"
2053 AC_DEFUN([BASH_FUNC_FPURGE],
2055 AC_CHECK_FUNCS_ONCE([fpurge])
2056 AC_CHECK_FUNCS_ONCE([__fpurge])
2057 AC_CHECK_DECLS([fpurge], , , [#include <stdio.h>])
2060 AC_DEFUN([BASH_FUNC_SNPRINTF],
2062 AC_CHECK_FUNCS_ONCE([snprintf])
2063 if test X$ac_cv_func_snprintf = Xyes; then
2064 AC_CACHE_CHECK([for standard-conformant snprintf], [bash_cv_func_snprintf],
2065 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2073 n = snprintf (0, 0, "%s", "0123456");
2076 ]])], [bash_cv_func_snprintf=yes], [bash_cv_func_snprintf=no],
2077 [AC_MSG_WARN([cannot check standard snprintf if cross-compiling])
2078 bash_cv_func_snprintf=yes]
2080 if test $bash_cv_func_snprintf = no; then
2081 ac_cv_func_snprintf=no
2084 if test $ac_cv_func_snprintf = no; then
2085 AC_DEFINE(HAVE_SNPRINTF, 0,
2086 [Define if you have a standard-conformant snprintf function.])
2090 AC_DEFUN([BASH_FUNC_VSNPRINTF],
2092 AC_CHECK_FUNCS_ONCE([vsnprintf])
2093 if test X$ac_cv_func_vsnprintf = Xyes; then
2094 AC_CACHE_CHECK([for standard-conformant vsnprintf], [bash_cv_func_vsnprintf],
2095 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2099 #include <varargs.h>
2106 foo(const char *fmt, ...)
2108 foo(format, va_alist)
2117 va_start(args, fmt);
2121 n = vsnprintf(0, 0, fmt, args);
2130 n = foo("%s", "0123456");
2133 ]])], [bash_cv_func_vsnprintf=yes], [bash_cv_func_vsnprintf=no],
2134 [AC_MSG_WARN([cannot check standard vsnprintf if cross-compiling])
2135 bash_cv_func_vsnprintf=yes]
2137 if test $bash_cv_func_vsnprintf = no; then
2138 ac_cv_func_vsnprintf=no
2141 if test $ac_cv_func_vsnprintf = no; then
2142 AC_DEFINE(HAVE_VSNPRINTF, 0,
2143 [Define if you have a standard-conformant vsnprintf function.])
2147 AC_DEFUN(BASH_STRUCT_WEXITSTATUS_OFFSET,
2148 [AC_MSG_CHECKING(for offset of exit status in return status from wait)
2149 AC_CACHE_VAL(bash_cv_wexitstatus_offset,
2150 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2154 #include <sys/wait.h>
2169 /* wait for the process */
2175 for (i = 0; i < (sizeof(s) * 8); i++)
2177 n = (s >> i) & 0xff;
2184 ]])], [bash_cv_wexitstatus_offset=0], [bash_cv_wexitstatus_offset=$?],
2185 [AC_MSG_WARN(cannot check WEXITSTATUS offset if cross compiling -- defaulting to 0)
2186 bash_cv_wexitstatus_offset=0]
2188 if test "$bash_cv_wexitstatus_offset" -gt 32 ; then
2189 AC_MSG_WARN(bad exit status from test program -- defaulting to 0)
2190 bash_cv_wexitstatus_offset=0
2192 AC_MSG_RESULT($bash_cv_wexitstatus_offset)
2193 AC_DEFINE_UNQUOTED([WEXITSTATUS_OFFSET], [$bash_cv_wexitstatus_offset], [Offset of exit status in wait status word])
2196 AC_DEFUN([BASH_FUNC_SBRK],
2198 AC_MSG_CHECKING([for sbrk])
2199 AC_CACHE_VAL(ac_cv_func_sbrk,
2202 [[#include <unistd.h>]],
2203 [[ void *x = sbrk (4096); ]])],
2204 [ac_cv_func_sbrk=yes],[ac_cv_func_sbrk=no])])
2205 AC_MSG_RESULT($ac_cv_func_sbrk)
2206 if test X$ac_cv_func_sbrk = Xyes; then
2207 AC_CACHE_CHECK([for working sbrk], [bash_cv_func_sbrk],
2208 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2213 main(int c, char **v)
2218 exit ((x == (void *)-1) ? 1 : 0);
2220 ]])],[bash_cv_func_sbrk=yes],[bash_cv_func_sbrk=no],[AC_MSG_WARN([cannot check working sbrk if cross-compiling])
2221 bash_cv_func_sbrk=yes
2223 if test $bash_cv_func_sbrk = no; then
2227 if test $ac_cv_func_sbrk = yes; then
2228 AC_DEFINE(HAVE_SBRK, 1,
2229 [Define if you have a working sbrk function.])
2233 AC_DEFUN(BASH_FUNC_FNMATCH_EQUIV_FALLBACK,
2234 [AC_MSG_CHECKING(whether fnmatch can be used to check bracket equivalence classes)
2235 AC_CACHE_VAL(bash_cv_fnmatch_equiv_fallback,
2236 [AC_RUN_IFELSE([AC_LANG_SOURCE([[
2240 #include <fnmatch.h>
2243 char *pattern = "[[=a=]]";
2245 /* char *string = "รค"; */
2246 unsigned char string[4] = { '\xc3', '\xa4', '\0' };
2249 main (int c, char **v)
2251 setlocale (LC_ALL, "en_US.UTF-8");
2252 if (fnmatch (pattern, (const char *)string, 0) != FNM_NOMATCH)
2256 ]])], [bash_cv_fnmatch_equiv_fallback=yes], [bash_cv_fnmatch_equiv_fallback=no],
2257 [AC_MSG_WARN(cannot check fnmatch if cross compiling -- defaulting to no)
2258 bash_cv_fnmatch_equiv_fallback=no]
2260 AC_MSG_RESULT($bash_cv_fnmatch_equiv_fallback)
2261 if test "$bash_cv_fnmatch_equiv_fallback" = "yes" ; then
2262 bash_cv_fnmatch_equiv_value=1
2264 bash_cv_fnmatch_equiv_value=0
2266 AC_DEFINE_UNQUOTED([FNMATCH_EQUIV_FALLBACK], [$bash_cv_fnmatch_equiv_value], [Whether fnmatch can be used for bracket equivalence classes])