From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: PATCH: configure test for pty multiplexor
Date: Tue, 17 Feb 2004 13:51:53 +0000 [thread overview]
Message-ID: <12371.1077025913@csr.com> (raw)
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 <sys/stropts.h>
#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 <pws@csr.com> 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
**********************************************************************
next reply other threads:[~2004-02-17 13:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-17 13:51 Peter Stephenson [this message]
2004-02-17 15:09 ` DervishD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12371.1077025913@csr.com \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).