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