Skip to content

Commit

Permalink
20025: --with-tcsetpgrp from Philippe Troin
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Stephenson committed Jun 8, 2004
1 parent f732382 commit 2173c12
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
2004-06-08 Peter Stephenson <pws@csr.com>

* Philippe Troin, 19996, plus 20025: configure.ac, INSTALL: add
configure option --with-tcsetpgrp.

* 20024: Doc/Zsh/func.yo: Improve documentation for TRAPNAL
functions.

Expand Down
6 changes: 6 additions & 0 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ shell is running in some privileged mode. This is turned off by
default as on some systems non-standard headers (in particular AIX) are
required. A direct fix for that problem would be appreciated.

A test for the function tcsetpgrp is turned on by default. The test needs
to run the function to determine if the implementation is usable. However,
this can cause problems when configure is run without a terminal. To avoid
this, use --with-tcsetpgrp or --without-tcsetpgrp to tell configure whether
the function should be used.

Options For Configure
---------------------

Expand Down
47 changes: 38 additions & 9 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1766,24 +1766,53 @@ dnl for instance, BeOS R4.51 does not support it yet
dnl -----------
AH_TEMPLATE([BROKEN_TCSETPGRP],
[Define to 1 if tcsetpgrp() doesn't work, ie BeOS R4.51.])
if test -t 0 && test $ac_cv_func_tcsetpgrp = yes; then
AC_ARG_WITH(tcsetpgrp,
[ --with-tcsetpgrp assumes that tcsetpgrp() exists and works correctly],[
case "x$withval" in
xyes) zsh_working_tcsetpgrp=yes;;
xno) zsh_working_tcsetpgrp=no;;
*) AC_ERROR([please use --with-tcsetpgrp=yes or --with-tcsetpgrp=no]);;
esac],[zsh_working_tcsetpgrp=check])
if test "x$ac_cv_func_tcsetpgrp" = xyes; then
case "x$zsh_working_tcsetpgrp" in
xcheck)
trap "" SIGTTOU > /dev/null 2>&1 || :
AC_CACHE_CHECK(if tcsetpgrp() actually works,
zsh_cv_sys_tcsetpgrp,
[AC_TRY_RUN([
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
main() {
int fd;
int ret;
ret=tcsetpgrp(0, tcgetpgrp(0));
exit(ret<0);
fd=open("/dev/tty", O_RDWR);
if (fd < 0) exit(2);
ret=tcsetpgrp(fd, tcgetpgrp(fd));
if (ret < 0) exit(1);
exit(0);
}
],
zsh_cv_sys_tcsetpgrp=yes,
zsh_cv_sys_tcsetpgrp=no,
zsh_cv_sys_tcsetpgrp=yes)])
if test $zsh_cv_sys_tcsetpgrp = no; then
AC_DEFINE(BROKEN_TCSETPGRP)
fi
zsh_cv_sys_tcsetpgrp=yes, [
case $? in
1) zsh_cv_sys_tcsetpgrp=no;;
2) zsh_cv_sys_tcsetpgrp=notty;;
*) zsh_cv_sys_tcsetpgrp=error;;
esac
], zsh_cv_sys_tcsetpgrp=yes)])
case "x$zsh_cv_sys_tcsetpgrp" in
xno) AC_DEFINE(BROKEN_TCSETPGRP);;
xyes) :;;
xnotty) AC_MSG_ERROR([no controlling tty
Try running configure with --with-tcsetpgrp or --without-tcsetpgrp]);;
*) AC_MSG_ERROR([unexpected return status]);;
esac
trap - SIGTTOU > /dev/null 2>&1 || :
;;
xyes) :;;
xno) AC_DEFINE(BROKEN_TCSETPGRP);;
*) AC_MSG_ERROR([unexpected value zsh_working_tcsetpgrp=$zsh_working_tcsetpgrp]);;
esac
fi

dnl -----------
Expand Down

0 comments on commit 2173c12

Please sign in to comment.