summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--configure.ac60
-rw-r--r--src/ChangeLog6
-rw-r--r--src/s/aix4-2.h1
-rw-r--r--src/s/bsd-common.h3
-rw-r--r--src/s/cygwin.h1
-rw-r--r--src/s/darwin.h6
-rw-r--r--src/s/gnu-linux.h11
-rw-r--r--src/s/hpux10-20.h4
-rw-r--r--src/s/irix6-5.h7
-rw-r--r--src/s/template.h4
-rw-r--r--src/s/usg5-4-common.h4
12 files changed, 69 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bab598fac..cd5300ff23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,7 +5,8 @@
* configure.ac (NARROWPROTO, NO_ABORT, BROKEN_GET_CURRENT_DIR_NAME)
(BROKEN_FIONREAD, BROKEN_PTY_READ_AFTER_EAGAIN, BROKEN_SIGAIO)
- (BROKEN_SIGPOLL, BROKEN_SIGPTY, G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP)
+ (BROKEN_SIGPOLL, BROKEN_SIGPTY, FIRST_PTY_LETTER)
+ (G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP, PTY_ITERATION)
(RUN_TIME_REMAP, SETPGRP_RELEASES_CTTY, TAB3, TABDLY, RUN_TIME_REMAP
(XOS_NEEDS_TIME_H): Move here from src/s.
diff --git a/configure.ac b/configure.ac
index 60d17e9bdd..77fe10c0e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3291,6 +3291,66 @@ case $opsys in
esac
+dnl Used in process.c, this must be a loop, even if it only runs once.
+dnl (Except on SGI; see below. Take that, clarity and consistency!)
+AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
+dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
+dnl trying suffixes 0-16.
+AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
+ first PTY, if PTYs are supported.])
+
+case $opsys in
+ aix4-2 )
+ AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)] )
+ ;;
+
+ cygwin )
+ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+ ;;
+
+ darwin )
+ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+ dnl Not used, because PTY_ITERATION is defined.
+ AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+ ;;
+
+ gnu | hpux* | freebsd | netbsd | openbsd )
+ AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+ ;;
+
+ gnu-linux | gnu-kfreebsd )
+ dnl if HAVE_GRANTPT
+ if test "x$ac_cv_func_grantpt" = xyes; then
+ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+ else
+ AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+ fi
+ ;;
+
+ irix6-5 )
+ dnl It looks like this cannot be right, because it is not a loop.
+ dnl However, process.c actually does this:
+ dnl # ifndef __sgi
+ dnl continue;
+ dnl # else
+ dnl return -1;
+ dnl # endif
+ dnl which presumably makes it OK, since irix == sgi (?).
+ dnl FIXME it seems like this special treatment is unnecessary?
+ dnl Why can't irix use a single-trip loop like eg cygwin?
+ AC_DEFINE(PTY_ITERATION, [])
+ dnl Not used, because PTY_ITERATION is defined.
+ AC_DEFINE(FIRST_PTY_LETTER, ['q'])
+ ;;
+
+ sol2* | unixware )
+ dnl This change means that we don't loop through allocate_pty too
+ dnl many times in the (rare) event of a failure.
+ AC_DEFINE(FIRST_PTY_LETTER, ['z'])
+ ;;
+esac
+
+
AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
"typing" a signal character on the pty.])
diff --git a/src/ChangeLog b/src/ChangeLog
index 7b6eaa3820..19b8925906 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-12 Glenn Morris <rgm@gnu.org>
+
+ * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
+ * s/gnu-linux.h, s/hpux10-20.h, s/irix6-5.h, s/template.h:
+ * s/usg5-4-common.h: Move FIRST_PTY_LETTER, PTY_ITERATION to configure.
+
2012-07-12 Dmitry Antipov <dmantipov@yandex.ru>
Use empty_unibyte_string where applicable.
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 4287eea9dc..326d7217ac 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
To get the name of the slave side, you just ttyname() the master side. */
-#define PTY_ITERATION int c; for (c = 0; !c ; c++)
#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
index 901ed0c490..681f659901 100644
--- a/src/s/bsd-common.h
+++ b/src/s/bsd-common.h
@@ -36,6 +36,3 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* For mem-limits.h. */
#define BSD4_2
-
-/* First pty name is /dev/ptyp0. */
-#define FIRST_PTY_LETTER 'p'
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index fb5d3b08f4..89db0a047b 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -17,7 +17,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-#define PTY_ITERATION int i; for (i = 0; i < 1; i++) /* ick */
#define PTY_NAME_SPRINTF /* none */
#define PTY_TTY_NAME_SPRINTF /* none */
#define PTY_OPEN \
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 7b4b5e196e..68667ed7c9 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -30,12 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
distinguish OS X from pure Darwin. */
#define DARWIN_OS
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'a' means it is /dev/ptya0 */
-#define FIRST_PTY_LETTER 'p'
-
-/* Run only once. We need a `for'-loop because the code uses `continue'. */
-#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
#define PTY_NAME_SPRINTF /* none */
#define PTY_TTY_NAME_SPRINTF /* none */
/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
diff --git a/src/s/gnu-linux.h b/src/s/gnu-linux.h
index 5e8691b55c..dd4de41f84 100644
--- a/src/s/gnu-linux.h
+++ b/src/s/gnu-linux.h
@@ -28,9 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#if defined HAVE_GRANTPT
#define UNIX98_PTYS
-/* Run only once. We need a `for'-loop because the code uses `continue'. */
-#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
-
#ifdef HAVE_GETPT
#define PTY_NAME_SPRINTF
#define PTY_OPEN fd = getpt ()
@@ -56,13 +53,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
sigunblock (sigmask (SIGCHLD)); \
}
-#else /* not HAVE_GRANTPT */
-
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'p' means it is /dev/ptyp0 */
-#define FIRST_PTY_LETTER 'p'
-
-#endif /* not HAVE_GRANTPT */
+#endif /* HAVE_GRANTPT */
/* Here, on a separate page, add any special hacks needed
to make Emacs work on this system. For example,
diff --git a/src/s/hpux10-20.h b/src/s/hpux10-20.h
index 47908c9a4c..bb81eb800e 100644
--- a/src/s/hpux10-20.h
+++ b/src/s/hpux10-20.h
@@ -24,10 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define USG5
#define HPUX
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */
-#define FIRST_PTY_LETTER 'p'
-
/* Special hacks needed to make Emacs run on this system. */
/* This is how to get the device name of the tty end of a pty. */
diff --git a/src/s/irix6-5.h b/src/s/irix6-5.h
index dd7a00d0ba..cd7b290202 100644
--- a/src/s/irix6-5.h
+++ b/src/s/irix6-5.h
@@ -26,11 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#undef SETUP_SLAVE_PTY
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'a' means it is /dev/ptya0 */
-#undef FIRST_PTY_LETTER
-#define FIRST_PTY_LETTER 'q'
-
/* No need to use sprintf to get the tty name--we get that from _getpty. */
#define PTY_TTY_NAME_SPRINTF
/* No need to get the pty name at all. */
@@ -39,8 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef emacs
char *_getpty();
#endif
-/* We need only try once to open a pty. */
-#define PTY_ITERATION
/* Here is how to do it. */
#define PTY_OPEN \
{ \
diff --git a/src/s/template.h b/src/s/template.h
index a343a4b006..f14890bc29 100644
--- a/src/s/template.h
+++ b/src/s/template.h
@@ -29,10 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* #define BSD4_2 */
/* #define BSD_SYSTEM */
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'a' means it is /dev/ptya0. */
-#define FIRST_PTY_LETTER 'a'
-
/* subprocesses should be undefined if you do NOT want to
have code for asynchronous subprocesses
(as used in M-x compile and M-x shell).
diff --git a/src/s/usg5-4-common.h b/src/s/usg5-4-common.h
index 561b3ad38e..94d83dd81e 100644
--- a/src/s/usg5-4-common.h
+++ b/src/s/usg5-4-common.h
@@ -64,10 +64,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
this is all we need. */
#define TIOCSIGSEND TIOCSIGNAL
-/* This change means that we don't loop through allocate_pty too many
- times in the (rare) event of a failure. */
-#define FIRST_PTY_LETTER 'z'
-
/* This sets the name of the master side of the PTY. */
#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");