]> git.eshelyaron.com Git - emacs.git/commitdiff
Move FIRST_PTY_LETTER, PTY_ITERATION from src/s to configure
authorGlenn Morris <rgm@gnu.org>
Thu, 12 Jul 2012 06:34:40 +0000 (23:34 -0700)
committerGlenn Morris <rgm@gnu.org>
Thu, 12 Jul 2012 06:34:40 +0000 (23:34 -0700)
* configure.ac (FIRST_PTY_LETTER PTY_ITERATION): Move here from src/s.

* src/s/aix4-2.h, src/s/bsd-common.h, src/s/cygwin.h, src/s/darwin.h:
* src/s/gnu-linux.h, src/s/hpux10-20.h, src/s/irix6-5.h, src/s/template.h:
* src/s/usg5-4-common.h: Move FIRST_PTY_LETTER, PTY_ITERATION to configure.

12 files changed:
ChangeLog
configure.ac
src/ChangeLog
src/s/aix4-2.h
src/s/bsd-common.h
src/s/cygwin.h
src/s/darwin.h
src/s/gnu-linux.h
src/s/hpux10-20.h
src/s/irix6-5.h
src/s/template.h
src/s/usg5-4-common.h

index 8bab598fac52727d46007a7b09b94deb26c44872..cd5300ff23503bdb75868a05cb83869d0074f02a 100644 (file)
--- 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.
 
index 60d17e9bddfc9d8df15590123088ecf9f9d1cc97..77fe10c0e54741b621fb6cc5a1742e5f0df76395 100644 (file)
@@ -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.])
 
index 7b6eaa3820ae6d30f4b292f3140c6fe8efcf7a21..19b892590679667d445fb30041c2b9ab718edfe0 100644 (file)
@@ -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.
index 4287eea9dcc5d013f75d08e9db2b88ef87503cfb..326d7217acbe62369cb11aa80619a947a51ea157 100644 (file)
@@ -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));
 
index 901ed0c490e239e2edc9d3668e5508de5b6ea1d4..681f659901041c62d3a43d3074d28d0f0deb8329 100644 (file)
@@ -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'
index fb5d3b08f4ef5e65993fe2d8a942d7f9be569a91..89db0a047bc06805e6658c80fee6b61bd5822839 100644 (file)
@@ -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                                       \
index 7b4b5e196e303ca8744986d6042965df43f370d5..68667ed7c90fca84da8e24a66e32dcc11f1ce6e3 100644 (file)
@@ -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.
index 5e8691b55ce358c5892613bf6336d81234a55a2a..dd4de41f84bbf76a50232b6b3c7354bb41778369 100644 (file)
@@ -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,
index 47908c9a4c0df71e49d77d12a6eddf902409a742..bb81eb800e4eadd59f0253a21ad36da4e996cbaa 100644 (file)
@@ -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.  */
index dd7a00d0ba77478617306cf32eaa2407484a5606..cd7b2902026108d9937b9774abe840552871fc9d 100644 (file)
@@ -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                                           \
 {                                                          \
index a343a4b006e8b2c30f3d7b5d403040a968241541..f14890bc2921c62be8cf64aaa6b958d89c0c5a5e 100644 (file)
@@ -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).
index 561b3ad38ececf7fd7f9d17d2dd329719f10b439..94d83dd81efc2ad32cdc4b680fefe50fe4f3261e 100644 (file)
@@ -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");