1dnl 2dnl Bash specific tests 3dnl 4dnl Some derived from PDKSH 5.1.3 autoconf tests 5dnl 6dnl 7dnl Check if dup2() does not clear the close on exec flag 8dnl 9AC_DEFUN(BASH_DUP2_CLOEXEC_CHECK, 10[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag) 11AC_CACHE_VAL(bash_cv_dup2_broken, 12[AC_TRY_RUN([ 13#include <sys/types.h> 14#include <fcntl.h> 15main() 16{ 17 int fd1, fd2, fl; 18 fd1 = open("/dev/null", 2); 19 if (fcntl(fd1, 2, 1) < 0) 20 exit(1); 21 fd2 = dup2(fd1, 1); 22 if (fd2 < 0) 23 exit(2); 24 fl = fcntl(fd2, 1, 0); 25 /* fl will be 1 if dup2 did not reset the close-on-exec flag. */ 26 exit(fl != 1); 27} 28], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no,
|
29 AC_MSG_ERROR(cannot check dup2 if cross compiling))
|
29 [AC_MSG_ERROR(cannot check dup2 if cross compiling -- defaulting to no) 30 bash_cv_dup2_broken=no]) |
31]) 32AC_MSG_RESULT($bash_cv_dup2_broken) 33if test $bash_cv_dup2_broken = yes; then 34AC_DEFINE(DUP2_BROKEN) 35fi 36]) 37 38dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) 39AC_DEFUN(BASH_SIGNAL_CHECK, 40[AC_REQUIRE([AC_TYPE_SIGNAL]) 41AC_MSG_CHECKING(for type of signal functions) 42AC_CACHE_VAL(bash_cv_signal_vintage, 43[ 44 AC_TRY_LINK([#include <signal.h>],[ 45 sigset_t ss; 46 struct sigaction sa; 47 sigemptyset(&ss); sigsuspend(&ss); 48 sigaction(SIGINT, &sa, (struct sigaction *) 0); 49 sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); 50 ], bash_cv_signal_vintage=posix, 51 [ 52 AC_TRY_LINK([#include <signal.h>], [ 53 int mask = sigmask(SIGINT); 54 sigsetmask(mask); sigblock(mask); sigpause(mask); 55 ], bash_cv_signal_vintage=4.2bsd, 56 [ 57 AC_TRY_LINK([ 58 #include <signal.h> 59 RETSIGTYPE foo() { }], [ 60 int mask = sigmask(SIGINT); 61 sigset(SIGINT, foo); sigrelse(SIGINT); 62 sighold(SIGINT); sigpause(SIGINT); 63 ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7 64 )] 65 )] 66) 67]) 68AC_MSG_RESULT($bash_cv_signal_vintage) 69if test "$bash_cv_signal_vintage" = posix; then 70AC_DEFINE(HAVE_POSIX_SIGNALS) 71elif test "$bash_cv_signal_vintage" = "4.2bsd"; then 72AC_DEFINE(HAVE_BSD_SIGNALS) 73elif test "$bash_cv_signal_vintage" = svr3; then 74AC_DEFINE(HAVE_USG_SIGHOLD) 75fi 76]) 77 78dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process. 79AC_DEFUN(BASH_PGRP_SYNC, 80[AC_REQUIRE([AC_FUNC_GETPGRP]) 81AC_MSG_CHECKING(whether pgrps need synchronization) 82AC_CACHE_VAL(bash_cv_pgrp_pipe, 83[AC_TRY_RUN([ 84#ifdef HAVE_UNISTD_H 85# include <unistd.h> 86#endif 87main() 88{ 89# ifdef GETPGRP_VOID 90# define getpgID() getpgrp() 91# else 92# define getpgID() getpgrp(0) 93# define setpgid(x,y) setpgrp(x,y) 94# endif 95 int pid1, pid2, fds[2]; 96 int status; 97 char ok; 98 99 switch (pid1 = fork()) { 100 case -1: 101 exit(1); 102 case 0: 103 setpgid(0, getpid()); 104 exit(0); 105 } 106 setpgid(pid1, pid1); 107 108 sleep(2); /* let first child die */ 109 110 if (pipe(fds) < 0) 111 exit(2); 112 113 switch (pid2 = fork()) { 114 case -1: 115 exit(3); 116 case 0: 117 setpgid(0, pid1); 118 ok = getpgID() == pid1; 119 write(fds[1], &ok, 1); 120 exit(0); 121 } 122 setpgid(pid2, pid1); 123 124 close(fds[1]); 125 if (read(fds[0], &ok, 1) != 1) 126 exit(4); 127 wait(&status); 128 wait(&status); 129 exit(ok ? 0 : 5); 130} 131], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes,
|
131 AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling))
|
132 [AC_MSG_ERROR(cannot check pgrp synchronization if cross compiling -- defaulting to no) 133 bash_cv_pgrp_pipe=no]) |
134]) 135AC_MSG_RESULT($bash_cv_pgrp_pipe) 136if test $bash_cv_pgrp_pipe = yes; then 137AC_DEFINE(PGRP_PIPE) 138fi 139]) 140 141dnl 142dnl check for typedef'd symbols in header files, but allow the caller to 143dnl specify the include files to be checked in addition to the default 144dnl 145dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) 146AC_DEFUN(BASH_CHECK_TYPE, 147[AC_REQUIRE([AC_HEADER_STDC])dnl 148AC_MSG_CHECKING(for $1) 149AC_CACHE_VAL(bash_cv_type_$1, 150[AC_EGREP_CPP($1, [#include <sys/types.h> 151#if STDC_HEADERS 152#include <stdlib.h> 153#endif 154$2 155], bash_cv_type_$1=yes, bash_cv_type_$1=no)]) 156AC_MSG_RESULT($bash_cv_type_$1) 157ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then 158 AC_DEFINE($4) 159 fi]) 160if test $bash_cv_type_$1 = no; then 161 AC_DEFINE($1, $3) 162fi 163]) 164 165dnl 166dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0) 167dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use 168dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify 169dnl matters, this just checks for rlim_t, quad_t, or long. 170dnl 171AC_DEFUN(BASH_RLIMIT_TYPE, 172[AC_MSG_CHECKING(for size and type of struct rlimit fields) 173AC_CACHE_VAL(bash_cv_type_rlimit,
|
172[AC_TRY_COMPILE([#include <sys/types.h>],
|
174[AC_TRY_COMPILE([#include 175#include <sys/resource.h>], |
176[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[ 177AC_TRY_RUN([ 178#include <sys/types.h> 179#include <sys/time.h> 180#include <sys/resource.h> 181main() 182{ 183#ifdef HAVE_QUAD_T 184 struct rlimit rl; 185 if (sizeof(rl.rlim_cur) == sizeof(quad_t)) 186 exit(0); 187#endif 188 exit(1); 189}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long,
|
187 AC_MSG_ERROR(cannot check quad_t if cross compiling))])
|
190 [AC_MSG_ERROR(cannot check quad_t if cross compiling -- defaulting to long) 191 bash_cv_type_rlimit=long])]) |
192]) 193AC_MSG_RESULT($bash_cv_type_rlimit) 194if test $bash_cv_type_rlimit = quad_t; then 195AC_DEFINE(RLIMTYPE, quad_t) 196elif test $bash_cv_type_rlimit = rlim_t; then 197AC_DEFINE(RLIMTYPE, rlim_t) 198fi 199]) 200 201dnl 202dnl Check for sys_siglist[] or _sys_siglist[] 203dnl
|
204AC_DEFUN(BASH_DECL_UNDER_SYS_SIGLIST, 205[AC_MSG_CHECKING([for _sys_siglist in signal.h or unistd.h]) 206AC_CACHE_VAL(bash_cv_decl_under_sys_siglist, 207[AC_TRY_COMPILE([ 208#include <sys/types.h> 209#include <signal.h> 210#ifdef HAVE_UNISTD_H 211#include <unistd.h> 212#endif], [ char *msg = _sys_siglist[2]; ], 213 bash_cv_decl_under_sys_siglist=yes, bash_cv_decl_under_sys_siglist=no, 214 [AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no)])])dnl 215AC_MSG_RESULT($bash_cv_decl_under_sys_siglist) 216if test $bash_cv_decl_under_sys_siglist = yes; then 217AC_DEFINE(UNDER_SYS_SIGLIST_DECLARED) 218fi 219]) 220 |
221AC_DEFUN(BASH_UNDER_SYS_SIGLIST,
|
201[AC_MSG_CHECKING([for _sys_siglist in system C library])
|
222[AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST]) 223AC_MSG_CHECKING([for _sys_siglist in system C library]) |
224AC_CACHE_VAL(bash_cv_under_sys_siglist, 225[AC_TRY_RUN([ 226#include <sys/types.h> 227#include <signal.h> 228#ifdef HAVE_UNISTD_H 229#include <unistd.h> 230#endif
|
209#ifndef _sys_siglist
|
231#ifndef UNDER_SYS_SIGLIST_DECLARED |
232extern char *_sys_siglist[]; 233#endif 234main() 235{
|
214char *msg = _sys_siglist[2];
|
236char *msg = (char *)_sys_siglist[2]; |
237exit(msg == 0); 238}],
|
217bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no,
218AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling))])dnl
|
239 bash_cv_under_sys_siglist=yes, bash_cv_under_sys_siglist=no, 240 [AC_MSG_ERROR(cannot check for _sys_siglist[] if cross compiling -- defaulting to no) 241 bash_cv_under_sys_siglist=no])]) |
242AC_MSG_RESULT($bash_cv_under_sys_siglist) 243if test $bash_cv_under_sys_siglist = yes; then 244AC_DEFINE(HAVE_UNDER_SYS_SIGLIST) 245fi 246]) 247 248AC_DEFUN(BASH_SYS_SIGLIST, 249[AC_REQUIRE([AC_DECL_SYS_SIGLIST]) 250AC_MSG_CHECKING([for sys_siglist in system C library]) 251AC_CACHE_VAL(bash_cv_sys_siglist, 252[AC_TRY_RUN([ 253#include <sys/types.h> 254#include <signal.h> 255#ifdef HAVE_UNISTD_H 256#include <unistd.h> 257#endif 258#ifndef SYS_SIGLIST_DECLARED 259extern char *sys_siglist[]; 260#endif 261main() 262{ 263char *msg = sys_siglist[2]; 264exit(msg == 0); 265}],
|
243bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no,
244AC_MSG_ERROR(cannot check for sys_siglist if cross compiling))])dnl
|
266 bash_cv_sys_siglist=yes, bash_cv_sys_siglist=no, 267 [AC_MSG_ERROR(cannot check for sys_siglist if cross compiling -- defaulting to no) 268 bash_cv_sys_siglist=no])]) |
269AC_MSG_RESULT($bash_cv_sys_siglist) 270if test $bash_cv_sys_siglist = yes; then 271AC_DEFINE(HAVE_SYS_SIGLIST) 272fi 273]) 274 275dnl Check for sys_errlist[] and sys_nerr, check for declaration 276AC_DEFUN(BASH_SYS_ERRLIST, 277[AC_MSG_CHECKING([for sys_errlist and sys_nerr]) 278AC_CACHE_VAL(bash_cv_sys_errlist, 279[AC_TRY_LINK([#include <errno.h>], 280[extern char *sys_errlist[]; 281 extern int sys_nerr; 282 char *msg = sys_errlist[sys_nerr - 1];], 283 bash_cv_sys_errlist=yes, bash_cv_sys_errlist=no)])dnl 284AC_MSG_RESULT($bash_cv_sys_errlist) 285if test $bash_cv_sys_errlist = yes; then 286AC_DEFINE(HAVE_SYS_ERRLIST) 287fi 288]) 289 290dnl Check to see if opendir will open non-directories (not a nice thing) 291AC_DEFUN(BASH_FUNC_OPENDIR_CHECK, 292[AC_REQUIRE([AC_HEADER_DIRENT])dnl 293AC_MSG_CHECKING(if opendir() opens non-directories) 294AC_CACHE_VAL(bash_cv_opendir_not_robust, 295[AC_TRY_RUN([ 296#include <stdio.h> 297#include <sys/types.h> 298#include <fcntl.h> 299#ifdef HAVE_UNISTD_H 300# include <unistd.h> 301#endif /* HAVE_UNISTD_H */ 302#if defined(HAVE_DIRENT_H) 303# include <dirent.h> 304#else 305# define dirent direct 306# ifdef HAVE_SYS_NDIR_H 307# include <sys/ndir.h> 308# endif /* SYSNDIR */ 309# ifdef HAVE_SYS_DIR_H 310# include <sys/dir.h> 311# endif /* SYSDIR */ 312# ifdef HAVE_NDIR_H 313# include <ndir.h> 314# endif 315#endif /* HAVE_DIRENT_H */ 316main() 317{ 318DIR *dir; 319int fd; 320unlink("/tmp/not_a_directory"); 321fd = open("/tmp/not_a_directory", O_WRONLY|O_CREAT, 0666); 322write(fd, "\n", 1); 323close(fd); 324dir = opendir("/tmp/not_a_directory"); 325unlink("/tmp/not_a_directory"); 326exit (dir == 0); 327}], bash_cv_opendir_not_robust=yes,bash_cv_opendir_not_robust=no,
|
304 AC_MSG_ERROR(cannot check opendir if cross compiling))])
|
328 [AC_MSG_ERROR(cannot check opendir if cross compiling -- defaulting to no) 329 bash_cv_opendir_not_robust=no] 330)]) |
331AC_MSG_RESULT($bash_cv_opendir_not_robust) 332if test $bash_cv_opendir_not_robust = yes; then 333AC_DEFINE(OPENDIR_NOT_ROBUST) 334fi 335]) 336 337dnl 338AC_DEFUN(BASH_TYPE_SIGHANDLER, 339[AC_MSG_CHECKING([whether signal handlers are of type void]) 340AC_CACHE_VAL(bash_cv_void_sighandler, 341[AC_TRY_COMPILE([#include <sys/types.h> 342#include <signal.h> 343#ifdef signal 344#undef signal 345#endif 346#ifdef __cplusplus 347extern "C" 348#endif 349void (*signal ()) ();], 350[int i;], bash_cv_void_sighandler=yes, bash_cv_void_sighandler=no)])dnl 351AC_MSG_RESULT($bash_cv_void_sighandler) 352if test $bash_cv_void_sighandler = yes; then 353AC_DEFINE(VOID_SIGHANDLER) 354fi 355]) 356
|
357AC_DEFUN(BASH_TYPE_INT32_T, 358[ 359if test "X$bash_cv_type_int32_t" = "X"; then 360_bash_needmsg=yes 361else 362AC_MSG_CHECKING(which builtin C type is 32 bits wide) 363_bash_needmsg= 364fi 365AC_CACHE_VAL(bash_cv_type_int32_t, 366[AC_TRY_RUN([ 367main() 368{ 369#if SIZEOF_INT == 4 370exit (0); 371#else 372# if SIZEOF_LONG == 4 373exit (1); 374# else 375# error cannot find 32 bit type... 376# endif 377#endif 378}], bash_cv_type_int32_t=int, bash_cv_type_int32_t=long, 379 [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int) 380 bash_cv_type_int32_t=int] 381)]) 382if test "X$_bash_needmsg" = "Xyes"; then 383AC_MSG_CHECKING(which builtin C type is 32 bits wide) 384fi 385AC_MSG_RESULT($bash_cv_type_int32_t); 386if test "$bash_cv_type_int32_t" = "int"; then 387AC_DEFINE(int32_t, int) 388else 389AC_DEFINE(int32_t, long) 390fi 391]) 392 393AC_DEFUN(BASH_TYPE_U_INT32_T, 394[ 395if test "X$bash_cv_type_u_int32_t" = "X"; then 396_bash_needmsg=yes 397else 398AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide) 399_bash_needmsg= 400fi 401AC_CACHE_VAL(bash_cv_type_u_int32_t, 402[AC_TRY_RUN([ 403main() 404{ 405#if SIZEOF_INT == 4 406exit (0); 407#else 408# if SIZEOF_LONG == 4 409exit (1); 410# else 411# error cannot find 32 bit type... 412# endif 413#endif 414}], bash_cv_type_u_int32_t=int, bash_cv_type_u_int32_t=long, 415 [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int) 416 bash_cv_type_u_int32_t=int] 417)]) 418if test "X$_bash_needmsg" = "Xyes"; then 419AC_MSG_CHECKING(which unsigned builtin C type is 32 bits wide) 420fi 421AC_MSG_RESULT($bash_cv_type_u_int32_t); 422if test "$bash_cv_type_u_int32_t" = "int"; then 423AC_DEFINE(u_int32_t, unsigned int) 424else 425AC_DEFINE(u_int32_t, unsigned long) 426fi 427]) 428 429AC_DEFUN(BASH_TYPE_PTRDIFF_T, 430[ 431if test "X$bash_cv_type_ptrdiff_t" = "X"; then 432_bash_needmsg=yes 433else 434AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t) 435_bash_needmsg= 436fi 437AC_CACHE_VAL(bash_cv_type_ptrdiff_t, 438[AC_TRY_RUN([ 439main() 440{ 441#if SIZEOF_CHAR_P == SIZEOF_INT 442exit (0); 443#else 444# if SIZEOF_CHAR_P == SIZEOF_LONG 445exit (1); 446# else 447# error cannot find type for pointer arithmetic... 448# endif 449#endif 450}], bash_cv_type_ptrdiff_t=int, bash_cv_type_ptrdiff_t=long, 451 [AC_MSG_ERROR(cannot check type sizes if cross-compiling -- defaulting to int) 452 bash_cv_type_ptrdiff_t=int] 453)]) 454if test "X$_bash_needmsg" = "Xyes"; then 455AC_MSG_CHECKING(which builtin C type is correct for ptrdiff_t) 456fi 457AC_MSG_RESULT($bash_cv_type_ptrdiff_t); 458if test "$bash_cv_type_ptrdiff_t" = "int"; then 459AC_DEFINE(ptrdiff_t, int) 460else 461AC_DEFINE(ptrdiff_t, long) 462fi 463]) 464 |
465AC_DEFUN(BASH_FUNC_STRSIGNAL,
|
332[AC_MSG_CHECKING([for the existance of strsignal])
|
466[AC_MSG_CHECKING([for the existence of strsignal]) |
467AC_CACHE_VAL(bash_cv_have_strsignal, 468[AC_TRY_LINK([#include <sys/types.h> 469#include <signal.h>], 470[char *s = (char *)strsignal(2);], 471 bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)]) 472AC_MSG_RESULT($bash_cv_have_strsignal) 473if test $bash_cv_have_strsignal = yes; then 474AC_DEFINE(HAVE_STRSIGNAL) 475fi 476]) 477 478AC_DEFUN(BASH_FUNC_LSTAT, 479[dnl Cannot use AC_CHECK_FUNCS(lstat) because Linux defines lstat() as an 480dnl inline function in <sys/stat.h>. 481AC_CACHE_CHECK([for lstat], bash_cv_func_lstat, 482[AC_TRY_LINK([ 483#include <sys/types.h> 484#include <sys/stat.h>
|
351],[ lstat("",(struct stat *)0); ],
|
485],[ lstat(".",(struct stat *)0); ], |
486bash_cv_func_lstat=yes, bash_cv_func_lstat=no)]) 487if test $bash_cv_func_lstat = yes; then 488 AC_DEFINE(HAVE_LSTAT) 489fi 490]) 491 492AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC, 493[AC_MSG_CHECKING([for a c_line member of struct termios]) 494AC_CACHE_VAL(bash_cv_termios_ldisc, 495[AC_TRY_COMPILE([#include <sys/types.h> 496#include <termios.h>],[struct termios t; int i; i = t.c_line;], 497 bash_cv_termios_ldisc=yes, bash_cv_termios_ldisc=no)])dnl 498AC_MSG_RESULT($bash_cv_termios_ldisc) 499if test $bash_cv_termios_ldisc = yes; then 500AC_DEFINE(TERMIOS_LDISC) 501fi 502]) 503 504AC_DEFUN(BASH_STRUCT_TERMIO_LDISC, 505[AC_MSG_CHECKING([for a c_line member of struct termio]) 506AC_CACHE_VAL(bash_cv_termio_ldisc, 507[AC_TRY_COMPILE([#include <sys/types.h> 508#include <termio.h>],[struct termio t; int i; i = t.c_line;], 509 bash_cv_termio_ldisc=yes, bash_cv_termio_ldisc=no)])dnl 510AC_MSG_RESULT($bash_cv_termio_ldisc) 511if test $bash_cv_termio_ldisc = yes; then 512AC_DEFINE(TERMIO_LDISC) 513fi 514]) 515 516AC_DEFUN(BASH_FUNC_GETENV, 517[AC_MSG_CHECKING(to see if getenv can be redefined) 518AC_CACHE_VAL(bash_cv_getenv_redef, 519[AC_TRY_RUN([ 520#ifdef HAVE_UNISTD_H 521# include <unistd.h> 522#endif 523#ifndef __STDC__ 524# ifndef const 525# define const 526# endif 527#endif 528char * 529getenv (name) 530#if defined (__linux__) || defined (__bsdi__) || defined (convex) 531 const char *name; 532#else 533 char const *name; 534#endif /* !__linux__ && !__bsdi__ && !convex */ 535{ 536return "42"; 537} 538main() 539{ 540char *s; 541/* The next allows this program to run, but does not allow bash to link 542 when it redefines getenv. I'm not really interested in figuring out 543 why not. */ 544#if defined (NeXT) 545exit(1); 546#endif 547s = getenv("ABCDE"); 548exit(s == 0); /* force optimizer to leave getenv in */ 549} 550], bash_cv_getenv_redef=yes, bash_cv_getenv_redef=no,
|
417AC_MSG_ERROR(cannot check getenv redefinition if cross compiling))])
|
551 [AC_MSG_ERROR(cannot check getenv redefinition if cross compiling -- defaulting to yes) 552 bash_cv_getenv_redef=yes] 553)]) |
554AC_MSG_RESULT($bash_cv_getenv_redef) 555if test $bash_cv_getenv_redef = yes; then 556AC_DEFINE(CAN_REDEFINE_GETENV) 557fi 558]) 559 560AC_DEFUN(BASH_FUNC_PRINTF, 561[AC_MSG_CHECKING(for declaration of printf in <stdio.h>) 562AC_CACHE_VAL(bash_cv_printf_declared, 563[AC_TRY_RUN([ 564#include <stdio.h> 565#ifdef __STDC__ 566typedef int (*_bashfunc)(const char *, ...); 567#else 568typedef int (*_bashfunc)(); 569#endif 570main() 571{ 572_bashfunc pf;
|
437pf = printf;
|
573pf = (_bashfunc) printf; |
574exit(pf == 0); 575}
|
440],bash_cv_printf_declared=yes, bash_cv_printf_declared=no,
441AC_MSG_ERROR(cannot check printf declaration if cross compiling))])
|
576], bash_cv_printf_declared=yes, bash_cv_printf_declared=no, 577 [AC_MSG_ERROR(cannot check printf declaration if cross compiling -- defaulting to yes) 578 bash_cv_printf_declared=yes] 579)]) |
580AC_MSG_RESULT($bash_cv_printf_declared) 581if test $bash_cv_printf_declared = yes; then 582AC_DEFINE(PRINTF_DECLARED) 583fi 584]) 585 586AC_DEFUN(BASH_FUNC_ULIMIT_MAXFDS, 587[AC_MSG_CHECKING(whether ulimit can substitute for getdtablesize) 588AC_CACHE_VAL(bash_cv_ulimit_maxfds, 589[AC_TRY_RUN([ 590main() 591{ 592long maxfds = ulimit(4, 0L); 593exit (maxfds == -1L); 594}
|
457],bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no,
458AC_MSG_ERROR(cannot check ulimit if cross compiling))])
|
595], bash_cv_ulimit_maxfds=yes, bash_cv_ulimit_maxfds=no, 596 [AC_MSG_ERROR(cannot check ulimit if cross compiling -- defaulting to no) 597 bash_cv_ulimit_maxfds=no] 598)]) |
599AC_MSG_RESULT($bash_cv_ulimit_maxfds) 600if test $bash_cv_ulimit_maxfds = yes; then 601AC_DEFINE(ULIMIT_MAXFDS) 602fi 603]) 604 605AC_DEFUN(BASH_CHECK_LIB_TERMCAP, 606[ 607if test "X$bash_cv_termcap_lib" = "X"; then 608_bash_needmsg=yes 609else 610AC_MSG_CHECKING(which library has the termcap functions) 611_bash_needmsg= 612fi 613AC_CACHE_VAL(bash_cv_termcap_lib, 614[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, 615 [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, 616 [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, 617 bash_cv_termcap_lib=gnutermcap)])])]) 618if test "X$_bash_needmsg" = "Xyes"; then 619AC_MSG_CHECKING(which library has the termcap functions) 620fi 621AC_MSG_RESULT(using $bash_cv_termcap_lib)
|
482if test $bash_cv_termcap_lib = gnutermcap; then
|
622if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then |
623LDFLAGS="$LDFLAGS -L./lib/termcap" 624TERMCAP_LIB="./lib/termcap/libtermcap.a" 625TERMCAP_DEP="./lib/termcap/libtermcap.a" 626elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then 627TERMCAP_LIB=-ltermcap 628TERMCAP_DEP= 629elif test $bash_cv_termcap_lib = libncurses; then 630TERMCAP_LIB=-lncurses 631TERMCAP_DEP= 632else 633TERMCAP_LIB=-lcurses 634TERMCAP_DEP= 635fi 636]) 637 638AC_DEFUN(BASH_FUNC_GETCWD, 639[AC_MSG_CHECKING([if getcwd() calls popen()]) 640AC_CACHE_VAL(bash_cv_getcwd_calls_popen, 641[AC_TRY_RUN([ 642#include <stdio.h> 643#ifdef HAVE_UNISTD_H 644#include <unistd.h> 645#endif 646 647#ifndef __STDC__ 648#ifndef const 649#define const 650#endif 651#endif 652 653int popen_called; 654 655FILE * 656popen(command, type) 657 const char *command; 658 const char *type; 659{ 660 popen_called = 1; 661 return (FILE *)NULL; 662} 663 664FILE *_popen(command, type) 665 const char *command; 666 const char *type; 667{ 668 return (popen (command, type)); 669} 670 671int 672pclose(stream) 673FILE *stream; 674{ 675 return 0; 676} 677 678int 679_pclose(stream) 680FILE *stream; 681{ 682 return 0; 683} 684 685main() 686{ 687 char lbuf[32]; 688 popen_called = 0; 689 getcwd(lbuf, 32); 690 exit (popen_called); 691} 692], bash_cv_getcwd_calls_popen=no, bash_cv_getcwd_calls_popen=yes,
|
553AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling))])
|
693 [AC_MSG_ERROR(cannot check whether getcwd calls popen if cross compiling -- defaulting to no) 694 bash_cv_getcwd_calls_popen=no] 695)]) |
696AC_MSG_RESULT($bash_cv_getcwd_calls_popen) 697if test $bash_cv_getcwd_calls_popen = yes; then 698AC_DEFINE(GETCWD_BROKEN) 699fi 700]) 701 702AC_DEFUN(BASH_STRUCT_DIRENT_D_INO, 703[AC_REQUIRE([AC_HEADER_DIRENT]) 704AC_MSG_CHECKING(if struct dirent has a d_ino member) 705AC_CACHE_VAL(bash_cv_dirent_has_dino, 706[AC_TRY_COMPILE([ 707#include <stdio.h> 708#include <sys/types.h> 709#ifdef HAVE_UNISTD_H 710# include <unistd.h> 711#endif /* HAVE_UNISTD_H */ 712#if defined(HAVE_DIRENT_H) 713# include <dirent.h> 714#else 715# define dirent direct 716# ifdef HAVE_SYS_NDIR_H 717# include <sys/ndir.h> 718# endif /* SYSNDIR */ 719# ifdef HAVE_SYS_DIR_H 720# include <sys/dir.h> 721# endif /* SYSDIR */ 722# ifdef HAVE_NDIR_H 723# include <ndir.h> 724# endif 725#endif /* HAVE_DIRENT_H */ 726],[ 727struct dirent d; int z; z = d.d_ino; 728], bash_cv_dirent_has_dino=yes, bash_cv_dirent_has_dino=no)]) 729AC_MSG_RESULT($bash_cv_dirent_has_dino) 730if test $bash_cv_dirent_has_dino = yes; then 731AC_DEFINE(STRUCT_DIRENT_HAS_D_INO) 732fi 733]) 734 735AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO, 736[AC_REQUIRE([AC_HEADER_DIRENT]) 737AC_MSG_CHECKING(if struct dirent has a d_fileno member) 738AC_CACHE_VAL(bash_cv_dirent_has_d_fileno, 739[AC_TRY_COMPILE([ 740#include <stdio.h> 741#include <sys/types.h> 742#ifdef HAVE_UNISTD_H 743# include <unistd.h> 744#endif /* HAVE_UNISTD_H */ 745#if defined(HAVE_DIRENT_H) 746# include <dirent.h> 747#else 748# define dirent direct 749# ifdef HAVE_SYS_NDIR_H 750# include <sys/ndir.h> 751# endif /* SYSNDIR */ 752# ifdef HAVE_SYS_DIR_H 753# include <sys/dir.h> 754# endif /* SYSDIR */ 755# ifdef HAVE_NDIR_H 756# include <ndir.h> 757# endif 758#endif /* HAVE_DIRENT_H */ 759],[ 760struct dirent d; int z; z = d.d_fileno; 761], bash_cv_dirent_has_d_fileno=yes, bash_cv_dirent_has_d_fileno=no)]) 762AC_MSG_RESULT($bash_cv_dirent_has_d_fileno) 763if test $bash_cv_dirent_has_d_fileno = yes; then 764AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO) 765fi 766]) 767 768AC_DEFUN(BASH_REINSTALL_SIGHANDLERS, 769[AC_REQUIRE([AC_TYPE_SIGNAL]) 770AC_REQUIRE([BASH_SIGNAL_CHECK]) 771AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) 772AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers, 773[AC_TRY_RUN([ 774#include <signal.h> 775#ifdef HAVE_UNISTD_H 776#include <unistd.h> 777#endif 778 779typedef RETSIGTYPE sigfunc(); 780 781int nsigint; 782 783#ifdef HAVE_POSIX_SIGNALS 784sigfunc * 785set_signal_handler(sig, handler) 786 int sig; 787 sigfunc *handler; 788{ 789 struct sigaction act, oact; 790 act.sa_handler = handler; 791 act.sa_flags = 0; 792 sigemptyset (&act.sa_mask); 793 sigemptyset (&oact.sa_mask); 794 sigaction (sig, &act, &oact); 795 return (oact.sa_handler); 796} 797#else 798#define set_signal_handler(s, h) signal(s, h) 799#endif 800 801RETSIGTYPE 802sigint(s) 803int s; 804{ 805 nsigint++; 806} 807 808main() 809{ 810 nsigint = 0; 811 set_signal_handler(SIGINT, sigint); 812 kill((int)getpid(), SIGINT); 813 kill((int)getpid(), SIGINT); 814 exit(nsigint != 2); 815} 816], bash_cv_must_reinstall_sighandlers=no, bash_cv_must_reinstall_sighandlers=yes,
|
675AC_MSG_ERROR(cannot check signal handling if cross compiling))])
|
817 [AC_MSG_ERROR(cannot check signal handling if cross compiling -- defaulting to no) 818 bash_cv_must_reinstall_sighandlers=no] 819)]) |
820AC_MSG_RESULT($bash_cv_must_reinstall_sighandlers) 821if test $bash_cv_must_reinstall_sighandlers = yes; then 822AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) 823fi 824]) 825 826AC_DEFUN(BASH_FUNC_SBRK_DECLARED, 827[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>) 828AC_CACHE_VAL(bash_cv_sbrk_declared, 829[AC_EGREP_HEADER(sbrk, unistd.h, 830 bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)]) 831AC_MSG_RESULT($bash_cv_sbrk_declared) 832if test $bash_cv_sbrk_declared = yes; then 833AC_DEFINE(SBRK_DECLARED) 834fi 835]) 836 837dnl check that some necessary job control definitions are present 838AC_DEFUN(BASH_JOB_CONTROL_MISSING, 839[AC_REQUIRE([BASH_SIGNAL_CHECK]) 840AC_MSG_CHECKING(for presence of necessary job control definitions) 841AC_CACHE_VAL(bash_cv_job_control_missing, 842[AC_TRY_RUN([ 843#include <sys/types.h> 844#ifdef HAVE_SYS_WAIT_H 845#include <sys/wait.h> 846#endif 847#ifdef HAVE_UNISTD_H 848#include <unistd.h> 849#endif 850#include <signal.h> 851 852/* Add more tests in here as appropriate. */ 853main() 854{ 855/* signal type */ 856#if !defined (HAVE_POSIX_SIGNALS) && !defined (HAVE_BSD_SIGNALS) 857exit(1); 858#endif 859 860/* signals and tty control. */ 861#if !defined (SIGTSTP) || !defined (SIGSTOP) || !defined (SIGCONT) 862exit (1); 863#endif 864 865/* process control */ 866#if !defined (WNOHANG) || !defined (WUNTRACED) 867exit(1); 868#endif 869 870/* Posix systems have tcgetpgrp and waitpid. */ 871#if defined (_POSIX_VERSION) && !defined (HAVE_TCGETPGRP) 872exit(1); 873#endif 874 875#if defined (_POSIX_VERSION) && !defined (HAVE_WAITPID) 876exit(1); 877#endif 878 879/* Other systems have TIOCSPGRP/TIOCGPRGP and wait3. */ 880#if !defined (_POSIX_VERSION) && !defined (HAVE_WAIT3) 881exit(1); 882#endif 883 884exit(0);
|
741}],bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing,
742 AC_MSG_ERROR(cannot check job control if cross-compiling))
743])
|
885}], bash_cv_job_control_missing=present, bash_cv_job_control_missing=missing, 886 [AC_MSG_ERROR(cannot check job control if cross-compiling -- defaulting to missing) 887 bash_cv_job_control_missing=missing] 888)]) |
889AC_MSG_RESULT($bash_cv_job_control_missing) 890if test $bash_cv_job_control_missing = missing; then 891AC_DEFINE(JOB_CONTROL_MISSING) 892fi 893]) 894 895dnl check whether named pipes are present 896dnl this requires a previous check for mkfifo, but that is awkward to specify 897AC_DEFUN(BASH_SYS_NAMED_PIPES, 898[AC_MSG_CHECKING(for presence of named pipes) 899AC_CACHE_VAL(bash_cv_sys_named_pipes, 900[AC_TRY_RUN([ 901#include <sys/types.h> 902#include <sys/stat.h> 903#ifdef HAVE_UNISTD_H 904#include <unistd.h> 905#endif 906 907/* Add more tests in here as appropriate. */ 908main() 909{ 910int fd; 911 912#if defined (HAVE_MKFIFO) 913exit (0); 914#endif 915 916#if !defined (S_IFIFO) && (defined (_POSIX_VERSION) && !defined (S_ISFIFO)) 917exit (1); 918#endif 919 920#if defined (NeXT) 921exit (1); 922#endif 923 924fd = mknod ("/tmp/sh-np-autoconf", 0666 | S_IFIFO, 0); 925if (fd == -1) 926 exit (1); 927close(fd); 928unlink ("/tmp/sh-np-autoconf"); 929exit(0);
|
785}],bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing,
786 AC_MSG_ERROR(cannot check for named pipes if cross-compiling))
787])
|
930}], bash_cv_sys_named_pipes=present, bash_cv_sys_named_pipes=missing, 931 [AC_MSG_ERROR(cannot check for named pipes if cross-compiling -- defaulting to missing) 932 bash_cv_sys_named_pipes=missing] 933)]) |
934AC_MSG_RESULT($bash_cv_sys_named_pipes) 935if test $bash_cv_sys_named_pipes = missing; then 936AC_DEFINE(NAMED_PIPES_MISSING) 937fi 938]) 939 940AC_DEFUN(BASH_FUNC_POSIX_SETJMP, 941[AC_REQUIRE([BASH_SIGNAL_CHECK]) 942AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp) 943AC_CACHE_VAL(bash_cv_func_sigsetjmp, 944[AC_TRY_RUN([ 945#ifdef HAVE_UNISTD_H 946#include <unistd.h> 947#endif 948#include <sys/types.h> 949#include <signal.h> 950#include <setjmp.h> 951 952main() 953{ 954#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS) 955exit (1); 956#else 957 958int code; 959sigset_t set, oset; 960sigjmp_buf xx; 961 962/* get the mask */ 963sigemptyset(&set); 964sigemptyset(&oset); 965sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set); 966sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset); 967 968/* save it */ 969code = sigsetjmp(xx, 1); 970if (code) 971 exit(0); /* could get sigmask and compare to oset here. */ 972 973/* change it */ 974sigaddset(&set, SIGINT); 975sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL); 976 977/* and siglongjmp */ 978siglongjmp(xx, 10); 979exit(1); 980#endif
|
835}],bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing,
836 AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling))
837])
|
981}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing, 982 [AC_MSG_ERROR(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing) 983 bash_cv_func_sigsetjmp=missing] 984)]) |
985AC_MSG_RESULT($bash_cv_func_sigsetjmp) 986if test $bash_cv_func_sigsetjmp = present; then 987AC_DEFINE(HAVE_POSIX_SIGSETJMP) 988fi 989]) 990 991AC_DEFUN(BASH_HAVE_TIOCGWINSZ, 992[AC_MSG_CHECKING(for TIOCGWINSZ in sys/ioctl.h) 993AC_CACHE_VAL(bash_cv_tiocgwinsz_in_ioctl, 994[AC_TRY_COMPILE([#include <sys/types.h> 995#include <sys/ioctl.h>], [int x = TIOCGWINSZ;], 996 bash_cv_tiocgwinsz_in_ioctl=yes,bash_cv_tiocgwinsz_in_ioctl=no)]) 997AC_MSG_RESULT($bash_cv_tiocgwinsz_in_ioctl) 998if test $bash_cv_tiocgwinsz_in_ioctl = yes; then 999AC_DEFINE(GWINSZ_IN_SYS_IOCTL) 1000fi 1001]) 1002 1003AC_DEFUN(BASH_STRUCT_WINSIZE,
|
857[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h)
858AC_CACHE_VAL(bash_cv_struct_winsize_in_ioctl,
|
1004[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h) 1005AC_CACHE_VAL(bash_cv_struct_winsize_header, |
1006[AC_TRY_COMPILE([#include <sys/types.h> 1007#include <sys/ioctl.h>], [struct winsize x;],
|
861 bash_cv_struct_winsize_in_ioctl=yes,bash_cv_struct_winsize_in_ioctl=no)])
862AC_MSG_RESULT($bash_cv_struct_winsize_in_ioctl)
863if test $bash_cv_struct_winsize_in_ioctl = yes; then
864AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL)
|
1008 bash_cv_struct_winsize_header=ioctl_h, 1009 [AC_TRY_COMPILE([#include <sys/types.h> 1010#include <termios.h>], [struct winsize x;], 1011 bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other) 1012])]) 1013if test $bash_cv_struct_winsize_header = ioctl_h; then 1014 AC_MSG_RESULT(sys/ioctl.h) 1015 AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL) 1016elif test $bash_cv_struct_winsize_header = termios_h; then 1017 AC_MSG_RESULT(termios.h) 1018 AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS) 1019else 1020 AC_MSG_RESULT(not found) |
1021fi 1022]) 1023 1024AC_DEFUN(BASH_HAVE_TIOCSTAT, 1025[AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h) 1026AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl, 1027[AC_TRY_COMPILE([#include <sys/types.h> 1028#include <sys/ioctl.h>], [int x = TIOCSTAT;], 1029 bash_cv_tiocstat_in_ioctl=yes,bash_cv_tiocstat_in_ioctl=no)]) 1030AC_MSG_RESULT($bash_cv_tiocstat_in_ioctl) 1031if test $bash_cv_tiocstat_in_ioctl = yes; then 1032AC_DEFINE(TIOCSTAT_IN_SYS_IOCTL) 1033fi 1034]) 1035 1036AC_DEFUN(BASH_HAVE_FIONREAD, 1037[AC_MSG_CHECKING(for FIONREAD in sys/ioctl.h) 1038AC_CACHE_VAL(bash_cv_fionread_in_ioctl, 1039[AC_TRY_COMPILE([#include <sys/types.h> 1040#include <sys/ioctl.h>], [int x = FIONREAD;], 1041 bash_cv_fionread_in_ioctl=yes,bash_cv_fionread_in_ioctl=no)]) 1042AC_MSG_RESULT($bash_cv_fionread_in_ioctl) 1043if test $bash_cv_fionread_in_ioctl = yes; then 1044AC_DEFINE(FIONREAD_IN_SYS_IOCTL) 1045fi 1046]) 1047 1048dnl 1049dnl See if speed_t is declared in <sys/types.h>. Some versions of linux 1050dnl require a definition of speed_t each time <termcap.h> is included, 1051dnl but you can only get speed_t if you include <termios.h> (on some 1052dnl versions) or <sys/types.h> (on others). 1053dnl 1054AC_DEFUN(BASH_MISC_SPEED_T, 1055[AC_MSG_CHECKING(for speed_t in sys/types.h) 1056AC_CACHE_VAL(bash_cv_speed_t_in_sys_types, 1057[AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;], 1058 bash_cv_speed_t_in_sys_types=yes,bash_cv_speed_t_in_sys_types=no)]) 1059AC_MSG_RESULT($bash_cv_speed_t_in_sys_types) 1060if test $bash_cv_speed_t_in_sys_types = yes; then 1061AC_DEFINE(SPEED_T_IN_SYS_TYPES) 1062fi 1063]) 1064 1065AC_DEFUN(BASH_CHECK_GETPW_FUNCS, 1066[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions) 1067AC_CACHE_VAL(bash_cv_can_redecl_getpw, 1068[AC_TRY_COMPILE([#include <sys/types.h> 1069#include <pwd.h>
|
914extern struct passwd *getpwent();], [struct passwd *z; z = getpwent();],
|
1070extern struct passwd *getpwent(); 1071extern struct passwd *getpwuid(); 1072extern struct passwd *getpwnam();], 1073[struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");], |
1074 bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)]) 1075AC_MSG_RESULT($bash_cv_can_redecl_getpw) 1076if test $bash_cv_can_redecl_getpw = no; then 1077AC_DEFINE(HAVE_GETPW_DECLS) 1078fi 1079]) 1080 1081AC_DEFUN(BASH_CHECK_DEV_FD, 1082[AC_MSG_CHECKING(whether /dev/fd is available) 1083AC_CACHE_VAL(bash_cv_dev_fd, 1084[if test -d /dev/fd && test -r /dev/fd/0; then 1085 bash_cv_dev_fd=standard 1086 elif test -d /proc/self/fd && test -r /proc/self/fd/0; then 1087 bash_cv_dev_fd=whacky 1088 else 1089 bash_cv_dev_fd=absent 1090 fi 1091]) 1092AC_MSG_RESULT($bash_cv_dev_fd) 1093if test $bash_cv_dev_fd = "standard"; then 1094 AC_DEFINE(HAVE_DEV_FD) 1095 AC_DEFINE(DEV_FD_PREFIX, "/dev/fd/") 1096elif test $bash_cv_dev_fd = "whacky"; then 1097 AC_DEFINE(HAVE_DEV_FD) 1098 AC_DEFINE(DEV_FD_PREFIX, "/proc/self/fd/") 1099fi 1100]) 1101 1102dnl 1103dnl Check for the presence of getpeername (the only networking function 1104dnl bash currently requires) in libsocket. If libsocket is present, 1105dnl check for libnsl and add it to LIBS if it's there, since most 1106dnl systems with libsocket require linking with libnsl as well. 1107dnl This should only be called if getpeername was not found in libc. 1108dnl 1109AC_DEFUN(BASH_CHECK_SOCKLIB, 1110[ 1111if test "X$bash_cv_have_socklib" = "X"; then 1112_bash_needmsg= 1113else 1114AC_MSG_CHECKING(for socket library) 1115_bash_needmsg=yes 1116fi 1117AC_CACHE_VAL(bash_cv_have_socklib, 1118[AC_CHECK_LIB(socket, getpeername, 1119 bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)]) 1120if test "X$_bash_needmsg" = Xyes; then 1121 AC_MSG_RESULT($bash_cv_have_socklib) 1122 _bash_needmsg= 1123fi 1124if test $bash_cv_have_socklib = yes; then 1125 # check for libnsl, add it to LIBS if present 1126 if test "X$bash_cv_have_libnsl" = "X"; then 1127 _bash_needmsg= 1128 else 1129 AC_MSG_CHECKING(for libnsl) 1130 _bash_needmsg=yes 1131 fi 1132 AC_CACHE_VAL(bash_cv_have_libnsl, 1133 [AC_CHECK_LIB(nsl, t_open, 1134 bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)]) 1135 if test "X$_bash_needmsg" = Xyes; then 1136 AC_MSG_RESULT($bash_cv_have_libnsl) 1137 _bash_needmsg= 1138 fi 1139 if test $bash_cv_have_libnsl = yes; then 1140 LIBS="-lsocket -lnsl $LIBS" 1141 else 1142 LIBS="-lsocket $LIBS" 1143 fi 1144 AC_DEFINE(HAVE_LIBSOCKET) 1145 AC_DEFINE(HAVE_GETPEERNAME) 1146fi 1147]) 1148 1149AC_DEFUN(BASH_DEFAULT_MAIL_DIR, 1150[AC_MSG_CHECKING(for default mail directory) 1151AC_CACHE_VAL(bash_cv_mail_dir, 1152[if test -d /var/mail; then 1153 bash_cv_mail_dir=/var/mail 1154 elif test -d /usr/mail; then 1155 bash_cv_mail_dir=/usr/mail
|
997 elif test -d /usr/spool/mail; then
998 bash_cv_mail_dir=/usr/spool/mail
|
1156 elif test -d /var/spool/mail; then 1157 bash_cv_mail_dir=/var/spool/mail
|
1158 elif test -d /usr/spool/mail; then 1159 bash_cv_mail_dir=/usr/spool/mail |
1160 else 1161 bash_cv_mail_dir=unknown 1162 fi 1163]) 1164AC_MSG_RESULT($bash_cv_mail_dir) 1165if test $bash_cv_mail_dir = "/var/mail"; then 1166 AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/mail") 1167elif test $bash_cv_mail_dir = "/usr/mail"; then 1168 AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/mail") 1169elif test $bash_cv_mail_dir = "/var/spool/mail"; then 1170 AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/spool/mail") 1171elif test $bash_cv_mail_dir = "/usr/spool/mail"; then 1172 AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/spool/mail") 1173else 1174 AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "unknown") 1175fi 1176]) 1177 1178dnl 1179dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions 1180dnl 1181AC_DEFUN(BASH_KERNEL_RLIMIT_CHECK, 1182[AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines]) 1183AC_CACHE_VAL(bash_cv_kernel_rlimit, 1184[AC_TRY_COMPILE([ 1185#include <sys/types.h> 1186#include <sys/resource.h> 1187], 1188[ 1189 int f; 1190 f = RLIMIT_DATA; 1191], bash_cv_kernel_rlimit=no,
|
1033 [AC_TRY_COMPILE([
1034 #include <sys/types.h>
1035 #define _KERNEL
1036 #include <sys/resource.h>
1037 #undef _KERNEL
1038 ],
1039 [
|
1192[AC_TRY_COMPILE([ 1193#include 1194#define _KERNEL 1195#include 1196#undef _KERNEL 1197], 1198[ |
1199 int f; 1200 f = RLIMIT_DATA;
|
1042 ], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)]
|
1201], bash_cv_kernel_rlimit=yes, bash_cv_kernel_rlimit=no)] |
1202)]) 1203AC_MSG_RESULT($bash_cv_kernel_rlimit) 1204if test $bash_cv_kernel_rlimit = yes; then 1205AC_DEFINE(RLIMIT_NEEDS_KERNEL) 1206fi 1207]) 1208 1209AC_DEFUN(BASH_FUNC_STRCOLL, 1210[ 1211AC_MSG_CHECKING(whether or not strcoll and strcmp differ) 1212AC_CACHE_VAL(bash_cv_func_strcoll_broken, 1213[AC_TRY_RUN([ 1214#include <stdio.h> 1215#if defined (HAVE_LOCALE_H) 1216#include <locale.h> 1217#endif 1218 1219main(c, v) 1220int c; 1221char *v[]; 1222{ 1223 int r1, r2; 1224 char *deflocale, *defcoll; 1225 1226#ifdef HAVE_SETLOCALE 1227 deflocale = setlocale(LC_ALL, ""); 1228 defcoll = setlocale(LC_COLLATE, ""); 1229#endif 1230 1231#ifdef HAVE_STRCOLL 1232 /* These two values are taken from tests/glob-test. */ 1233 r1 = strcoll("abd", "aXd"); 1234#else 1235 r1 = 0; 1236#endif 1237 r2 = strcmp("abd", "aXd"); 1238 1239 /* These two should both be greater than 0. It is permissible for 1240 a system to return different values, as long as the sign is the 1241 same. */ 1242 1243 /* Exit with 1 (failure) if these two values are both > 0, since 1244 this tests whether strcoll(3) is broken with respect to strcmp(3) 1245 in the default locale. */ 1246 exit (r1 > 0 && r2 > 0); 1247} 1248], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no,
|
1090 AC_MSG_ERROR(cannot check strcoll if cross compiling))
1091])
|
1249 [AC_MSG_ERROR(cannot check strcoll if cross compiling -- defaulting to no) 1250 bash_cv_func_strcoll_broken=no] 1251)]) |
1252AC_MSG_RESULT($bash_cv_func_strcoll_broken) 1253if test $bash_cv_func_strcoll_broken = yes; then 1254AC_DEFINE(STRCOLL_BROKEN) 1255fi 1256])
|
1257 1258dnl 1259dnl If available, use support for large files unless the user specified 1260dnl one of the CPPFLAGS, LDFLAGS, or LIBS variables (<eggert@twinsun.com> 1261dnl via GNU patch 2.5) 1262dnl 1263AC_DEFUN(BASH_LARGE_FILE_SUPPORT, 1264[AC_MSG_CHECKING(whether large file support needs explicit enabling) 1265ac_getconfs='' 1266ac_result=yes 1267ac_set='' 1268ac_shellvars='CPPFLAGS LDFLAGS LIBS' 1269for ac_shellvar in $ac_shellvars; do 1270 case $ac_shellvar in 1271 CPPFLAGS) ac_lfsvar=LFS_CFLAGS ac_lfs64var=LFS64_CFLAGS ;; 1272 *) ac_lfsvar=LFS_$ac_shellvar ac_lfs64var=LFS64_$ac_shellvar ;; 1273 esac 1274 eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar 1275 (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } 1276 ac_getconf=`getconf $ac_lfsvar` 1277 ac_getconf64=`getconf $ac_lfs64var` 1278 ac_getconfs=$ac_getconfs$ac_getconf\ $ac_getconf64 1279 eval ac_test_$ac_shellvar="\$ac_getconf\ \$ac_getconf64" 1280done 1281case "$ac_result$ac_getconfs" in 1282yes) ac_result=no ;; 1283esac 1284case "$ac_result$ac_set" in 1285yes?*) ac_result="yes, but $ac_set is already set, so use its settings" 1286esac 1287AC_MSG_RESULT($ac_result) 1288case $ac_result in 1289yes) 1290 for ac_shellvar in $ac_shellvars; do 1291 eval $ac_shellvar=\$ac_test_$ac_shellvar 1292 done ;; 1293esac 1294]) 1295 1296dnl 1297dnl AC_SYS_RESTARTABLE_SYSCALLS tests only for restarted system calls 1298dnl after a signal handler has been installed with signal(). Since 1299dnl Bash uses sigaction() if it is available, we need to check whether 1300dnl or not a signal handler installed with sigaction and SA_RESTART 1301dnl causes system calls to be restarted after the signal is caught 1302dnl 1303AC_DEFUN(BASH_SYS_RESTARTABLE_SYSCALLS, 1304[AC_REQUIRE([BASH_SIGNAL_CHECK]) 1305AC_CACHE_CHECK(for restartable system calls with posix sigaction, 1306bash_cv_sys_restartable_syscalls, 1307[AC_TRY_RUN( 1308[/* Exit 0 (true) if wait returns something other than -1, 1309 i.e. the pid of the child, which means that wait was restarted 1310 after getting the signal. */ 1311#include <sys/types.h> 1312#include <signal.h> 1313static int caught = 0; 1314void ucatch (isig) int isig; { caught = 1; } 1315main () 1316{ 1317#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS) 1318 exit (1); 1319#else 1320 struct sigaction act, oact; 1321 int i, status; 1322 1323 act.sa_handler = ucatch; 1324 /* Might want to add SA_RESTART here, but bash's set_signal_handler 1325 does not. */ 1326 act.sa_flags = 0; 1327 sigemptyset(&act.sa_mask); 1328 sigemptyset(&oact.sa_mask); 1329 i = fork (); 1330 /* A possible race condition here, but in practice it never happens. */ 1331 if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } 1332 sigaction(SIGINT, &act, &oact); 1333 status = wait(&i); 1334 if (status == -1) wait(&i); 1335 exit (status == -1); 1336#endif 1337} 1338], bash_cv_sys_restartable_syscalls=yes, bash_cv_sys_restartable_syscalls=no, 1339 AC_MSG_ERROR(cannot check restartable syscalls if cross compiling)) 1340]) 1341if test $bash_cv_sys_restartable_syscalls = yes; then 1342 AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS) 1343fi 1344]) |
|