[comp.sys.sgi] getting GNU Make V3.54 running on Iris 4D

pwolfe@kailand.kai.com (Patrick Wolfe) (08/16/89)

Enclosed are the changes I made to get GNU Make V3.54 working on our SGI 4d
machines (running IRIX V3.1D).  Irix V3.2 has load averages, so some small
changes to the Makefile will needed (why GNUmake wants to know the load
averages, I don't know).

The changes are short and simple.  There are two files that need one line
patches, and a few changes to the Makefile.  Also included is the required
"alloca.c" file.

        Patrick Wolfe   (pat@kai.com, {uunet,uiucuxc,sgi}!kailand!pat)
        System Manager, Kuck & Associates, Inc.


=====  cut here  =====  cut here  =====  cut here  =====  cut here  =====
#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  SGI.Readme SGI.Diffs alloca.c
# Wrapped by pwolfe@kailand on Tue Aug 15 17:21:22 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'SGI.Readme' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'SGI.Readme'\"
else
echo shar: Extracting \"'SGI.Readme'\" \(618 characters\)
sed "s/^X//" >'SGI.Readme' <<'END_OF_FILE'
XEnclosed are the changes I made getting GNU Make V3.54 working on our SGI 4d
Xmachines (running IRIX V3.1D).
X
XThey are short and simple.  There are two files that need one line patches, and
Xa few changes to the Makefile.  Also included is the required "alloca.c" file.
X
X1. Unpack this shell archive.  It contains three files:
X	SGI.Readme	- this file
X	SGI.Diffs	- patches to "glob.c", "job.c", and "Makefile"
X	alloca.c	- additional source code file to be used
X2. Save copies of the three files to be patches; "Makefile", "glob.c", "job.c".
X3. Apply the patches in the file "SGI.Diffs"
X4. "make" the program
X
XGood Luck!
X
END_OF_FILE
if test 618 -ne `wc -c <'SGI.Readme'`; then
    echo shar: \"'SGI.Readme'\" unpacked with wrong size!
fi
# end of 'SGI.Readme'
fi
if test -f 'SGI.Diffs' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'SGI.Diffs'\"
else
echo shar: Extracting \"'SGI.Diffs'\" \(3638 characters\)
sed "s/^X//" >'SGI.Diffs' <<'END_OF_FILE'
X===================================================================
XRCS file: RCS/glob.c,v
Xretrieving revision 1.1
Xdiff -c -r1.1 glob.c
X*** /tmp/,RCSt1002636	Tue Aug 15 17:10:26 1989
X--- glob.c	Mon Aug  7 10:54:51 1989
X***************
X*** 387,393 ****
X    result[0] = NULL;
X  
X    /* Find the filename.  */
X!   filename = rindex (pathname, '/');
X    if (filename == 0)
X      {
X        filename = pathname;
X--- 387,393 ----
X    result[0] = NULL;
X  
X    /* Find the filename.  */
X!   filename = (char *) rindex (pathname, '/');
X    if (filename == 0)
X      {
X        filename = pathname;
X===================================================================
XRCS file: RCS/job.c,v
Xretrieving revision 1.1
Xdiff -c -r1.1 job.c
X*** /tmp/,RCSt1002653	Tue Aug 15 17:10:35 1989
X--- job.c	Mon Aug  7 10:45:29 1989
X***************
X*** 121,126 ****
X--- 121,127 ----
X  }
X  
X  /* Block the child termination signal.  */
X+ extern	int	child_handler();
X  
X  void
X  block_children ()
X===================================================================
XRCS file: RCS/Makefile,v
Xretrieving revision 1.1
Xdiff -c -r1.1 Makefile
X*** /tmp/,RCSt1002669	Tue Aug 15 17:10:42 1989
X--- Makefile	Mon Aug  7 11:10:36 1989
X***************
X*** 19,26 ****
X  #	Makefile for GNU Make
X  #
X  
X! CFLAGS = $(defines) -g
X! LDFLAGS = -g
X  
X  # Define nothing for BSD, USG for System V,
X  # and USGr3 (as well as USG) for SVR3.
X--- 19,26 ----
X  #	Makefile for GNU Make
X  #
X  
X! CFLAGS = $(defines) -O
X! LDFLAGS = -O
X  
X  # Define nothing for BSD, USG for System V,
X  # and USGr3 (as well as USG) for SVR3.
X***************
X*** 27,33 ****
X  # If you have a USG hybrid with <sys/wait.h> and wait3, define HAVE_SYS_WAIT.
X  # If your `cc' command doesn't grok -o options with -c (true for
X  # many 4.2 BSD derivatives), define MINUS_C_MINUS_O.
X! defines =
X  
X  # Define UMAX here to use Encore's inq_stats call.
X  # If the load average is in a symbol in /dev/kmem, define KERNEL_FILE if not
X--- 27,34 ----
X  # If you have a USG hybrid with <sys/wait.h> and wait3, define HAVE_SYS_WAIT.
X  # If your `cc' command doesn't grok -o options with -c (true for
X  # many 4.2 BSD derivatives), define MINUS_C_MINUS_O.
X! #defines = -DNO_MINUS_C_MINUS_O
X! defines = -DNO_MINUS_C_MINUS_O -DHAVE_SYS_WAIT -DUSG -DUSGr3
X  
X  # Define UMAX here to use Encore's inq_stats call.
X  # If the load average is in a symbol in /dev/kmem, define KERNEL_FILE if not
X***************
X*** 38,49 ****
X  # `struct nlist' is an array that must be copied into, define NLIST_NAME_ARRAY.
X  # Otherwise, define NO_LDAV.
X  
X! LOAD_AVG =
X  
X  # If your system doesn't have alloca, or the one provided is bad,
X  # get it from the Emacs distribution and define these.
X! #ALLOCA = alloca.o
X! #ALLOCASRC = alloca.c
X  
X  # If there are remote execution facilities defined,
X  # enable them with switches here (see remote-*.c).
X--- 39,55 ----
X  # `struct nlist' is an array that must be copied into, define NLIST_NAME_ARRAY.
X  # Otherwise, define NO_LDAV.
X  
X! #	Sequent
X! #LOAD_AVG = -DLDAV_TYPE=double -DKERNEL_FILE=\"/dynix\"
X! #	Alliant
X! #LOAD_AVG = -DLDAV_SYMBOL=\"Loadavg\"
X! #	SGI
X! LOAD_AVG = -DNO_LDAV
X  
X  # If your system doesn't have alloca, or the one provided is bad,
X  # get it from the Emacs distribution and define these.
X! ALLOCA = alloca.o
X! ALLOCASRC = alloca.c
X  
X  # If there are remote execution facilities defined,
X  # enable them with switches here (see remote-*.c).
X***************
X*** 94,99 ****
X--- 100,108 ----
X  remote.o: remote.c
X  	$(CC) $(CFLAGS) $(REMOTE) -c remote.c
X  
X+ function.o: function.c
X+ 	$(CC) $(CFLAGS) -Olimit 720 -c function.c
X+ 
X  TAGS: $(srcs)
X  	etags -tw $(srcs)
X  tags: $(srcs)
END_OF_FILE
if test 3638 -ne `wc -c <'SGI.Diffs'`; then
    echo shar: \"'SGI.Diffs'\" unpacked with wrong size!
fi
# end of 'SGI.Diffs'
fi
if test -f 'alloca.c' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'alloca.c'\"
else
echo shar: Extracting \"'alloca.c'\" \(4743 characters\)
sed "s/^X//" >'alloca.c' <<'END_OF_FILE'
X/*
X	alloca -- (mostly) portable public-domain implementation -- D A Gwyn
X
X	This implementation of the PWB library alloca() function,
X	which is used to allocate space off the run-time stack so
X	that it is automatically reclaimed upon procedure exit, 
X	was inspired by discussions with J. Q. Johnson of Cornell.
X
X	It should work under any C implementation that uses an
X	actual procedure stack (as opposed to a linked list of
X	frames).  There are some preprocessor constants that can
X	be defined when compiling for your specific system, for
X	improved efficiency; however, the defaults should be okay.
X
X	The general concept of this implementation is to keep
X	track of all alloca()-allocated blocks, and reclaim any
X	that are found to be deeper in the stack than the current
X	invocation.  This heuristic does not reclaim storage as
X	soon as it becomes invalid, but it will do so eventually.
X
X	As a special case, alloca(0) reclaims storage without
X	allocating any.  It is a good idea to use alloca(0) in
X	your main control loop, etc. to force garbage collection.
X*/
X#ifndef lint
Xstatic char	SCCSid[] = "@(#)alloca.c	1.1";	/* for the "what" utility */
X#endif
X
X#ifdef X3J11
Xtypedef void	*pointer;		/* generic pointer type */
X#else
Xtypedef char	*pointer;		/* generic pointer type */
X#endif
X
X#define	NULL	0			/* null pointer constant */
X
Xextern void	free();
Xextern pointer	malloc();
X
X/*
X	Define STACK_DIRECTION if you know the direction of stack
X	growth for your system; otherwise it will be automatically
X	deduced at run-time.
X
X	STACK_DIRECTION > 0 => grows toward higher addresses
X	STACK_DIRECTION < 0 => grows toward lower addresses
X	STACK_DIRECTION = 0 => direction of growth unknown
X*/
X
X#ifndef STACK_DIRECTION
X#define	STACK_DIRECTION	0		/* direction unknown */
X#endif
X
X#if STACK_DIRECTION != 0
X
X#define	STACK_DIR	STACK_DIRECTION	/* known at compile-time */
X
X#else	/* STACK_DIRECTION == 0; need run-time code */
X
Xstatic int	stack_dir;		/* 1 or -1 once known */
X#define	STACK_DIR	stack_dir
X
Xstatic void
Xfind_stack_direction (/* void */)
X{
X  static char	*addr = NULL;	/* address of first
X				   `dummy', once known */
X  auto char	dummy;		/* to get stack address */
X
X  if (addr == NULL)
X    {				/* initial entry */
X      addr = &dummy;
X
X      find_stack_direction ();	/* recurse once */
X    }
X  else				/* second entry */
X    if (&dummy > addr)
X      stack_dir = 1;		/* stack grew upward */
X    else
X      stack_dir = -1;		/* stack grew downward */
X}
X
X#endif	/* STACK_DIRECTION == 0 */
X
X/*
X	An "alloca header" is used to:
X	(a) chain together all alloca()ed blocks;
X	(b) keep track of stack depth.
X
X	It is very important that sizeof(header) agree with malloc()
X	alignment chunk size.  The following default should work okay.
X*/
X
X#ifndef	ALIGN_SIZE
X#define	ALIGN_SIZE	sizeof(double)
X#endif
X
Xtypedef union hdr
X{
X  char	align[ALIGN_SIZE];	/* to force sizeof(header) */
X  struct
X    {
X      union hdr *next;		/* for chaining headers */
X      char *deep;		/* for stack depth measure */
X    } h;
X} header;
X
X/*
X	alloca( size ) returns a pointer to at least `size' bytes of
X	storage which will be automatically reclaimed upon exit from
X	the procedure that called alloca().  Originally, this space
X	was supposed to be taken from the current stack frame of the
X	caller, but that method cannot be made to work for some
X	implementations of C, for example under Gould's UTX/32.
X*/
X
Xstatic header *last_alloca_header = NULL; /* -> last alloca header */
X
Xpointer
Xalloca (size)			/* returns pointer to storage */
X     unsigned	size;		/* # bytes to allocate */
X{
X  auto char	probe;		/* probes stack depth: */
X  register char	*depth = &probe;
X
X#if STACK_DIRECTION == 0
X  if (STACK_DIR == 0)		/* unknown growth direction */
X    find_stack_direction ();
X#endif
X
X				/* Reclaim garbage, defined as all alloca()ed storage that
X				   was allocated from deeper in the stack than currently. */
X
X  {
X    register header	*hp;	/* traverses linked list */
X
X    for (hp = last_alloca_header; hp != NULL;)
X      if (STACK_DIR > 0 && hp->h.deep > depth
X	  || STACK_DIR < 0 && hp->h.deep < depth)
X	{
X	  register header	*np = hp->h.next;
X
X	  free ((pointer) hp);	/* collect garbage */
X
X	  hp = np;		/* -> next header */
X	}
X      else
X	break;			/* rest are not deeper */
X
X    last_alloca_header = hp;	/* -> last valid storage */
X  }
X
X  if (size == 0)
X    return NULL;		/* no allocation required */
X
X  /* Allocate combined header + user data storage. */
X
X  {
X    register pointer	new = malloc (sizeof (header) + size);
X    /* address of header */
X
X    ((header *)new)->h.next = last_alloca_header;
X    ((header *)new)->h.deep = depth;
X
X    last_alloca_header = (header *)new;
X
X    /* User storage begins just after header. */
X
X    return (pointer)((char *)new + sizeof(header));
X  }
X}
X
END_OF_FILE
if test 4743 -ne `wc -c <'alloca.c'`; then
    echo shar: \"'alloca.c'\" unpacked with wrong size!
fi
# end of 'alloca.c'
fi
echo shar: End of shell archive.
exit 0


-- 

        Patrick Wolfe   (pat@kai.com, kailand!pat)
        System Manager, Kuck & Associates, Inc.