Date: Fri, 31 Jul 92 12:39:20 MDT
From: gritton@alaska.et.byu.edu (Jamie Gritton)
Organization: Brigham Young University, Provo UT USA
Newsgroups: comp.unix.aux,comp.emacs
Subject: Patch for GNU Emacs 18.58 on A/UX 3.0
Reply-To: gritton@byu.edu

   The following four files will enable GNU emacs 18.58 to run on a
Mac II under A/UX 3.0. I doubt they will work for earlier versions. I
created this patch based on a similar patch for Epoch 4.0.

   All you need to do is get the regular emacs distribution from
prep.ai.mit.edu or elsewhere, put the three header files in
/usr/local/emacs/src, and apply the patch file from the
/usr/local/emacs directory. Then a "make install" from that directory
should build your emacs with no trouble at all. Note you do *not* need
the GNU C compiler for this to work.

   The patch is also available on ftp.byu.edu as
/pub/emacs-18.58-aux3.0.tar.Z.

   If you agree with the FSF's boycott on Apple Computer, don't use
this patch. Otherwise, enjoy.
--
James Gritton - gritton@byu.edu - I disclaim

--- CUT HERE ---
#!/bin/sh
# This is a shell archive.  Remove anything before the above line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by Jamie Gritton <gritton@byu.edu> on Fri Jul 31 12:13:39 1992
#
# This archive contains:
#	emacs-18.58-aux3.0.diff	config.h		
#	m-mac2.h		s-aux-3.0.h		
#

PATH=/bin:/usr/bin:$PATH; export PATH

echo x - emacs-18.58-aux3.0.diff
cat >emacs-18.58-aux3.0.diff <<'@EOF'
*** ../emacs-18.58/Makefile	Thu Feb 13 12:52:35 1992
--- Makefile	Fri Jul 31 09:12:30 1992
***************
*** 25,31 ****
  
  # Command used for installation.
  # If `install' doesn't work on your system, try `./install.sh'.
! INSTALL=install
  
  # Subdirectories to make recursively.  `lisp' is not included
  # because the compiled lisp files are part of the distribution
--- 25,31 ----
  
  # Command used for installation.
  # If `install' doesn't work on your system, try `./install.sh'.
! INSTALL=./install.sh
  
  # Subdirectories to make recursively.  `lisp' is not included
  # because the compiled lisp files are part of the distribution
***************
*** 63,68 ****
--- 63,69 ----
  		done \
  	else true; \
  	fi
+ 	chmod +x install.sh
  	$(INSTALL) -c -s etc/emacsclient ${BINDIR}/emacsclient
  	$(INSTALL) -c -s etc/etags ${BINDIR}/etags
  	$(INSTALL) -c -s etc/ctags ${BINDIR}/ctags
*** ../emacs-18.58/etc/Makefile	Tue Jan 28 12:10:27 1992
--- etc/Makefile	Thu Jul 30 18:04:05 1992
***************
*** 45,50 ****
--- 45,52 ----
  #
  movemail: movemail.c ../src/config.h
  	$(CC) -o movemail ${CFLAGS} movemail.c $(LOADLIBES)
+ 	chgrp mail movemail
+ 	chmod 2755 movemail
  
  cvtmail: cvtmail.c
  	$(CC) -o cvtmail ${CFLAGS} cvtmail.c $(LOADLIBES)
*** ../emacs-18.58/lisp/paths.el	Sat Feb  8 20:34:43 1992
--- lisp/paths.el	Thu Jul 30 18:04:06 1992
***************
*** 52,58 ****
    "Name of user's primary mail file.")
  
  (defconst rmail-spool-directory
!   (if (memq system-type '(hpux usg-unix-v unisoft-unix rtu
  			       silicon-graphics-unix))
        "/usr/mail/"
      "/usr/spool/mail/")
--- 52,58 ----
    "Name of user's primary mail file.")
  
  (defconst rmail-spool-directory
!   (if (memq system-type '(hpux usg-unix-v unisoft-unix rtu apple-unix
  			       silicon-graphics-unix))
        "/usr/mail/"
      "/usr/spool/mail/")
