From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21498 invoked from network); 17 Feb 2004 13:52:05 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 17 Feb 2004 13:52:05 -0000 Received: (qmail 15027 invoked by alias); 17 Feb 2004 13:51:57 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19429 Received: (qmail 15014 invoked from network); 17 Feb 2004 13:51:56 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 17 Feb 2004 13:51:56 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.58.19] by sunsite.dk (MessageWall 1.0.8) with SMTP; 17 Feb 2004 13:51:55 -0000 Received: from MAILSWEEPER01.csr.com (mailhost1.csr.com [62.189.183.235]) by lhuumrelay3.lnd.ops.eu.uu.net (8.11.0/8.11.0) with ESMTP id i1HDpsv15139 for ; Tue, 17 Feb 2004 13:51:54 GMT Received: from EXCHANGE02.csr.com (unverified [192.168.137.45]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Tue, 17 Feb 2004 13:51:36 +0000 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Tue, 17 Feb 2004 13:52:51 +0000 To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: PATCH: configure test for pty multiplexor Date: Tue, 17 Feb 2004 13:51:53 +0000 Message-ID: <12371.1077025913@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 17 Feb 2004 13:52:51.0921 (UTC) FILETIME=[55F24410:01C3F55D] While I'm in the mood (but not remotely in the mood for curses configuration), here is an attempt to make configure check for usability of /dev/ptmx. The tests are fairly simple and if there are systems that use this stuff in a different way we will come unstuck. It compiled and passed the tests on Solaris 8. It compiled (using /dev/ptmx) on RedHat 9, but I couldn't run the tests because the directory is Samba-mounted and install gets upset when trying to do a pretend install of the modules. It compiled on Cygwin. Various tests failed in a slightly obscure way. However, that's my normal experience with Cygwin. It should have been using ptmx anyway (and still was). I'm a little unhappy about all this pushing of streams modules, but it's probably well enough tested that it won't actually bomb out. Index: configure.ac =================================================================== RCS file: /cvsroot/zsh/zsh/configure.ac,v retrieving revision 1.5 diff -u -r1.5 configure.ac --- configure.ac 17 Feb 2004 11:36:18 -0000 1.5 +++ configure.ac 17 Feb 2004 12:54:59 -0000 @@ -505,7 +505,8 @@ limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \ locale.h errno.h stdio.h stdlib.h unistd.h sys/capability.h \ utmp.h utmpx.h sys/types.h pwd.h grp.h poll.h sys/mman.h \ - netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h) + netinet/in_systm.h pcre.h langinfo.h wchar.h stddef.h \ + sys/stropts.h) if test $dynamic = yes; then AC_CHECK_HEADERS(dlfcn.h) AC_CHECK_HEADERS(dl.h) @@ -1029,7 +1030,8 @@ pcre_compile pcre_study pcre_exec \ nl_langinfo \ erand48 open_memstream \ - wctomb iconv) + wctomb iconv \ + grantpt unlockpt ptsname) AC_FUNC_STRCOLL dnl Check if tgetent accepts NULL (and will allocate its own termcap buffer) @@ -1796,6 +1798,24 @@ zsh_CHECK_SOCKLEN_T dnl --------------- +dnl Check for pty multiplexer for use in pty module. +dnl We need to open it read/write, so make sure it is writeable. +dnl Yet another test which won't work when cross-compiling. +dnl --------------- +AH_TEMPLATE([HAVE_DEV_PTMX], +[Define to 1 if your system can use /dev/ptmx for creating ptys.]) +AC_CACHE_CHECK(if your system has /dev/ptmx, +ac_cv_have_dev_ptmx, +[if test -w /dev/ptmx; then + ac_cv_have_dev_ptmx=yes +else + ac_cv_have_dev_ptmx=no +fi]) +if test $ac_cv_have_dev_ptmx = yes; then + AC_DEFINE(HAVE_DEV_PTMX) +fi + +dnl --------------- dnl dynamic loading dnl --------------- AH_TEMPLATE([HPUXDYNAMIC], Index: Src/Modules/zpty.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Modules/zpty.c,v retrieving revision 1.27 diff -u -r1.27 zpty.c --- Src/Modules/zpty.c 5 Feb 2003 11:57:09 -0000 1.27 +++ Src/Modules/zpty.c 17 Feb 2004 12:54:59 -0000 @@ -154,12 +154,10 @@ return NULL; } -/**** maybe we should use configure here */ -/**** and we certainly need more/better #if tests */ +#if defined(HAVE_DEV_PTMX) && defined(HAVE_GRANTPT) && \ + defined(HAVE_PTSNAME) && defined(HAVE_UNLOCKPT) -#if defined(__SVR4) || defined(sinix) || defined(__CYGWIN__) - -#if !defined(__CYGWIN__) +#ifdef HAVE_SYS_STROPTS_H #include #endif @@ -192,7 +190,11 @@ close(mfd); return 1; } -#if !defined(__CYGWIN__) +#if defined(I_FIND) && defined(I_PUSH) + /* + * Use if STREAMS is available. The test is probably OK, + * but we could use e.g. the sys/stropts.h test. + */ if ((ret = ioctl(sfd, I_FIND, "ptem")) != 1) if (ret == -1 || ioctl(sfd, I_PUSH, "ptem") == -1) { close(mfd); @@ -211,14 +213,14 @@ close(sfd); return 1; } -#endif /* !defined(__CYGWIN__) */ +#endif *retfd = sfd; return 0; } -#else /* ! (defined(__SVR4) || defined(sinix) || defined(__CYGWIN__)) */ +#else /* No /dev/ptmx or no pt functions */ static int get_pty(int master, int *retfd) @@ -267,7 +269,7 @@ return 1; } -#endif /* __SVR4 */ +#endif /* /dev/ptmx or alternatives */ static int newptycmd(char *nam, char *pname, char **args, int echo, int nblock) -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************