From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17930 invoked from network); 28 May 2004 23:56:19 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.86) by ns1.primenet.com.au with SMTP; 28 May 2004 23:56:19 -0000 Received: (qmail 9674 invoked from network); 28 May 2004 23:56:04 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 May 2004 23:56:04 -0000 Received: (qmail 15714 invoked by alias); 28 May 2004 23:56:02 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19996 Received: (qmail 15702 invoked from network); 28 May 2004 23:56:01 -0000 Received: from thor.dotsrc.org (HELO a.mx.sunsite.dk) (qmailr@130.225.247.86) by sunsite.dk with SMTP; 28 May 2004 23:55:58 -0000 Received: (qmail 9497 invoked from network); 28 May 2004 23:55:58 -0000 Received: from tantale.fifi.org (root@216.27.190.146) by a.mx.sunsite.dk with SMTP; 28 May 2004 23:55:55 -0000 Received: from ceramic.fifi.org (mail@ceramic.fifi.org [216.27.190.147]) by tantale.fifi.org (8.9.3p2/8.9.3/Debian 8.9.3-21) with ESMTP id QAA26791 for ; Fri, 28 May 2004 16:55:52 -0700 Received: from phil by ceramic.fifi.org with local (Exim 4.22) id 1BTrCZ-0002mh-Mv for zsh-workers@sunsite.dk; Fri, 28 May 2004 16:55:51 -0700 To: zsh-workers@sunsite.dk Subject: Spring patch clean-up: HAVE_BROKEN_TCSETPGRP and backgrounded ./configure Mail-Copies-To: nobody From: Philippe Troin Date: 28 May 2004 16:55:51 -0700 Message-ID: <87brk8ayyg.fsf@ceramic.fifi.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: Philippe Troin X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=0.0 required=6.0 tests=none autolearn=no version=2.63 X-Spam-Hits: 0.0 --=-=-= This patch was discussed here: http://www.zsh.org/cgi-bin/mla/redirect?usernumber=6812 Executive summary: 1. some people have complained that running zsh's configure in the background hangs when checking for broken tcsetpgrp(). 2. some people have complained that if they run zsh's configure a some magic build script that does not have a controlling tty, then zsh is built incorrectly (tcsetpgrp() is then assumed broken). - this patch takes care of #1 by blocking SIGTTOU during the duration of the "checking for broken tcsetpgrp" test. - this patch takes care of #2 by adding a new ./configure option --with-tcsetpgrp, which behaves this way: * under normal circumstances (running with a ctty), this option is not needed. * ./configure will abort and report "Try running configure with --with-tcsetpgrp or --without-tcsetpgrp" if this option is needed (running WITHOUT a ctty). * when --with-tcsetpgrp is specified, the "checking for broken tcsetpgrp" test is skipped. * when --without-tcsetpgrp is specified, the "checking for broken tcsetpgrp" test is skipped and BROKEN_TCSETPGRP is AC_DEFINED. Shall we consider this for inclusion? Phil. Patch against latest CVS sources: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=broken-tcsetpgrp.patch Index: configure.ac =================================================================== RCS file: /cvsroot/zsh/zsh/configure.ac,v retrieving revision 1.17 diff -b -u -r1.17 configure.ac --- configure.ac 6 Apr 2004 09:25:17 -0000 1.17 +++ configure.ac 28 May 2004 23:02:59 -0000 @@ -1766,24 +1766,53 @@ 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 #include +#include 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 ----------- --=-=-=--