***************
*** 106,116 ****
  	    "/usr/man/cat4" "/usr/man/cat5" "/usr/man/cat6"
  	    "/usr/man/cat7" "/usr/man/cat8" "/usr/man/catl" "/usr/man/catn"))
  	 (t
! 	   '("/usr/catman/u_man/man1" "/usr/catman/u_man/man6"
! 	     "/usr/catman/p_man/man2" "/usr/catman/p_man/man3"
! 	     "/usr/catman/p_man/man4" "/usr/catman/p_man/man5"
! 	     "/usr/catman/a_man/man1" "/usr/catman/a_man/man7"
! 	     "/usr/catman/a_man/man8" "/usr/catman/local")))
    "List of directories containing formatted manual pages.")
  
  (defconst abbrev-file-name 
--- 106,128 ----
  	    "/usr/man/cat4" "/usr/man/cat5" "/usr/man/cat6"
  	    "/usr/man/cat7" "/usr/man/cat8" "/usr/man/catl" "/usr/man/catn"))
  	 (t
! 	   '("/usr/catman/u_man/man1" "/usr/catman/u_man/man2"
! 	     "/usr/catman/u_man/man3" "/usr/catman/u_man/man4"
! 	     "/usr/catman/u_man/man5" "/usr/catman/u_man/man6"
! 	     "/usr/catman/u_man/man7" "/usr/catman/u_man/man8"
! 	     "/usr/catman/a_man/man1" "/usr/catman/a_man/man2"
! 	     "/usr/catman/a_man/man3" "/usr/catman/a_man/man4"
! 	     "/usr/catman/a_man/man5" "/usr/catman/a_man/man6"
! 	     "/usr/catman/a_man/man7" "/usr/catman/a_man/man8"
! 	     "/usr/catman/l_man/man1" "/usr/catman/l_man/man2"
! 	     "/usr/catman/l_man/man3" "/usr/catman/l_man/man4"
! 	     "/usr/catman/l_man/man5" "/usr/catman/l_man/man6"
! 	     "/usr/catman/l_man/man7" "/usr/catman/l_man/man8"
! 	     "/usr/catman/x_man/man1" "/usr/catman/x_man/man2"
! 	     "/usr/catman/x_man/man3" "/usr/catman/x_man/man4"
! 	     "/usr/catman/x_man/man5" "/usr/catman/x_man/man6"
! 	     "/usr/catman/x_man/man7" "/usr/catman/x_man/man8"
! 	     "/usr/catman/local")))
    "List of directories containing formatted manual pages.")
  
  (defconst abbrev-file-name 
*** ../emacs-18.58/src/emacs.c	Mon Dec  9 18:50:32 1991
--- src/emacs.c	Thu Jul 30 18:04:05 1992
***************
*** 259,264 ****
--- 259,268 ----
  #endif /* LINK_CRTL_SHARE */
  #endif /* VMS */
  
+ #ifdef AUX
+   set42sig();
+ #endif
+ 
  #ifdef USG_SHARED_LIBRARIES
    if (bss_end)
      brk (bss_end);
*** ../emacs-18.58/src/malloc.c	Thu Jan 30 21:19:47 1992
--- src/malloc.c	Fri Jul 31 10:22:27 1992
***************
*** 96,101 ****
--- 96,105 ----
  #include "vlimit.h"
  #endif
  
+ #ifdef AUX
+ #include <errno.h>
+ #endif
+ 
  extern char *start_of_data ();
  
  #ifdef BSD
***************
*** 287,292 ****
--- 291,300 ----
     * out for VMS systems.
     */
    cp = sbrk (0);
+ #ifdef AUX
+   if( ((int)cp == -1) && (errno = EINVAL) )
+     cp = data_space_start;
+ #endif
    siz = cp - data_space_start;
  
    if (warnfunction)
*** ../emacs-18.58/src/process.c	Tue Feb 18 12:00:53 1992
--- src/process.c	Thu Jul 30 18:04:07 1992
***************
*** 1071,1077 ****
  
    if (inchannel >= 0)
      {
! #ifndef USG
        /* On USG systems it does not work to open
  	 the pty's tty here and then close and reopen it in the child.  */
  #ifdef O_NOCTTY
--- 1071,1077 ----
  
    if (inchannel >= 0)
      {
! #if !defined(USG) || defined(AUX)
        /* On USG systems it does not work to open
  	 the pty's tty here and then close and reopen it in the child.  */
  #ifdef O_NOCTTY
*** ../emacs-18.58/src/sysdep.c	Thu Feb 13 16:03:12 1992
--- src/sysdep.c	Thu Jul 30 18:04:09 1992
***************
*** 55,60 ****
--- 55,63 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <errno.h>
+ #ifdef AUX
+ #include <sys/file.h>
+ #endif
  
  extern int errno;
  #ifndef VMS
***************
*** 213,219 ****
  #ifndef MEMORY_IN_STRING_H
  #include <memory.h>
  #endif
! #ifdef TIOCGWINSZ
  #ifndef IRIS_4D
  #ifndef mips
  #ifndef aix386
--- 216,222 ----
  #ifndef MEMORY_IN_STRING_H
  #include <memory.h>
  #endif
! #if defined (TIOCGWINSZ) && !defined (AUX)
  #ifndef IRIS_4D
  #ifndef mips
  #ifndef aix386
***************
*** 453,459 ****
    while (1)
      {
  #ifdef subprocesses
! #if defined (BSD) || (defined (HPUX) && !defined (HPUX_5))
        /* Note that kill returns -1 even if the process is just a zombie now.
  	 But inevitably a SIGCHLD interrupt should be generated
  	 and child_sig will do wait3 and make the process go away. */
--- 456,462 ----
    while (1)
      {
  #ifdef subprocesses
! #if defined (BSD) || defined (AUX) || (defined (HPUX) && !defined (HPUX_5))
        /* Note that kill returns -1 even if the process is just a zombie now.
  	 But inevitably a SIGCHLD interrupt should be generated
  	 and child_sig will do wait3 and make the process go away. */
***************
*** 2419,2424 ****
--- 2422,2441 ----
    "user defined signal 2",		/* 17 SIGUSR2 */
    "death of a child",			/* 18 SIGCLD */
    "power-fail restart",			/* 19 SIGPWR */
+ #ifdef AUX
+   "stop signal from tty",		/* 20 SIGTSTP */
+   "input necessary",			/* 21 SIGTTIN */
+   "output necessary",			/* 22 SIGTTOU */
+   "i/o possible",			/* 23 SIGIO */
+   "exceeded CPU time limit",		/* 24 SIGXCPU */
+   "exceeded file size limit",		/* 25 SIGXFSZ */
+   "virtual time alarm",			/* 26 SIGVTALRM */
+   "profiling time alarm",		/* 27 SIGPROF */
+   "window size changes",		/* 28 SIGWINCH */
+   "continue a stopped process",		/* 29 SIGCONT */
+   "urgent condition on IO channel",	/* 30 SIGURG */
+   "input/output possible signal",	/* 31 SIGIO */
+ #endif /* AUX */
  #endif /* not AIX */
    0
    };
***************
*** 2505,2511 ****
  }
  #endif
  
! #ifdef IRIS_UTIME
  
  /* The IRIS (3.5) has timevals, but uses sys V utime, and doesn't have the
     utimbuf structure defined anywhere but in the man page. */
--- 2522,2528 ----
  }
  #endif
  
! #if defined (IRIS_UTIME) || defined (AUX)
  
  /* The IRIS (3.5) has timevals, but uses sys V utime, and doesn't have the
     utimbuf structure defined anywhere but in the man page. */
*** ../emacs-18.58/src/unexec.c	Sun Mar 31 13:44:53 1991
--- src/unexec.c	Thu Jul 30 18:04:10 1992
***************
*** 933,939 ****
  {
    register int nsyms;
    register int new;
! #ifdef amdahl_uts
    SYMENT symentry;
    AUXENT auxentry;
  #else
--- 933,939 ----
  {
    register int nsyms;
    register int new;
! #if defined (amdahl_uts) || defined (AUX)
    SYMENT symentry;
    AUXENT auxentry;
  #else
@EOF

chmod 644 emacs-18.58-aux3.0.diff

echo x - config.h
cat >config.h <<'@EOF'
/* GNU Emacs site configuration template file for Mac II running A/UX 3.0
   Copyright (C) 1988 Free Software Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */



/* Include here a s- file that describes the system type you are using.
   See the file ../etc/MACHINES for a list of systems and
   the names of the s- files to use for them.
   See s-template.h for documentation on writing s- files.  */
#include "s-aux-3.0.h"

/* Include here a m- file that describes the machine and system you use.
   See the file ../etc/MACHINES for a list of machines and
   the names of the m- files to use for them.
   See m-template.h for info on what m- files should define.
   */
#include "m-mac2.h"

/* Load in the conversion definitions if this system
   needs them and the source file being compiled has not
   said to inhibit this.  There should be no need for you
   to alter these lines.  */

#ifdef SHORTNAMES
#ifndef NO_SHORTNAMES
#include "../shortnames/remap.h"
#endif /* not NO_SHORTNAMES */
#endif /* SHORTNAMES */

/* Define HAVE_X_WINDOWS if you want to use the X window system.  */

#define HAVE_X_WINDOWS

/* Define X11 if you want to use version 11 of X windows.
   Otherwise, Emacs expects to use version 10.  */

#ifdef HAVE_X_WINDOWS
#define X11
#endif

/* Define HAVE_X_MENU if you want to use the X window menu system.
   This appears to work on some machines that support X
   and not on others.  */

#define HAVE_X_MENU

/* Define `subprocesses' should be defined if you want to
   have code for asynchronous subprocesses
   (as used in M-x compile and M-x shell).
   These do not work for some USG systems yet;
   for the ones where they work, the s-*.h file defines this flag.  */

#ifndef VMS
#ifndef USG
#define subprocesses
#endif
#endif

/* Define USER_FULL_NAME to return a string
   that is the user's full name.
   It can assume that the variable `pw'
   points to the password file entry for this user.

   At some sites, the pw_gecos field contains
   the user's full name.  If neither this nor any other
   field contains the right thing, use pw_name,
   giving the user's login name, since that is better than nothing.  */

#define USER_FULL_NAME pw->pw_gecos

/* Define AMPERSAND_FULL_NAME if you use the convention
   that & in the full name stands for the login id.  */

/* #define AMPERSAND_FULL_NAME */

/* # bytes of pure Lisp code to leave space for.
   Note that s-vms.h and m-sun2.h may override this default.  */

#ifndef PURESIZE
#ifdef HAVE_X_WINDOWS
#define PURESIZE 122000
#else
#define PURESIZE 120000
#endif
#endif

/* Define HIGHPRI as a negative number
   if you want Emacs to run at a higher than normal priority.
   For this to take effect, you must install Emacs with setuid root.
   Emacs will change back to the users's own uid after setting
   its priority.  */

/* #define HIGHPRI */

@EOF

chmod 644 config.h

echo x - m-mac2.h
cat >m-mac2.h <<'@EOF'
/* m- file for Mac II running A/UX

This file is part of GNU Emacs.

GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */


/* The following three symbols give information on
 the size of various data types.  */

#define SHORTBITS 16		/* Number of bits in a short */

#define INTBITS 32		/* Number of bits in an int */

#define LONGBITS 32		/* Number of bits in a long */

/* Define BIG_ENDIAN iff lowest-numbered byte in a word
   is the most significant byte.  */

#define BIG_ENDIAN

/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
 * group of arguments and treat it as an array of the arguments.  */

/* #define NO_ARG_ARRAY */

/* Define WORD_MACHINE if addresses and such have
 * to be corrected before they can be used as byte counts.  */

/* #define WORD_MACHINE */

/* Define how to take a char and sign-extend into an int.
   On machines where char is signed, this is a no-op.  */

#define SIGN_EXTEND_CHAR(c) (c)

/* Now define a symbol for the cpu type, if your compiler
   does not define it automatically:
   Ones defined so far include vax, m68000, ns16000, pyramid,
   orion, tahoe, APOLLO and many others */

#ifndef m68k
#define m68k 1
#endif

/* Use type int rather than a union, to represent Lisp_Object */
/* This is desirable for most machines.  */

#define NO_UNION_TYPE

/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
   the 24-bit bit field into an int.  In other words, if bit fields
   are always unsigned.

   If you use NO_UNION_TYPE, this flag does not matter.  */

#define EXPLICIT_SIGN_EXTEND

/* Data type of load average, as read out of kmem.  */

#define LOAD_AVE_TYPE long

/* Convert that into an integer that is 100 for a load average of 1.0  */

#define FSCALE 65536.0
#define LDAV_SYMBOL "avenrun"
#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
#define KERNEL_FILE "/unix"

/* Define CANNOT_DUMP on machines where unexec does not work.
   Then the function dump-emacs will not be defined
   and temacs will do (load "loadup") automatically unless told otherwise.  */

/* #define CANNOT_DUMP */

/* Define VIRT_ADDR_VARIES if the virtual addresses of
   pure and impure space as loaded can vary, and even their
   relative order cannot be relied on.

   Otherwise Emacs assumes that text space precedes data space,
   numerically.  */

/* #define VIRT_ADDR_VARIES */

/* Define C_ALLOCA if this machine does not support a true alloca
   and the one written in C should be used instead.
   Define HAVE_ALLOCA to say that the system provides a properly
   working alloca function and it should be used.
   Define neither one if an assembler-language alloca
   in the file alloca.s should be used.  */

#define C_ALLOCA
/* #define HAVE_ALLOCA */

/* Define NO_REMAP if memory segmentation makes it not work well
   to change the boundary between the text section and data section
   when Emacs is dumped.  If you define this, the preloaded Lisp
   code will not be sharable; but that's better than failing completely.  */

#define NO_REMAP
@EOF

chmod 644 m-mac2.h

echo x - s-aux-3.0.h
cat >s-aux-3.0.h <<'@EOF'
/* Definitions file for GNU Emacs running on A/UX 3.0

This file is part of GNU Emacs.

GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING.  If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */


/*
 *	Define symbols to identify the version of Unix this is.
 *	Define all the symbols that apply correctly.
 */

#define UNIPLUS
#define USG5
#define USG
/* #define HPUX */
/* #define UMAX */
/* #define BSD4_1 */
/* #define BSD4_2 */
/* #define BSD4_3 */
/* #define BSD */
/* #define VMS */
#define AUX

/* SYSTEM_TYPE should indicate the kind of system you are using.
 It sets the Lisp variable system-type.  */

#define SYSTEM_TYPE "apple-unix"

/* NOMULTIPLEJOBS should be defined if your system's shell
 does not have "job control" (the ability to stop a program,
 run some other program, then continue the first one).  */

/* #define NOMULTIPLEJOBS */

/* Emacs can read input using SIGIO and buffering characters itself,
   or using CBREAK mode and making C-g cause SIGINT.
   The choice is controlled by the variable interrupt_input.
   Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)

   SIGIO can be used only on systems that implement it (4.2 and 4.3).
   CBREAK mode has two disadvatages
     1) At least in 4.2, it is impossible to handle the Meta key properly.
        I hear that in system V this problem does not exist.
     2) Control-G causes output to be discarded.
        I do not know whether this can be fixed in system V.

   Another method of doing input is planned but not implemented.
   It would have Emacs fork off a separate process
   to read the input and send it to the true Emacs process
   through a pipe.
*/

#define INTERRUPT_INPUT

/* 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'

/*
 *	Define HAVE_TERMIO if the system provides sysV-style ioctls
 *	for terminal control.
 */

#define HAVE_TERMIO

/*
 *	Define HAVE_TIMEVAL if the system supports the BSD style clock values.
 *	Look in <sys/time.h> for a timeval structure.
 */

#define HAVE_TIMEVAL

/*
 *	Define HAVE_SELECT if the system supports the `select' system call.
 */

#define HAVE_SELECT

/*
 *	Define HAVE_PTYS if the system supports pty devices.
 */

#define HAVE_PTYS

/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */

#define HAVE_SOCKETS

/*
 *	Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
 *      The 4.2 opendir, etc., library functions.
 */

/* #define NONSYSTEM_DIR_LIBRARY */

/* Define this symbol if your system has the functions bcopy, etc. */

#define BSTRING

/* subprocesses should be defined if you want to
   have code for asynchronous subprocesses
   (as used in M-x compile and M-x shell).
   This is generally OS dependent, and not supported
   under most USG systems. */

#define subprocesses

/* If your system uses COFF (Common Object File Format) then define the
   preprocessor symbol "COFF". */

#define ADDR_CORRECT(x) (x)
#define COFF
#define NO_REMAP

/* define MAIL_USE_FLOCK if the mailer uses flock
   to interlock access to /usr/spool/mail/$USER.
   The alternative is that a lock file named
   /usr/spool/mail/$USER.lock.  */

#define MAIL_USE_FLOCK

/* Define CLASH_DETECTION if you want lock files to be written
   so that Emacs can tell instantly when you try to modify
   a file that someone else has modified in his Emacs.  */

#define CLASH_DETECTION

/* Here, on a separate page, add any special hacks needed
   to make Emacs work on this system.  For example,
   you might define certain system call names that don't
   exist on your system, or that do different things on
   your system and must be used only through an encapsulation
   (Which you should place, by convention, in sysdep.c).  */

#define _setjmp setjmp
#define _longjmp longjmp
#define NBPC 4096
#define NO_SIOCTL_H
#define SWITCH_ENUM_BUG

/* Some compilers tend to put everything declared static
   into the initialized data area, which becomes pure after dumping Emacs.
   On these systems, you must #define static as nothing to foil this.
   Note that emacs carefully avoids static vars inside functions.  */

/* #define static */

/* Some more system calls supported */

#define HAVE_DUP2
#define HAVE_GETWD
#define HAVE_RANDOM
#define HAVE_RENAME

/* Info for AUX 3.0's native C compiler */

#define C_DEBUG_SWITCH C_OPTIMIZE_SWITCH
#define C_OPTIMIZE_SWITCH -O2
#define LIBS_DEBUG
#define LIB_STANDARD /lib/crtn.o /usr/lib/shlib.ld /lib/libc.a
#define START_FILES pre-crt0.o /lib/crt1.o /lib/crt2.o
@EOF

chmod 644 s-aux-3.0.h

exit 0