diff options
author | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-12-08 22:31:39 +0000 |
---|---|---|
committer | Elena Zannoni <ezannoni@kwikemart.cygnus.com> | 2002-12-08 22:31:39 +0000 |
commit | 9255ee3150832d7e235fc0711f0efa70700559e7 (patch) | |
tree | 97d578647cc7f257e42ce12fa74e570b783ee0b9 /readline/aclocal.m4 | |
parent | ffbceea9fb49e8dd28c88a4b59cf8616b2dcc210 (diff) | |
download | gdb-9255ee3150832d7e235fc0711f0efa70700559e7.zip gdb-9255ee3150832d7e235fc0711f0efa70700559e7.tar.gz gdb-9255ee3150832d7e235fc0711f0efa70700559e7.tar.bz2 |
Import of readline 4.3.
Non-readline modified files:
src/gdb/ChangeLog src/gdb/defs.h src/gdb/cli/cli-cmds.c
src/gdb/cli/cli-setshow.c src/gdb/tui/ChangeLog
src/gdb/tui/tuiWin.c
In readline directory:
* compat.c, mbutil.c, misc.c, rlmbutil.h, rltypedefs.h,
text.c, doc/history.0, doc/history.3, support/wcwidth.c,
examples/readlinebuf.h, examples/rlcat.c: New files.
* CHANGELOG, CHANGES, INSTALL, MANIFEST, Makefile.in, README,
aclocal.m4, ansi_stdlib.h, bind.c, callback.c, chardefs.h,
complete.c, config.h.in, configure, configure.in, display.c,
emacs_keymap.c, funmap.c, histexpand.c, histfile.c, histlib.h,
history.c, history.h, histsearch.c, input.c, isearch.c,
keymaps.c, keymaps.h, kill.c, macro.c, nls.c, parens.c,
posixdir.h, readline.c, readline.h, rlconf.h, rldefs.h,
rlprivate.h, rlshell.h, rlstdc.h, rltty.c, savestring.c,
search.c, shell.c, signals.c, terminal.c, tilde.c, tilde.h,
undo.c, util.c, vi_keymap.c, vi_mode.c, xmalloc.c, xmalloc.h,
doc/Makefile.in, doc/hist.texinfo, doc/hstech.texinfo,
doc/hsuser.texinfo, doc/manvers.texinfo, doc/readline.3,
doc/rlman.texinfo, doc/rltech.texinfo, doc/rluser.texinfo
doc/rluserman.texinfo, doc/texi2dvi, doc/texi2html,
shlib/Makefile.in, support/install.sh, support/mkdirs,
support/mkdist, support/shlib-install, support/shobj-conf,
examples/Inputrc, examples/Makefile.in, examples/fileman.c,
examples/histexamp.c, examples/manexamp.c, examples/rl.c,
examples/rlfe.c, examples/rltest.c, examples/rlversion.c:
Modified files.
Diffstat (limited to 'readline/aclocal.m4')
-rw-r--r-- | readline/aclocal.m4 | 1545 |
1 files changed, 955 insertions, 590 deletions
diff --git a/readline/aclocal.m4 b/readline/aclocal.m4 index f8f5b74..d1ad025 100644 --- a/readline/aclocal.m4 +++ b/readline/aclocal.m4 @@ -3,153 +3,82 @@ dnl Bash specific tests dnl dnl Some derived from PDKSH 5.1.3 autoconf tests dnl -dnl -dnl Check if dup2() does not clear the close on exec flag -dnl -AC_DEFUN(BASH_DUP2_CLOEXEC_CHECK, -[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag) -AC_CACHE_VAL(bash_cv_dup2_broken, -[AC_TRY_RUN([ -#include <sys/types.h> -#include <fcntl.h> + +AC_DEFUN(BASH_C_LONG_LONG, +[AC_CACHE_CHECK(for long long, ac_cv_c_long_long, +[if test "$GCC" = yes; then + ac_cv_c_long_long=yes +else +AC_TRY_RUN([ +int main() { - int fd1, fd2, fl; - fd1 = open("/dev/null", 2); - if (fcntl(fd1, 2, 1) < 0) - exit(1); - fd2 = dup2(fd1, 1); - if (fd2 < 0) - exit(2); - fl = fcntl(fd2, 1, 0); - /* fl will be 1 if dup2 did not reset the close-on-exec flag. */ - exit(fl != 1); +long long foo = 0; +exit(sizeof(long long) < sizeof(long)); } -], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no, - [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no) - bash_cv_dup2_broken=no]) -]) -AC_MSG_RESULT($bash_cv_dup2_broken) -if test $bash_cv_dup2_broken = yes; then -AC_DEFINE(DUP2_BROKEN) -fi -]) - -dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) -AC_DEFUN(BASH_SIGNAL_CHECK, -[AC_REQUIRE([AC_TYPE_SIGNAL]) -AC_MSG_CHECKING(for type of signal functions) -AC_CACHE_VAL(bash_cv_signal_vintage, -[ - AC_TRY_LINK([#include <signal.h>],[ - sigset_t ss; - struct sigaction sa; - sigemptyset(&ss); sigsuspend(&ss); - sigaction(SIGINT, &sa, (struct sigaction *) 0); - sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); - ], bash_cv_signal_vintage=posix, - [ - AC_TRY_LINK([#include <signal.h>], [ - int mask = sigmask(SIGINT); - sigsetmask(mask); sigblock(mask); sigpause(mask); - ], bash_cv_signal_vintage=4.2bsd, - [ - AC_TRY_LINK([ - #include <signal.h> - RETSIGTYPE foo() { }], [ - int mask = sigmask(SIGINT); - sigset(SIGINT, foo); sigrelse(SIGINT); - sighold(SIGINT); sigpause(SIGINT); - ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7 - )] - )] -) -]) -AC_MSG_RESULT($bash_cv_signal_vintage) -if test "$bash_cv_signal_vintage" = posix; then -AC_DEFINE(HAVE_POSIX_SIGNALS) -elif test "$bash_cv_signal_vintage" = "4.2bsd"; then -AC_DEFINE(HAVE_BSD_SIGNALS) -elif test "$bash_cv_signal_vintage" = svr3; then -AC_DEFINE(HAVE_USG_SIGHOLD) +], ac_cv_c_long_long=yes, ac_cv_c_long_long=no) +fi]) +if test $ac_cv_c_long_long = yes; then + AC_DEFINE(HAVE_LONG_LONG, 1, [Define if the `long long' type works.]) fi ]) -dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process. -AC_DEFUN(BASH_PGRP_SYNC, -[AC_REQUIRE([AC_FUNC_GETPGRP]) -AC_MSG_CHECKING(whether pgrps need synchronization) -AC_CACHE_VAL(bash_cv_pgrp_pipe, -[AC_TRY_RUN([ -#ifdef HAVE_UNISTD_H -# include <unistd.h> -#endif +dnl +dnl This is very similar to AC_C_LONG_DOUBLE, with the fix for IRIX +dnl (< changed to <=) added. +dnl +AC_DEFUN(BASH_C_LONG_DOUBLE, +[AC_CACHE_CHECK(for long double, ac_cv_c_long_double, +[if test "$GCC" = yes; then + ac_cv_c_long_double=yes +else +AC_TRY_RUN([ +int main() { -# ifdef GETPGRP_VOID -# define getpgID() getpgrp() -# else -# define getpgID() getpgrp(0) -# define setpgid(x,y) setpgrp(x,y) -# endif - int pid1, pid2, fds[2]; - int status; - char ok; - - switch (pid1 = fork()) { - case -1: - exit(1); - case 0: - setpgid(0, getpid()); - exit(0); - } - setpgid(pid1, pid1); - - sleep(2); /* let first child die */ - - if (pipe(fds) < 0) - exit(2); - - switch (pid2 = fork()) { - case -1: - exit(3); - case 0: - setpgid(0, pid1); - ok = getpgID() == pid1; - write(fds[1], &ok, 1); - exit(0); - } - setpgid(pid2, pid1); - - close(fds[1]); - if (read(fds[0], &ok, 1) != 1) - exit(4); - wait(&status); - wait(&status); - exit(ok ? 0 : 5); + /* The Stardent Vistra knows sizeof(long double), but does not + support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + /* On IRIX 5.3, the compiler converts long double to double with a warning, + but compiles this successfully. */ + exit(sizeof(long double) <= sizeof(double)); } -], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes, - [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no) - bash_cv_pgrp_pipe=no]) -]) -AC_MSG_RESULT($bash_cv_pgrp_pipe) -if test $bash_cv_pgrp_pipe = yes; then -AC_DEFINE(PGRP_PIPE) +], ac_cv_c_long_double=yes, ac_cv_c_long_double=no) +fi]) +if test $ac_cv_c_long_double = yes; then + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if the `long double' type works.]) fi ]) dnl +dnl Check for <inttypes.h>. This is separated out so that it can be +dnl AC_REQUIREd. +dnl +dnl BASH_HEADER_INTTYPES +AC_DEFUN(BASH_HEADER_INTTYPES, +[ + AC_CHECK_HEADERS(inttypes.h) +]) + +dnl dnl check for typedef'd symbols in header files, but allow the caller to dnl specify the include files to be checked in addition to the default dnl dnl BASH_CHECK_TYPE(TYPE, HEADERS, DEFAULT[, VALUE-IF-FOUND]) AC_DEFUN(BASH_CHECK_TYPE, -[AC_REQUIRE([AC_HEADER_STDC])dnl +[ +AC_REQUIRE([AC_HEADER_STDC])dnl +AC_REQUIRE([BASH_HEADER_INTTYPES]) AC_MSG_CHECKING(for $1) AC_CACHE_VAL(bash_cv_type_$1, [AC_EGREP_CPP($1, [#include <sys/types.h> #if STDC_HEADERS #include <stdlib.h> +#include <stddef.h> +#endif +#if HAVE_INTTYPES_H +#include <inttypes.h> #endif $2 ], bash_cv_type_$1=yes, bash_cv_type_$1=no)]) @@ -158,43 +87,74 @@ ifelse($#, 4, [if test $bash_cv_type_$1 = yes; then AC_DEFINE($4) fi]) if test $bash_cv_type_$1 = no; then - AC_DEFINE($1, $3) + AC_DEFINE_UNQUOTED($1, $3) fi ]) dnl -dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0) -dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use -dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify -dnl matters, this just checks for rlim_t, quad_t, or long. +dnl BASH_CHECK_DECL(FUNC) dnl -AC_DEFUN(BASH_RLIMIT_TYPE, -[AC_MSG_CHECKING(for size and type of struct rlimit fields) -AC_CACHE_VAL(bash_cv_type_rlimit, -[AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/resource.h>], -[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[ -AC_TRY_RUN([ -#include <sys/types.h> -#include <sys/time.h> -#include <sys/resource.h> +dnl Check for a declaration of FUNC in stdlib.h and inttypes.h like +dnl AC_CHECK_DECL +dnl +AC_DEFUN(BASH_CHECK_DECL, +[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([BASH_HEADER_INTTYPES]) +AC_CACHE_CHECK([for declaration of $1], bash_cv_decl_$1, +[AC_TRY_LINK( +[ +#if STDC_HEADERS +# include <stdlib.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#endif +], +[return !$1;], +bash_cv_decl_$1=yes, bash_cv_decl_$1=no)]) +bash_tr_func=HAVE_DECL_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +if test $bash_cv_decl_$1 = yes; then + AC_DEFINE_UNQUOTED($bash_tr_func, 1) +else + AC_DEFINE_UNQUOTED($bash_tr_func, 0) +fi +]) + +AC_DEFUN(BASH_DECL_PRINTF, +[AC_MSG_CHECKING(for declaration of printf in <stdio.h>) +AC_CACHE_VAL(bash_cv_printf_declared, +[AC_TRY_RUN([ +#include <stdio.h> +#ifdef __STDC__ +typedef int (*_bashfunc)(const char *, ...); +#else +typedef int (*_bashfunc)(); +#endif main() { -#ifdef HAVE_QUAD_T - struct rlimit rl; - if (sizeof(rl.rlim_cur) == sizeof(quad_t)) - exit(0); -#endif - exit(1); -}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long, - [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long) - bash_cv_type_rlimit=long])]) +_bashfunc pf; +pf = (_bashfunc) printf; +exit(pf == 0); +} +], bash_cv_printf_declared=yes, bash_cv_printf_declared=no, + [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes) + bash_cv_printf_declared=yes] +)]) +AC_MSG_RESULT($bash_cv_printf_declared) +if test $bash_cv_printf_declared = yes; then +AC_DEFINE(PRINTF_DECLARED) +fi ]) -AC_MSG_RESULT($bash_cv_type_rlimit) -if test $bash_cv_type_rlimit = quad_t; then -AC_DEFINE(RLIMTYPE, quad_t) -elif test $bash_cv_type_rlimit = rlim_t; then -AC_DEFINE(RLIMTYPE, rlim_t) + +AC_DEFUN(BASH_DECL_SBRK, +[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>) +AC_CACHE_VAL(bash_cv_sbrk_declared, +[AC_EGREP_HEADER(sbrk, unistd.h, + bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)]) +AC_MSG_RESULT($bash_cv_sbrk_declared) +if test $bash_cv_sbrk_declared = yes; then +AC_DEFINE(SBRK_DECLARED) fi ]) @@ -272,6 +232,20 @@ AC_DEFINE(HAVE_SYS_SIGLIST) fi ]) +dnl Check for the various permutations of sys_siglist and make sure we +dnl compile in siglist.o if they're not defined +AC_DEFUN(BASH_CHECK_SYS_SIGLIST, [ +AC_REQUIRE([BASH_SYS_SIGLIST]) +AC_REQUIRE([BASH_DECL_UNDER_SYS_SIGLIST]) +AC_REQUIRE([BASH_FUNC_STRSIGNAL]) +if test "$bash_cv_sys_siglist" = no && test "$bash_cv_under_sys_siglist" = no && test "$bash_cv_have_strsignal" = no; then + SIGLIST_O=siglist.o +else + SIGLIST_O= +fi +AC_SUBST([SIGLIST_O]) +]) + dnl Check for sys_errlist[] and sys_nerr, check for declaration AC_DEFUN(BASH_SYS_ERRLIST, [AC_MSG_CHECKING([for sys_errlist and sys_nerr]) @@ -287,6 +261,51 @@ AC_DEFINE(HAVE_SYS_ERRLIST) fi ]) +dnl +dnl Check if dup2() does not clear the close on exec flag +dnl +AC_DEFUN(BASH_FUNC_DUP2_CLOEXEC_CHECK, +[AC_MSG_CHECKING(if dup2 fails to clear the close-on-exec flag) +AC_CACHE_VAL(bash_cv_dup2_broken, +[AC_TRY_RUN([ +#include <sys/types.h> +#include <fcntl.h> +main() +{ + int fd1, fd2, fl; + fd1 = open("/dev/null", 2); + if (fcntl(fd1, 2, 1) < 0) + exit(1); + fd2 = dup2(fd1, 1); + if (fd2 < 0) + exit(2); + fl = fcntl(fd2, 1, 0); + /* fl will be 1 if dup2 did not reset the close-on-exec flag. */ + exit(fl != 1); +} +], bash_cv_dup2_broken=yes, bash_cv_dup2_broken=no, + [AC_MSG_WARN(cannot check dup2 if cross compiling -- defaulting to no) + bash_cv_dup2_broken=no]) +]) +AC_MSG_RESULT($bash_cv_dup2_broken) +if test $bash_cv_dup2_broken = yes; then +AC_DEFINE(DUP2_BROKEN) +fi +]) + +AC_DEFUN(BASH_FUNC_STRSIGNAL, +[AC_MSG_CHECKING([for the existence of strsignal]) +AC_CACHE_VAL(bash_cv_have_strsignal, +[AC_TRY_LINK([#include <sys/types.h> +#include <signal.h>], +[char *s = (char *)strsignal(2);], + bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)]) +AC_MSG_RESULT($bash_cv_have_strsignal) +if test $bash_cv_have_strsignal = yes; then +AC_DEFINE(HAVE_STRSIGNAL) +fi +]) + dnl Check to see if opendir will open non-directories (not a nice thing) AC_DEFUN(BASH_FUNC_OPENDIR_CHECK, [AC_REQUIRE([AC_HEADER_DIRENT])dnl @@ -422,6 +441,8 @@ if test "$ac_cv_sizeof_int" = "$ac_cv_sizeof_char_p"; then AC_CHECK_TYPE(ptrdiff_t, int) elif test "$ac_cv_sizeof_long" = "$ac_cv_sizeof_char_p"; then AC_CHECK_TYPE(ptrdiff_t, long) +elif test "$ac_cv_type_long_long" = yes && test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_char_p"; then + AC_CHECK_TYPE(ptrdiff_t, [long long]) else AC_CHECK_TYPE(ptrdiff_t, int) fi @@ -432,10 +453,12 @@ dnl A signed 64-bit quantity dnl AC_DEFUN(BASH_TYPE_BITS64_T, [ -if test "$ac_sv_sizeof_char_p" = 8; then +if test "$ac_cv_sizeof_char_p" = 8; then AC_CHECK_TYPE(bits64_t, char *) elif test "$ac_cv_sizeof_double" = 8; then AC_CHECK_TYPE(bits64_t, double) +elif test -n "$ac_cv_type_long_long" && test "$ac_cv_sizeof_long_long" = 8; then + AC_CHECK_TYPE(bits64_t, [long long]) elif test "$ac_cv_sizeof_long" = 8; then AC_CHECK_TYPE(bits64_t, long) else @@ -443,16 +466,68 @@ else fi ]) -AC_DEFUN(BASH_FUNC_STRSIGNAL, -[AC_MSG_CHECKING([for the existence of strsignal]) -AC_CACHE_VAL(bash_cv_have_strsignal, -[AC_TRY_LINK([#include <sys/types.h> -#include <signal.h>], -[char *s = (char *)strsignal(2);], - bash_cv_have_strsignal=yes, bash_cv_have_strsignal=no)]) -AC_MSG_RESULT($bash_cv_have_strsignal) -if test $bash_cv_have_strsignal = yes; then -AC_DEFINE(HAVE_STRSIGNAL) +AC_DEFUN(BASH_TYPE_LONG_LONG, +[ +AC_CACHE_CHECK([for long long], bash_cv_type_long_long, +[AC_TRY_LINK([ +long long ll = 1; int i = 63;], +[ +long long llm = (long long) -1; +return ll << i | ll >> i | llm / ll | llm % ll; +], bash_cv_type_long_long='long long', bash_cv_type_long_long='long')]) +if test "$bash_cv_type_long_long" = 'long long'; then + AC_DEFINE(HAVE_LONG_LONG, 1) +fi +]) + +AC_DEFUN(BASH_TYPE_UNSIGNED_LONG_LONG, +[ +AC_CACHE_CHECK([for unsigned long long], bash_cv_type_unsigned_long_long, +[AC_TRY_LINK([ +unsigned long long ull = 1; int i = 63;], +[ +unsigned long long ullmax = (unsigned long long) -1; +return ull << i | ull >> i | ullmax / ull | ullmax % ull; +], bash_cv_type_unsigned_long_long='unsigned long long', + bash_cv_type_unsigned_long_long='unsigned long')]) +if test "$bash_cv_type_unsigned_long_long" = 'unsigned long long'; then + AC_DEFINE(HAVE_UNSIGNED_LONG_LONG, 1) +fi +]) + +dnl +dnl Type of struct rlimit fields: some systems (OSF/1, NetBSD, RISC/os 5.0) +dnl have a rlim_t, others (4.4BSD based systems) use quad_t, others use +dnl long and still others use int (HP-UX 9.01, SunOS 4.1.3). To simplify +dnl matters, this just checks for rlim_t, quad_t, or long. +dnl +AC_DEFUN(BASH_TYPE_RLIMIT, +[AC_MSG_CHECKING(for size and type of struct rlimit fields) +AC_CACHE_VAL(bash_cv_type_rlimit, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/resource.h>], +[rlim_t xxx;], bash_cv_type_rlimit=rlim_t,[ +AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +main() +{ +#ifdef HAVE_QUAD_T + struct rlimit rl; + if (sizeof(rl.rlim_cur) == sizeof(quad_t)) + exit(0); +#endif + exit(1); +}], bash_cv_type_rlimit=quad_t, bash_cv_type_rlimit=long, + [AC_MSG_WARN(cannot check quad_t if cross compiling -- defaulting to long) + bash_cv_type_rlimit=long])]) +]) +AC_MSG_RESULT($bash_cv_type_rlimit) +if test $bash_cv_type_rlimit = quad_t; then +AC_DEFINE(RLIMTYPE, quad_t) +elif test $bash_cv_type_rlimit = rlim_t; then +AC_DEFINE(RLIMTYPE, rlim_t) fi ]) @@ -481,30 +556,8 @@ struct in_addr ap;], [ inet_aton("127.0.0.1", &ap); ], bash_cv_func_inet_aton=yes, bash_cv_func_inet_aton=no)]) if test $bash_cv_func_inet_aton = yes; then AC_DEFINE(HAVE_INET_ATON) -fi -]) - -AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC, -[AC_MSG_CHECKING([for a c_line member of struct termios]) -AC_CACHE_VAL(bash_cv_termios_ldisc, -[AC_TRY_COMPILE([#include <sys/types.h> -#include <termios.h>],[struct termios t; int i; i = t.c_line;], - bash_cv_termios_ldisc=yes, bash_cv_termios_ldisc=no)])dnl -AC_MSG_RESULT($bash_cv_termios_ldisc) -if test $bash_cv_termios_ldisc = yes; then -AC_DEFINE(TERMIOS_LDISC) -fi -]) - -AC_DEFUN(BASH_STRUCT_TERMIO_LDISC, -[AC_MSG_CHECKING([for a c_line member of struct termio]) -AC_CACHE_VAL(bash_cv_termio_ldisc, -[AC_TRY_COMPILE([#include <sys/types.h> -#include <termio.h>],[struct termio t; int i; i = t.c_line;], - bash_cv_termio_ldisc=yes, bash_cv_termio_ldisc=no)])dnl -AC_MSG_RESULT($bash_cv_termio_ldisc) -if test $bash_cv_termio_ldisc = yes; then -AC_DEFINE(TERMIO_LDISC) +else + AC_LIBOBJ(inet_aton) fi ]) @@ -552,29 +605,63 @@ AC_DEFINE(CAN_REDEFINE_GETENV) fi ]) -AC_DEFUN(BASH_FUNC_PRINTF, -[AC_MSG_CHECKING(for declaration of printf in <stdio.h>) -AC_CACHE_VAL(bash_cv_printf_declared, -[AC_TRY_RUN([ -#include <stdio.h> -#ifdef __STDC__ -typedef int (*_bashfunc)(const char *, ...); +# We should check for putenv before calling this +AC_DEFUN(BASH_FUNC_STD_PUTENV, +[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_C_PROTOTYPES]) +AC_CACHE_CHECK([for standard-conformant putenv declaration], bash_cv_std_putenv, +[AC_TRY_LINK([ +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#ifndef __STDC__ +# ifndef const +# define const +# endif +#endif +#ifdef PROTOTYPES +extern int putenv (char *); #else -typedef int (*_bashfunc)(); +extern int putenv (); #endif -main() -{ -_bashfunc pf; -pf = (_bashfunc) printf; -exit(pf == 0); -} -], bash_cv_printf_declared=yes, bash_cv_printf_declared=no, - [AC_MSG_WARN(cannot check printf declaration if cross compiling -- defaulting to yes) - bash_cv_printf_declared=yes] +], +[return (putenv == 0);], +bash_cv_std_putenv=yes, bash_cv_std_putenv=no )]) -AC_MSG_RESULT($bash_cv_printf_declared) -if test $bash_cv_printf_declared = yes; then -AC_DEFINE(PRINTF_DECLARED) +if test $bash_cv_std_putenv = yes; then +AC_DEFINE(HAVE_STD_PUTENV) +fi +]) + +# We should check for unsetenv before calling this +AC_DEFUN(BASH_FUNC_STD_UNSETENV, +[ +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_C_PROTOTYPES]) +AC_CACHE_CHECK([for standard-conformant unsetenv declaration], bash_cv_std_unsetenv, +[AC_TRY_LINK([ +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#ifndef __STDC__ +# ifndef const +# define const +# endif +#endif +#ifdef PROTOTYPES +extern int unsetenv (const char *); +#else +extern int unsetenv (); +#endif +], +[return (unsetenv == 0);], +bash_cv_std_unsetenv=yes, bash_cv_std_unsetenv=no +)]) +if test $bash_cv_std_unsetenv = yes; then +AC_DEFINE(HAVE_STD_UNSETENV) fi ]) @@ -597,39 +684,6 @@ AC_DEFINE(ULIMIT_MAXFDS) fi ]) -AC_DEFUN(BASH_CHECK_LIB_TERMCAP, -[ -if test "X$bash_cv_termcap_lib" = "X"; then -_bash_needmsg=yes -else -AC_MSG_CHECKING(which library has the termcap functions) -_bash_needmsg= -fi -AC_CACHE_VAL(bash_cv_termcap_lib, -[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, - [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, - [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, - bash_cv_termcap_lib=gnutermcap)])])]) -if test "X$_bash_needmsg" = "Xyes"; then -AC_MSG_CHECKING(which library has the termcap functions) -fi -AC_MSG_RESULT(using $bash_cv_termcap_lib) -if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then -LDFLAGS="$LDFLAGS -L./lib/termcap" -TERMCAP_LIB="./lib/termcap/libtermcap.a" -TERMCAP_DEP="./lib/termcap/libtermcap.a" -elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then -TERMCAP_LIB=-ltermcap -TERMCAP_DEP= -elif test $bash_cv_termcap_lib = libncurses; then -TERMCAP_LIB=-lncurses -TERMCAP_DEP= -else -TERMCAP_LIB=-lcurses -TERMCAP_DEP= -fi -]) - AC_DEFUN(BASH_FUNC_GETCWD, [AC_MSG_CHECKING([if getcwd() calls popen()]) AC_CACHE_VAL(bash_cv_getcwd_calls_popen, @@ -691,6 +745,317 @@ main() AC_MSG_RESULT($bash_cv_getcwd_calls_popen) if test $bash_cv_getcwd_calls_popen = yes; then AC_DEFINE(GETCWD_BROKEN) +AC_LIBOBJ(getcwd) +fi +]) + +dnl +dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every +dnl system, we can't use AC_PREREQ +dnl +AC_DEFUN(BASH_FUNC_GETHOSTBYNAME, +[if test "X$bash_cv_have_gethostbyname" = "X"; then +_bash_needmsg=yes +else +AC_MSG_CHECKING(for gethostbyname in socket library) +_bash_needmsg= +fi +AC_CACHE_VAL(bash_cv_have_gethostbyname, +[AC_TRY_LINK([#include <netdb.h>], +[ struct hostent *hp; + hp = gethostbyname("localhost"); +], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)] +) +if test "X$_bash_needmsg" = Xyes; then + AC_MSG_CHECKING(for gethostbyname in socket library) +fi +AC_MSG_RESULT($bash_cv_have_gethostbyname) +if test "$bash_cv_have_gethostbyname" = yes; then +AC_DEFINE(HAVE_GETHOSTBYNAME) +fi +]) + +AC_DEFUN(BASH_FUNC_FNMATCH_EXTMATCH, +[AC_MSG_CHECKING(if fnmatch does extended pattern matching with FNM_EXTMATCH) +AC_CACHE_VAL(bash_cv_fnm_extmatch, +[AC_TRY_RUN([ +#include <fnmatch.h> + +main() +{ +#ifdef FNM_EXTMATCH + exit (0); +#else + exit (1); +#endif +} +], bash_cv_fnm_extmatch=yes, bash_cv_fnm_extmatch=no, + [AC_MSG_WARN(cannot check FNM_EXTMATCH if cross compiling -- defaulting to no) + bash_cv_fnm_extmatch=no]) +]) +AC_MSG_RESULT($bash_cv_fnm_extmatch) +if test $bash_cv_fnm_extmatch = yes; then +AC_DEFINE(HAVE_LIBC_FNM_EXTMATCH) +fi +]) + +AC_DEFUN(BASH_FUNC_POSIX_SETJMP, +[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE]) +AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp) +AC_CACHE_VAL(bash_cv_func_sigsetjmp, +[AC_TRY_RUN([ +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#include <sys/types.h> +#include <signal.h> +#include <setjmp.h> + +main() +{ +#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS) +exit (1); +#else + +int code; +sigset_t set, oset; +sigjmp_buf xx; + +/* get the mask */ +sigemptyset(&set); +sigemptyset(&oset); +sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set); +sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset); + +/* save it */ +code = sigsetjmp(xx, 1); +if (code) + exit(0); /* could get sigmask and compare to oset here. */ + +/* change it */ +sigaddset(&set, SIGINT); +sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL); + +/* and siglongjmp */ +siglongjmp(xx, 10); +exit(1); +#endif +}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing, + [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing) + bash_cv_func_sigsetjmp=missing] +)]) +AC_MSG_RESULT($bash_cv_func_sigsetjmp) +if test $bash_cv_func_sigsetjmp = present; then +AC_DEFINE(HAVE_POSIX_SIGSETJMP) +fi +]) + +AC_DEFUN(BASH_FUNC_STRCOLL, +[ +AC_MSG_CHECKING(whether or not strcoll and strcmp differ) +AC_CACHE_VAL(bash_cv_func_strcoll_broken, +[AC_TRY_RUN([ +#include <stdio.h> +#if defined (HAVE_LOCALE_H) +#include <locale.h> +#endif + +main(c, v) +int c; +char *v[]; +{ + int r1, r2; + char *deflocale, *defcoll; + +#ifdef HAVE_SETLOCALE + deflocale = setlocale(LC_ALL, ""); + defcoll = setlocale(LC_COLLATE, ""); +#endif + +#ifdef HAVE_STRCOLL + /* These two values are taken from tests/glob-test. */ + r1 = strcoll("abd", "aXd"); +#else + r1 = 0; +#endif + r2 = strcmp("abd", "aXd"); + + /* These two should both be greater than 0. It is permissible for + a system to return different values, as long as the sign is the + same. */ + + /* Exit with 1 (failure) if these two values are both > 0, since + this tests whether strcoll(3) is broken with respect to strcmp(3) + in the default locale. */ + exit (r1 > 0 && r2 > 0); +} +], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no, + [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no) + bash_cv_func_strcoll_broken=no] +)]) +AC_MSG_RESULT($bash_cv_func_strcoll_broken) +if test $bash_cv_func_strcoll_broken = yes; then +AC_DEFINE(STRCOLL_BROKEN) +fi +]) + +AC_DEFUN(BASH_FUNC_PRINTF_A_FORMAT, +[AC_MSG_CHECKING([for printf floating point output in hex notation]) +AC_CACHE_VAL(bash_cv_printf_a_format, +[AC_TRY_RUN([ +#include <stdio.h> +#include <string.h> + +int +main() +{ + double y = 0.0; + char abuf[1024]; + + sprintf(abuf, "%A", y); + exit(strchr(abuf, 'P') == (char *)0); +} +], bash_cv_printf_a_format=yes, bash_cv_printf_a_format=no, + [AC_MSG_WARN(cannot check printf if cross compiling -- defaulting to no) + bash_cv_printf_a_format=no] +)]) +AC_MSG_RESULT($bash_cv_printf_a_format) +if test $bash_cv_printf_a_format = yes; then +AC_DEFINE(HAVE_PRINTF_A_FORMAT) +fi +]) + +AC_DEFUN(BASH_STRUCT_TERMIOS_LDISC, +[ +AC_CHECK_MEMBER(struct termios.c_line, AC_DEFINE(TERMIOS_LDISC), ,[ +#include <sys/types.h> +#include <termios.h> +]) +]) + +AC_DEFUN(BASH_STRUCT_TERMIO_LDISC, +[ +AC_CHECK_MEMBER(struct termio.c_line, AC_DEFINE(TERMIO_LDISC), ,[ +#include <sys/types.h> +#include <termio.h> +]) +]) + +dnl +dnl Like AC_STRUCT_ST_BLOCKS, but doesn't muck with LIBOBJS +dnl +dnl sets bash_cv_struct_stat_st_blocks +dnl +dnl unused for now; we'll see how AC_CHECK_MEMBERS works +dnl +AC_DEFUN(BASH_STRUCT_ST_BLOCKS, +[ +AC_MSG_CHECKING([for struct stat.st_blocks]) +AC_CACHE_VAL(bash_cv_struct_stat_st_blocks, +[AC_TRY_COMPILE( +[ +#include <sys/types.h> +#include <sys/stat.h> +], +[ +main() +{ +static struct stat a; +if (a.st_blocks) return 0; +return 0; +} +], bash_cv_struct_stat_st_blocks=yes, bash_cv_struct_stat_st_blocks=no) +]) +AC_MSG_RESULT($bash_cv_struct_stat_st_blocks) +if test "$bash_cv_struct_stat_st_blocks" = "yes"; then +AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS) +fi +]) + +AC_DEFUN(BASH_CHECK_LIB_TERMCAP, +[ +if test "X$bash_cv_termcap_lib" = "X"; then +_bash_needmsg=yes +else +AC_MSG_CHECKING(which library has the termcap functions) +_bash_needmsg= +fi +AC_CACHE_VAL(bash_cv_termcap_lib, +[AC_CHECK_LIB(termcap, tgetent, bash_cv_termcap_lib=libtermcap, + [AC_CHECK_LIB(tinfo, tgetent, bash_cv_termcap_lib=libtinfo, + [AC_CHECK_LIB(curses, tgetent, bash_cv_termcap_lib=libcurses, + [AC_CHECK_LIB(ncurses, tgetent, bash_cv_termcap_lib=libncurses, + bash_cv_termcap_lib=gnutermcap)])])])]) +if test "X$_bash_needmsg" = "Xyes"; then +AC_MSG_CHECKING(which library has the termcap functions) +fi +AC_MSG_RESULT(using $bash_cv_termcap_lib) +if test $bash_cv_termcap_lib = gnutermcap && test -z "$prefer_curses"; then +LDFLAGS="$LDFLAGS -L./lib/termcap" +TERMCAP_LIB="./lib/termcap/libtermcap.a" +TERMCAP_DEP="./lib/termcap/libtermcap.a" +elif test $bash_cv_termcap_lib = libtermcap && test -z "$prefer_curses"; then +TERMCAP_LIB=-ltermcap +TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libtinfo; then +TERMCAP_LIB=-ltinfo +TERMCAP_DEP= +elif test $bash_cv_termcap_lib = libncurses; then +TERMCAP_LIB=-lncurses +TERMCAP_DEP= +else +TERMCAP_LIB=-lcurses +TERMCAP_DEP= +fi +]) + +dnl +dnl Check for the presence of getpeername in libsocket. +dnl If libsocket is present, check for libnsl and add it to LIBS if +dnl it's there, since most systems with libsocket require linking +dnl with libnsl as well. This should only be called if getpeername +dnl was not found in libc. +dnl +dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT +dnl AS WELL +dnl +AC_DEFUN(BASH_CHECK_LIB_SOCKET, +[ +if test "X$bash_cv_have_socklib" = "X"; then +_bash_needmsg= +else +AC_MSG_CHECKING(for socket library) +_bash_needmsg=yes +fi +AC_CACHE_VAL(bash_cv_have_socklib, +[AC_CHECK_LIB(socket, getpeername, + bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)]) +if test "X$_bash_needmsg" = Xyes; then + AC_MSG_RESULT($bash_cv_have_socklib) + _bash_needmsg= +fi +if test $bash_cv_have_socklib = yes; then + # check for libnsl, add it to LIBS if present + if test "X$bash_cv_have_libnsl" = "X"; then + _bash_needmsg= + else + AC_MSG_CHECKING(for libnsl) + _bash_needmsg=yes + fi + AC_CACHE_VAL(bash_cv_have_libnsl, + [AC_CHECK_LIB(nsl, t_open, + bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)]) + if test "X$_bash_needmsg" = Xyes; then + AC_MSG_RESULT($bash_cv_have_libnsl) + _bash_needmsg= + fi + if test $bash_cv_have_libnsl = yes; then + LIBS="-lsocket -lnsl $LIBS" + else + LIBS="-lsocket $LIBS" + fi + AC_DEFINE(HAVE_LIBSOCKET) + AC_DEFINE(HAVE_GETPEERNAME) fi ]) @@ -760,9 +1125,149 @@ AC_DEFINE(STRUCT_DIRENT_HAS_D_FILENO) fi ]) -AC_DEFUN(BASH_REINSTALL_SIGHANDLERS, +AC_DEFUN(BASH_STRUCT_TIMEVAL, +[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h) +AC_CACHE_VAL(bash_cv_struct_timeval, +[ +AC_EGREP_HEADER(struct timeval, sys/time.h, + bash_cv_struct_timeval=yes, + AC_EGREP_HEADER(struct timeval, time.h, + bash_cv_struct_timeval=yes, + bash_cv_struct_timeval=no)) +]) +AC_MSG_RESULT($bash_cv_struct_timeval) +if test $bash_cv_struct_timeval = yes; then + AC_DEFINE(HAVE_TIMEVAL) +fi +]) + +AC_DEFUN(BASH_STRUCT_WINSIZE, +[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h) +AC_CACHE_VAL(bash_cv_struct_winsize_header, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/ioctl.h>], [struct winsize x;], + bash_cv_struct_winsize_header=ioctl_h, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <termios.h>], [struct winsize x;], + bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other) +])]) +if test $bash_cv_struct_winsize_header = ioctl_h; then + AC_MSG_RESULT(sys/ioctl.h) + AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL) +elif test $bash_cv_struct_winsize_header = termios_h; then + AC_MSG_RESULT(termios.h) + AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS) +else + AC_MSG_RESULT(not found) +fi +]) + +dnl Check type of signal routines (posix, 4.2bsd, 4.1bsd or v7) +AC_DEFUN(BASH_SYS_SIGNAL_VINTAGE, [AC_REQUIRE([AC_TYPE_SIGNAL]) -AC_REQUIRE([BASH_SIGNAL_CHECK]) +AC_MSG_CHECKING(for type of signal functions) +AC_CACHE_VAL(bash_cv_signal_vintage, +[ + AC_TRY_LINK([#include <signal.h>],[ + sigset_t ss; + struct sigaction sa; + sigemptyset(&ss); sigsuspend(&ss); + sigaction(SIGINT, &sa, (struct sigaction *) 0); + sigprocmask(SIG_BLOCK, &ss, (sigset_t *) 0); + ], bash_cv_signal_vintage=posix, + [ + AC_TRY_LINK([#include <signal.h>], [ + int mask = sigmask(SIGINT); + sigsetmask(mask); sigblock(mask); sigpause(mask); + ], bash_cv_signal_vintage=4.2bsd, + [ + AC_TRY_LINK([ + #include <signal.h> + RETSIGTYPE foo() { }], [ + int mask = sigmask(SIGINT); + sigset(SIGINT, foo); sigrelse(SIGINT); + sighold(SIGINT); sigpause(SIGINT); + ], bash_cv_signal_vintage=svr3, bash_cv_signal_vintage=v7 + )] + )] +) +]) +AC_MSG_RESULT($bash_cv_signal_vintage) +if test "$bash_cv_signal_vintage" = posix; then +AC_DEFINE(HAVE_POSIX_SIGNALS) +elif test "$bash_cv_signal_vintage" = "4.2bsd"; then +AC_DEFINE(HAVE_BSD_SIGNALS) +elif test "$bash_cv_signal_vintage" = svr3; then +AC_DEFINE(HAVE_USG_SIGHOLD) +fi +]) + +dnl Check if the pgrp of setpgrp() can't be the pid of a zombie process. +AC_DEFUN(BASH_SYS_PGRP_SYNC, +[AC_REQUIRE([AC_FUNC_GETPGRP]) +AC_MSG_CHECKING(whether pgrps need synchronization) +AC_CACHE_VAL(bash_cv_pgrp_pipe, +[AC_TRY_RUN([ +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif +main() +{ +# ifdef GETPGRP_VOID +# define getpgID() getpgrp() +# else +# define getpgID() getpgrp(0) +# define setpgid(x,y) setpgrp(x,y) +# endif + int pid1, pid2, fds[2]; + int status; + char ok; + + switch (pid1 = fork()) { + case -1: + exit(1); + case 0: + setpgid(0, getpid()); + exit(0); + } + setpgid(pid1, pid1); + + sleep(2); /* let first child die */ + + if (pipe(fds) < 0) + exit(2); + + switch (pid2 = fork()) { + case -1: + exit(3); + case 0: + setpgid(0, pid1); + ok = getpgID() == pid1; + write(fds[1], &ok, 1); + exit(0); + } + setpgid(pid2, pid1); + + close(fds[1]); + if (read(fds[0], &ok, 1) != 1) + exit(4); + wait(&status); + wait(&status); + exit(ok ? 0 : 5); +} +], bash_cv_pgrp_pipe=no,bash_cv_pgrp_pipe=yes, + [AC_MSG_WARN(cannot check pgrp synchronization if cross compiling -- defaulting to no) + bash_cv_pgrp_pipe=no]) +]) +AC_MSG_RESULT($bash_cv_pgrp_pipe) +if test $bash_cv_pgrp_pipe = yes; then +AC_DEFINE(PGRP_PIPE) +fi +]) + +AC_DEFUN(BASH_SYS_REINSTALL_SIGHANDLERS, +[AC_REQUIRE([AC_TYPE_SIGNAL]) +AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE]) AC_MSG_CHECKING([if signal handlers must be reinstalled when invoked]) AC_CACHE_VAL(bash_cv_must_reinstall_sighandlers, [AC_TRY_RUN([ @@ -818,20 +1323,9 @@ AC_DEFINE(MUST_REINSTALL_SIGHANDLERS) fi ]) -AC_DEFUN(BASH_FUNC_SBRK_DECLARED, -[AC_MSG_CHECKING(for declaration of sbrk in <unistd.h>) -AC_CACHE_VAL(bash_cv_sbrk_declared, -[AC_EGREP_HEADER(sbrk, unistd.h, - bash_cv_sbrk_declared=yes, bash_cv_sbrk_declared=no)]) -AC_MSG_RESULT($bash_cv_sbrk_declared) -if test $bash_cv_sbrk_declared = yes; then -AC_DEFINE(SBRK_DECLARED) -fi -]) - dnl check that some necessary job control definitions are present -AC_DEFUN(BASH_JOB_CONTROL_MISSING, -[AC_REQUIRE([BASH_SIGNAL_CHECK]) +AC_DEFUN(BASH_SYS_JOB_CONTROL_MISSING, +[AC_REQUIRE([BASH_SYS_SIGNAL_VINTAGE]) AC_MSG_CHECKING(for presence of necessary job control definitions) AC_CACHE_VAL(bash_cv_job_control_missing, [AC_TRY_RUN([ @@ -939,55 +1433,23 @@ AC_DEFINE(NAMED_PIPES_MISSING) fi ]) -AC_DEFUN(BASH_FUNC_POSIX_SETJMP, -[AC_REQUIRE([BASH_SIGNAL_CHECK]) -AC_MSG_CHECKING(for presence of POSIX-style sigsetjmp/siglongjmp) -AC_CACHE_VAL(bash_cv_func_sigsetjmp, -[AC_TRY_RUN([ -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#include <sys/types.h> -#include <signal.h> -#include <setjmp.h> - -main() -{ -#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS) -exit (1); -#else - -int code; -sigset_t set, oset; -sigjmp_buf xx; - -/* get the mask */ -sigemptyset(&set); -sigemptyset(&oset); -sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &set); -sigprocmask(SIG_BLOCK, (sigset_t *)NULL, &oset); - -/* save it */ -code = sigsetjmp(xx, 1); -if (code) - exit(0); /* could get sigmask and compare to oset here. */ - -/* change it */ -sigaddset(&set, SIGINT); -sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL); - -/* and siglongjmp */ -siglongjmp(xx, 10); -exit(1); -#endif -}], bash_cv_func_sigsetjmp=present, bash_cv_func_sigsetjmp=missing, - [AC_MSG_WARN(cannot check for sigsetjmp/siglongjmp if cross-compiling -- defaulting to missing) - bash_cv_func_sigsetjmp=missing] -)]) -AC_MSG_RESULT($bash_cv_func_sigsetjmp) -if test $bash_cv_func_sigsetjmp = present; then -AC_DEFINE(HAVE_POSIX_SIGSETJMP) -fi +AC_DEFUN(BASH_SYS_DEFAULT_MAIL_DIR, +[AC_MSG_CHECKING(for default mail directory) +AC_CACHE_VAL(bash_cv_mail_dir, +[if test -d /var/mail; then + bash_cv_mail_dir=/var/mail + elif test -d /var/spool/mail; then + bash_cv_mail_dir=/var/spool/mail + elif test -d /usr/mail; then + bash_cv_mail_dir=/usr/mail + elif test -d /usr/spool/mail; then + bash_cv_mail_dir=/usr/spool/mail + else + bash_cv_mail_dir=unknown + fi +]) +AC_MSG_RESULT($bash_cv_mail_dir) +AC_DEFINE_UNQUOTED(DEFAULT_MAIL_DIRECTORY, "$bash_cv_mail_dir") ]) AC_DEFUN(BASH_HAVE_TIOCGWINSZ, @@ -1002,27 +1464,6 @@ AC_DEFINE(GWINSZ_IN_SYS_IOCTL) fi ]) -AC_DEFUN(BASH_STRUCT_WINSIZE, -[AC_MSG_CHECKING(for struct winsize in sys/ioctl.h and termios.h) -AC_CACHE_VAL(bash_cv_struct_winsize_header, -[AC_TRY_COMPILE([#include <sys/types.h> -#include <sys/ioctl.h>], [struct winsize x;], - bash_cv_struct_winsize_header=ioctl_h, - [AC_TRY_COMPILE([#include <sys/types.h> -#include <termios.h>], [struct winsize x;], - bash_cv_struct_winsize_header=termios_h, bash_cv_struct_winsize_header=other) -])]) -if test $bash_cv_struct_winsize_header = ioctl_h; then - AC_MSG_RESULT(sys/ioctl.h) - AC_DEFINE(STRUCT_WINSIZE_IN_SYS_IOCTL) -elif test $bash_cv_struct_winsize_header = termios_h; then - AC_MSG_RESULT(termios.h) - AC_DEFINE(STRUCT_WINSIZE_IN_TERMIOS) -else - AC_MSG_RESULT(not found) -fi -]) - AC_DEFUN(BASH_HAVE_TIOCSTAT, [AC_MSG_CHECKING(for TIOCSTAT in sys/ioctl.h) AC_CACHE_VAL(bash_cv_tiocstat_in_ioctl, @@ -1053,7 +1494,7 @@ dnl require a definition of speed_t each time <termcap.h> is included, dnl but you can only get speed_t if you include <termios.h> (on some dnl versions) or <sys/types.h> (on others). dnl -AC_DEFUN(BASH_MISC_SPEED_T, +AC_DEFUN(BASH_CHECK_SPEED_T, [AC_MSG_CHECKING(for speed_t in sys/types.h) AC_CACHE_VAL(bash_cv_speed_t_in_sys_types, [AC_TRY_COMPILE([#include <sys/types.h>], [speed_t x;], @@ -1065,17 +1506,19 @@ fi ]) AC_DEFUN(BASH_CHECK_GETPW_FUNCS, -[AC_MSG_CHECKING(whether programs are able to redeclare getpw functions) -AC_CACHE_VAL(bash_cv_can_redecl_getpw, -[AC_TRY_COMPILE([#include <sys/types.h> +[AC_MSG_CHECKING(whether getpw functions are declared in pwd.h) +AC_CACHE_VAL(bash_cv_getpw_declared, +[AC_EGREP_CPP(getpwuid, +[ +#include <sys/types.h> +#ifdef HAVE_UNISTD_H +# include <unistd.h> +#endif #include <pwd.h> -extern struct passwd *getpwent(); -extern struct passwd *getpwuid(); -extern struct passwd *getpwnam();], -[struct passwd *z; z = getpwent(); z = getpwuid(0); z = getpwnam("root");], - bash_cv_can_redecl_getpw=yes,bash_cv_can_redecl_getpw=no)]) -AC_MSG_RESULT($bash_cv_can_redecl_getpw) -if test $bash_cv_can_redecl_getpw = no; then +], +bash_cv_getpw_declared=yes,bash_cv_getpw_declared=no)]) +AC_MSG_RESULT($bash_cv_getpw_declared) +if test $bash_cv_getpw_declared = yes; then AC_DEFINE(HAVE_GETPW_DECLS) fi ]) @@ -1119,114 +1562,9 @@ fi ]) dnl -dnl Check for the presence of getpeername in libsocket. -dnl If libsocket is present, check for libnsl and add it to LIBS if -dnl it's there, since most systems with libsocket require linking -dnl with libnsl as well. This should only be called if getpeername -dnl was not found in libc. -dnl -dnl NOTE: IF WE FIND GETPEERNAME, WE ASSUME THAT WE HAVE BIND/CONNECT -dnl AS WELL -dnl -AC_DEFUN(BASH_CHECK_SOCKLIB, -[ -if test "X$bash_cv_have_socklib" = "X"; then -_bash_needmsg= -else -AC_MSG_CHECKING(for socket library) -_bash_needmsg=yes -fi -AC_CACHE_VAL(bash_cv_have_socklib, -[AC_CHECK_LIB(socket, getpeername, - bash_cv_have_socklib=yes, bash_cv_have_socklib=no, -lnsl)]) -if test "X$_bash_needmsg" = Xyes; then - AC_MSG_RESULT($bash_cv_have_socklib) - _bash_needmsg= -fi -if test $bash_cv_have_socklib = yes; then - # check for libnsl, add it to LIBS if present - if test "X$bash_cv_have_libnsl" = "X"; then - _bash_needmsg= - else - AC_MSG_CHECKING(for libnsl) - _bash_needmsg=yes - fi - AC_CACHE_VAL(bash_cv_have_libnsl, - [AC_CHECK_LIB(nsl, t_open, - bash_cv_have_libnsl=yes, bash_cv_have_libnsl=no)]) - if test "X$_bash_needmsg" = Xyes; then - AC_MSG_RESULT($bash_cv_have_libnsl) - _bash_needmsg= - fi - if test $bash_cv_have_libnsl = yes; then - LIBS="-lsocket -lnsl $LIBS" - else - LIBS="-lsocket $LIBS" - fi - AC_DEFINE(HAVE_LIBSOCKET) - AC_DEFINE(HAVE_GETPEERNAME) -fi -]) - -dnl -dnl This needs BASH_CHECK_SOCKLIB, but since that's not called on every -dnl system, we can't use AC_PREREQ -dnl -AC_DEFUN(BASH_FUNC_GETHOSTBYNAME, -[if test "X$bash_cv_have_gethostbyname" = "X"; then -_bash_needmsg=yes -else -AC_MSG_CHECKING(for gethostbyname in socket library) -_bash_needmsg= -fi -AC_CACHE_VAL(bash_cv_have_gethostbyname, -[AC_TRY_LINK([#include <netdb.h>], -[ struct hostent *hp; - hp = gethostbyname("localhost"); -], bash_cv_have_gethostbyname=yes, bash_cv_have_gethostbyname=no)] -) -if test "X$_bash_needmsg" = Xyes; then - AC_MSG_CHECKING(for gethostbyname in socket library) -fi -AC_MSG_RESULT($bash_cv_have_gethostbyname) -if test "$bash_cv_have_gethostbyname" = yes; then -AC_DEFINE(HAVE_GETHOSTBYNAME) -fi -]) - -AC_DEFUN(BASH_DEFAULT_MAIL_DIR, -[AC_MSG_CHECKING(for default mail directory) -AC_CACHE_VAL(bash_cv_mail_dir, -[if test -d /var/mail; then - bash_cv_mail_dir=/var/mail - elif test -d /usr/mail; then - bash_cv_mail_dir=/usr/mail - elif test -d /var/spool/mail; then - bash_cv_mail_dir=/var/spool/mail - elif test -d /usr/spool/mail; then - bash_cv_mail_dir=/usr/spool/mail - else - bash_cv_mail_dir=unknown - fi -]) -AC_MSG_RESULT($bash_cv_mail_dir) -if test $bash_cv_mail_dir = "/var/mail"; then - AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/mail") -elif test $bash_cv_mail_dir = "/usr/mail"; then - AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/mail") -elif test $bash_cv_mail_dir = "/var/spool/mail"; then - AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/var/spool/mail") -elif test $bash_cv_mail_dir = "/usr/spool/mail"; then - AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "/usr/spool/mail") -else - AC_DEFINE(DEFAULT_MAIL_DIRECTORY, "unknown") -fi -]) - -dnl dnl Check if HPUX needs _KERNEL defined for RLIMIT_* definitions dnl -AC_DEFUN(BASH_KERNEL_RLIMIT_CHECK, +AC_DEFUN(BASH_CHECK_KERNEL_RLIMIT, [AC_MSG_CHECKING([whether $host_os needs _KERNEL for RLIMIT defines]) AC_CACHE_VAL(bash_cv_kernel_rlimit, [AC_TRY_COMPILE([ @@ -1254,142 +1592,6 @@ AC_DEFINE(RLIMIT_NEEDS_KERNEL) fi ]) -AC_DEFUN(BASH_FUNC_STRCOLL, -[ -AC_MSG_CHECKING(whether or not strcoll and strcmp differ) -AC_CACHE_VAL(bash_cv_func_strcoll_broken, -[AC_TRY_RUN([ -#include <stdio.h> -#if defined (HAVE_LOCALE_H) -#include <locale.h> -#endif - -main(c, v) -int c; -char *v[]; -{ - int r1, r2; - char *deflocale, *defcoll; - -#ifdef HAVE_SETLOCALE - deflocale = setlocale(LC_ALL, ""); - defcoll = setlocale(LC_COLLATE, ""); -#endif - -#ifdef HAVE_STRCOLL - /* These two values are taken from tests/glob-test. */ - r1 = strcoll("abd", "aXd"); -#else - r1 = 0; -#endif - r2 = strcmp("abd", "aXd"); - - /* These two should both be greater than 0. It is permissible for - a system to return different values, as long as the sign is the - same. */ - - /* Exit with 1 (failure) if these two values are both > 0, since - this tests whether strcoll(3) is broken with respect to strcmp(3) - in the default locale. */ - exit (r1 > 0 && r2 > 0); -} -], bash_cv_func_strcoll_broken=yes, bash_cv_func_strcoll_broken=no, - [AC_MSG_WARN(cannot check strcoll if cross compiling -- defaulting to no) - bash_cv_func_strcoll_broken=no] -)]) -AC_MSG_RESULT($bash_cv_func_strcoll_broken) -if test $bash_cv_func_strcoll_broken = yes; then -AC_DEFINE(STRCOLL_BROKEN) -fi -]) - -dnl -dnl If available, use support for large files unless the user specified -dnl one of the CPPFLAGS, LDFLAGS, or LIBS variables (<eggert@twinsun.com> -dnl via GNU patch 2.5) -dnl -AC_DEFUN(BASH_LARGE_FILE_SUPPORT, -[AC_MSG_CHECKING(whether large file support needs explicit enabling) -ac_getconfs='' -ac_result=yes -ac_set='' -ac_shellvars='CPPFLAGS LDFLAGS LIBS' -for ac_shellvar in $ac_shellvars; do - case $ac_shellvar in - CPPFLAGS) ac_lfsvar=LFS_CFLAGS ac_lfs64var=LFS64_CFLAGS ;; - *) ac_lfsvar=LFS_$ac_shellvar ac_lfs64var=LFS64_$ac_shellvar ;; - esac - eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar - (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; } - ac_getconf=`getconf $ac_lfsvar` - ac_getconf64=`getconf $ac_lfs64var` - ac_getconfs=$ac_getconfs$ac_getconf\ $ac_getconf64 - eval ac_test_$ac_shellvar="\$ac_getconf\ \$ac_getconf64" -done -case "$ac_result$ac_getconfs" in -yes) ac_result=no ;; -esac -case "$ac_result$ac_set" in -yes?*) ac_result="yes, but $ac_set is already set, so use its settings" -esac -AC_MSG_RESULT($ac_result) -case $ac_result in -yes) - for ac_shellvar in $ac_shellvars; do - eval $ac_shellvar=\$ac_test_$ac_shellvar - done ;; -esac -]) - -dnl -dnl AC_SYS_RESTARTABLE_SYSCALLS tests only for restarted system calls -dnl after a signal handler has been installed with signal(). Since -dnl Bash uses sigaction() if it is available, we need to check whether -dnl or not a signal handler installed with sigaction and SA_RESTART -dnl causes system calls to be restarted after the signal is caught -dnl -AC_DEFUN(BASH_SYS_RESTARTABLE_SYSCALLS, -[AC_REQUIRE([BASH_SIGNAL_CHECK]) -AC_CACHE_CHECK(for restartable system calls with posix sigaction, -bash_cv_sys_restartable_syscalls, -[AC_TRY_RUN( -[/* Exit 0 (true) if wait returns something other than -1, - i.e. the pid of the child, which means that wait was restarted - after getting the signal. */ -#include <sys/types.h> -#include <signal.h> -static int caught = 0; -void ucatch (isig) int isig; { caught = 1; } -main () -{ -#if !defined (_POSIX_VERSION) || !defined (HAVE_POSIX_SIGNALS) - exit (1); -#else - struct sigaction act, oact; - int i, status; - - act.sa_handler = ucatch; - /* Might want to add SA_RESTART here, but bash's set_signal_handler - does not. */ - act.sa_flags = 0; - sigemptyset(&act.sa_mask); - sigemptyset(&oact.sa_mask); - i = fork (); - /* A possible race condition here, but in practice it never happens. */ - if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } - sigaction(SIGINT, &act, &oact); - status = wait(&i); - if (status == -1) wait(&i); - exit (status == -1); -#endif -} -], bash_cv_sys_restartable_syscalls=yes, bash_cv_sys_restartable_syscalls=no, - AC_MSG_WARN(cannot check restartable syscalls if cross compiling)) -]) -if test $bash_cv_sys_restartable_syscalls = yes; then - AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS) -fi -]) dnl dnl Check for 64-bit off_t -- used for malloc alignment dnl @@ -1410,18 +1612,181 @@ if test $bash_cv_off_t_64 = yes; then AC_DEFINE(HAVE_OFF_T_64) fi]) -AC_DEFUN(BASH_STRUCT_TIMEVAL, -[AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h) -AC_CACHE_VAL(bash_cv_struct_timeval, +AC_DEFUN(BASH_CHECK_RTSIGS, +[AC_MSG_CHECKING(for unusable real-time signals due to large values) +AC_CACHE_VAL(bash_cv_unusable_rtsigs, +[AC_TRY_RUN([ +#include <sys/types.h> +#include <signal.h> + +#ifndef NSIG +# define NSIG 64 +#endif + +main () +{ + int n_sigs = 2 * NSIG; +#ifdef SIGRTMIN + int rtmin = SIGRTMIN; +#else + int rtmin = 0; +#endif + + exit(rtmin < n_sigs); +}], bash_cv_unusable_rtsigs=yes, bash_cv_unusable_rtsigs=no, + [AC_MSG_WARN(cannot check real-time signals if cross compiling -- defaulting to yes) + bash_cv_unusable_rtsigs=yes] +)]) +AC_MSG_RESULT($bash_cv_unusable_rtsigs) +if test $bash_cv_unusable_rtsigs = yes; then +AC_DEFINE(UNUSABLE_RT_SIGNALS) +fi +]) + +dnl +dnl check for availability of multibyte characters and functions +dnl +AC_DEFUN(BASH_CHECK_MULTIBYTE, [ -AC_EGREP_HEADER(struct timeval, sys/time.h, - bash_cv_struct_timeval=yes, - AC_EGREP_HEADER(struct timeval, time.h, - bash_cv_struct_timeval=yes, - bash_cv_struct_timeval=no)) +AC_CHECK_HEADERS(wctype.h) +AC_CHECK_HEADERS(wchar.h) +AC_CHECK_HEADERS(langinfo.h) + +AC_CHECK_FUNC(mbsrtowcs, AC_DEFINE(HAVE_MBSRTOWCS)) +AC_CHECK_FUNC(wcwidth, AC_DEFINE(HAVE_WCWIDTH)) + +AC_CACHE_CHECK([for mbstate_t], bash_cv_have_mbstate_t, +[AC_TRY_RUN([ +#include <wchar.h> +int +main () +{ + mbstate_t ps; + return 0; +}], bash_cv_have_mbstate_t=yes, bash_cv_have_mbstate_t=no)]) +if test $bash_cv_have_mbstate_t = yes; then + AC_DEFINE(HAVE_MBSTATE_T) +fi + +AC_CACHE_CHECK([for nl_langinfo and CODESET], bash_cv_langinfo_codeset, +[AC_TRY_LINK( +[#include <langinfo.h>], +[char* cs = nl_langinfo(CODESET);], +bash_cv_langinfo_codeset=yes, bash_cv_langinfo_codeset=no)]) +if test $bash_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET) +fi + ]) -AC_MSG_RESULT($bash_cv_struct_timeval) -if test $bash_cv_struct_timeval = yes; then - AC_DEFINE(HAVE_TIMEVAL) + +dnl need: prefix exec_prefix libdir includedir CC TERMCAP_LIB +dnl require: +dnl AC_PROG_CC +dnl BASH_CHECK_LIB_TERMCAP + +AC_DEFUN(RL_LIB_READLINE_VERSION, +[ +AC_REQUIRE([BASH_CHECK_LIB_TERMCAP]) + +AC_MSG_CHECKING([version of installed readline library]) + +# What a pain in the ass this is. + +# save cpp and ld options +_save_CFLAGS="$CFLAGS" +_save_LDFLAGS="$LDFLAGS" +_save_LIBS="$LIBS" + +# Don't set ac_cv_rl_prefix if the caller has already assigned a value. This +# allows the caller to do something like $_rl_prefix=$withval if the user +# specifies --with-installed-readline=PREFIX as an argument to configure + +if test -z "$ac_cv_rl_prefix"; then +test "x$prefix" = xNONE && ac_cv_rl_prefix=$ac_default_prefix || ac_cv_rl_prefix=${prefix} +fi + +eval ac_cv_rl_includedir=${ac_cv_rl_prefix}/include +eval ac_cv_rl_libdir=${ac_cv_rl_prefix}/lib + +LIBS="$LIBS -lreadline ${TERMCAP_LIB}" +CFLAGS="$CFLAGS -I${ac_cv_rl_includedir}" +LDFLAGS="$LDFLAGS -L${ac_cv_rl_libdir}" + +AC_TRY_RUN([ +#include <stdio.h> +#include <readline/readline.h> + +main() +{ + FILE *fp; + fp = fopen("conftest.rlv", "w"); + if (fp == 0) exit(1); + fprintf(fp, "%s\n", rl_library_version ? rl_library_version : "0.0"); + fclose(fp); + exit(0); +} +], +ac_cv_rl_version=`cat conftest.rlv`, +ac_cv_rl_version='0.0', +ac_cv_rl_version='4.2') + +CFLAGS="$_save_CFLAGS" +LDFLAGS="$_save_LDFLAGS" +LIBS="$_save_LIBS" + +RL_MAJOR=0 +RL_MINOR=0 + +# ( +case "$ac_cv_rl_version" in +2*|3*|4*|5*|6*|7*|8*|9*) + RL_MAJOR=`echo $ac_cv_rl_version | sed 's:\..*$::'` + RL_MINOR=`echo $ac_cv_rl_version | sed -e 's:^.*\.::' -e 's:[[a-zA-Z]]*$::'` + ;; +esac + +# ((( +case $RL_MAJOR in +[[0-9][0-9]]) _RL_MAJOR=$RL_MAJOR ;; +[[0-9]]) _RL_MAJOR=0$RL_MAJOR ;; +*) _RL_MAJOR=00 ;; +esac + +# ((( +case $RL_MINOR in +[[0-9][0-9]]) _RL_MINOR=$RL_MINOR ;; +[[0-9]]) _RL_MINOR=0$RL_MINOR ;; +*) _RL_MINOR=00 ;; +esac + +RL_VERSION="0x${_RL_MAJOR}${_RL_MINOR}" + +# Readline versions greater than 4.2 have these defines in readline.h + +if test $ac_cv_rl_version = '0.0' ; then + AC_MSG_WARN([Could not test version of installed readline library.]) +elif test $RL_MAJOR -gt 4 || { test $RL_MAJOR = 4 && test $RL_MINOR -gt 2 ; } ; then + # set these for use by the caller + RL_PREFIX=$ac_cv_rl_prefix + RL_LIBDIR=$ac_cv_rl_libdir + RL_INCLUDEDIR=$ac_cv_rl_includedir + AC_MSG_RESULT($ac_cv_rl_version) +else + +AC_DEFINE_UNQUOTED(RL_READLINE_VERSION, $RL_VERSION, [encoded version of the installed readline library]) +AC_DEFINE_UNQUOTED(RL_VERSION_MAJOR, $RL_MAJOR, [major version of installed readline library]) +AC_DEFINE_UNQUOTED(RL_VERSION_MINOR, $RL_MINOR, [minor version of installed readline library]) + +AC_SUBST(RL_VERSION) +AC_SUBST(RL_MAJOR) +AC_SUBST(RL_MINOR) + +# set these for use by the caller +RL_PREFIX=$ac_cv_rl_prefix +RL_LIBDIR=$ac_cv_rl_libdir +RL_INCLUDEDIR=$ac_cv_rl_includedir + +AC_MSG_RESULT($ac_cv_rl_version) + fi ]) |