Subject: postgres 4.2 on solaris 2.3 sparc

From: [email-masked] (Frank Delahoyde)
Date: Fri, 8 Apr 1994 19:00:10 +0800

Paul,

Here it is. 

frank

diff -r -P -c dst2/README.solaris dst/README.solaris
*** README.solaris	Wed Dec 31 16:00:00 1969
--- README.solaris	Fri Apr  8 18:56:07 1994
***************
*** 0 ****
--- 1,19 ----
+ Please read the installation and release notes in doc first.
+ 
+ Postgres 4.2 must be compiled with gcc 1.5.8 to run under Solaris 2.3.
+ Gcc can be obtained from (west coast): gatekeeper.dec.com, (east coast):
+ prep.ai.mit.edu. To successfully compile postgres, gcc must be patched
+ with the supplied patch and re-built.
+ 
+ 	1). obtain and load gcc 1.5.8. cd to the gcc source directory, and
+ 	    patch -po <gcc.sol.patch
+ 	2). configure, build and install gcc.
+ 	3). The make for postgres uses a shell script named cc to invoke
+ 	    gcc. This script gets installed in ${TOOLSBINDIR} when you
+ 	    ./Bootstrap sparc_solaris. Make sure you set your PATH so
+ 	    that this script is found before any other cc.
+ 	4). Make sure you have looked at (and maybe changed)
+ 	    src/Makefile.global. Be sure to set GCCBINDIR to the gcc bin
+ 	    directory.
+ 	5). ./Bootstrap sparc_solaris (from src/tools/bmake)
+ 	6). bmake all install
diff -r -P -c dst2/gcc.sol.patch dst/gcc.sol.patch
*** gcc.sol.patch	Wed Dec 31 16:00:00 1969
--- gcc.sol.patch	Fri Apr  8 18:56:08 1994
***************
*** 0 ****
--- 1,19 ----
+ *** config/sparc/sparc.c	Thu Apr  7 09:30:30 1994
+ --- config/sparc/sparc.c.orig	Thu Apr  7 09:31:35 1994
+ ***************
+ *** 1067,1073 ****
+        is true, in which case we can only assume that an access is aligned if
+        it is to an aggregate, it is to a constant address, or the address
+        involves a LO_SUM.  */
+ !   else if (! TARGET_UNALIGNED_DOUBLES /* || MEM_IN_STRUCT_P (mem) */
+   	   || CONSTANT_P (addr) || GET_CODE (addr) == LO_SUM)
+       return 1;
+   
+ --- 1067,1073 ----
+        is true, in which case we can only assume that an access is aligned if
+        it is to an aggregate, it is to a constant address, or the address
+        involves a LO_SUM.  */
+ !   else if (! TARGET_UNALIGNED_DOUBLES || MEM_IN_STRUCT_P (mem)
+   	   || CONSTANT_P (addr) || GET_CODE (addr) == LO_SUM)
+       return 1;
+   
diff -r -P -c src.orig/Makefile.global src/Makefile.global
*** src.orig/Makefile.global	Fri Apr  1 14:56:13 1994
--- src/Makefile.global	Fri Apr  8 18:48:30 1994
***************
*** 44,51 ****
  # directory and run "bmake".  You must put the TOOLSBINDIR, whatever 
  # that may be, in your PATH before attempting to build postgres.
  #
! TOOLSBINDIR= /usr/local/bin
! TOOLSLIBDIR= /usr/local/lib
  
  #
  # Following are settings pertaining to the postgres build and 
--- 44,55 ----
  # directory and run "bmake".  You must put the TOOLSBINDIR, whatever 
  # that may be, in your PATH before attempting to build postgres.
  #
! TOOLSBINDIR= /opt/postgres/tools/bin
! TOOLSLIBDIR= /opt/postgres/tools/lib
! #
! # If you're compiling with gcc under solaris 2.3 (sparc), we
! # need to know the gcc bin directory.
! GCCBINDIR=/opt/gnu/bin
  
  #
  # Following are settings pertaining to the postgres build and 
***************
*** 57,62 ****
--- 61,67 ----
  #  The name of the port.  Valid choices are:
  #	ultrix4	-	DEC MIPS on Ultrix 4.2, 4.2A or 4.3A
  #	sparc	-	SUN SPARC on SunOS 4.1.2 or 4.1.3
+ #	sparc_solaris	SUN SPARC on Solaris 2.x
  #	hpux	-	HP PA-RISC on HP-UX 9.00 or 9.01
  #	alpha	-	DEC Alpha AXP on OSF/1 1.3
  #	aix	-	IBM POWER on AIX 3.2.5
***************
*** 71,77 ****
  #	./obj/Makefile.global does not take effect (for .if purposes) 
  #	until after this file is processed!
  #
! PORTNAME?=	ultrix4
  
  #
  # POSTGRESLOGIN is the login name of the user who gets special
--- 76,82 ----
  #	./obj/Makefile.global does not take effect (for .if purposes) 
  #	until after this file is processed!
  #
! PORTNAME?=	sparc_solaris
  
  #
  # POSTGRESLOGIN is the login name of the user who gets special
***************
*** 88,94 ****
  # changable separately.  This is usually "/usr/local/postgres" but may be 
  # different for the postgres development team and sequoia users.
  #
! POSTGRESDIR?=	/usr/local/postgres
  
  #
  # DATADIR specifies where the postmaster expects to find its database.
--- 93,99 ----
  # changable separately.  This is usually "/usr/local/postgres" but may be 
  # different for the postgres development team and sequoia users.
  #
! POSTGRESDIR?=	/opt/postgres
  
  #
  # DATADIR specifies where the postmaster expects to find its database.
***************
*** 136,142 ****
  #
  .if (${PORTNAME} == "alpha" || ${PORTNAME} == "ultrix4")
  MACHINE!=machine
! .elif (${PORTNAME} == "sparc")
  MACHINE=sparc
  .elif (${PORTNAME} == "hpux")
  MACHINE=hppa
--- 141,147 ----
  #
  .if (${PORTNAME} == "alpha" || ${PORTNAME} == "ultrix4")
  MACHINE!=machine
! .elif (${PORTNAME} == "sparc" || ${PORTNAME} == "sparc_solaris")
  MACHINE=sparc
  .elif (${PORTNAME} == "hpux")
  MACHINE=hppa
***************
*** 167,173 ****
  #
  # This should probably be in the sys.mk file.
  #
! .if (${PORTNAME} == "aix")
  INSTALL=/usr/ucb/install
  .endif
  .if (${PORTNAME} == "alpha")
--- 172,178 ----
  #
  # This should probably be in the sys.mk file.
  #
! .if (${PORTNAME} == "aix" || ${PORTNAME} == "sparc_solaris")
  INSTALL=/usr/ucb/install
  .endif
  .if (${PORTNAME} == "alpha")
***************
*** 207,213 ****
  #
  #	XXX on MIPS, use -g3 if you want to compile with -O
  #
! #CDEBUG= -g
  
  #
  # Comment out PROFILE to disable profiling.
--- 212,218 ----
  #
  #	XXX on MIPS, use -g3 if you want to compile with -O
  #
! CDEBUG= -g
  
  #
  # Comment out PROFILE to disable profiling.
***************
*** 304,310 ****
  # Jaquith and external large objects.  None of these options
  # are supported outside of UC Berkeley.
  #
! #CFLAGS+= -DSEQUOIA

  #
--- 309,315 ----
  # Jaquith and external large objects.  None of these options
  # are supported outside of UC Berkeley.
  #
! CFLAGS+= -DSEQUOIA

  #
***************
*** 328,334 ****
  # semantics.  We can use the POSIX sigaction(2) on systems that
  # allow us to request restartable signals (SA_RESTART).
  #
! .if (${PORTNAME} == "alpha" || ${PORTNAME} == "svr4")
  CFLAGS+= -DUSE_POSIX_SIGNALS
  .endif
  #
--- 333,341 ----
  # semantics.  We can use the POSIX sigaction(2) on systems that
  # allow us to request restartable signals (SA_RESTART).
  #
! .if (${PORTNAME} == "alpha" || \
!      ${PORTNAME} == "svr4" || \
!      ${PORTNAME} == "sparc_solaris")
  CFLAGS+= -DUSE_POSIX_SIGNALS
  .endif
  #
***************
*** 338,343 ****
--- 345,353 ----
  .if (${PORTNAME} == "aix")
  # the -lm is because "pow" is defined in libbsd.a and we want pow(3m)
  LDADD+= -lm -lbsd
+ .endif
+ .if (${PORTNAME} == "sparc_solaris")
+ CFLAGS+= -munaligned-doubles -DSVR4 -I$(POSTGRESDIR)/src/backend/port/sparc_solaris
  .endif
  .if (${PORTNAME} == "hpux")
  LDADD+= -lBSD
diff -r -P -c src.orig/backend/access/heap/hrnd.c src/backend/access/heap/hrnd.c
*** src.orig/backend/access/heap/hrnd.c	Fri Apr  1 14:42:22 1994
--- src/backend/access/heap/hrnd.c	Fri Apr  8 13:56:07 1994
***************
*** 24,29 ****
--- 24,34 ----
  #include "utils/memutils.h"
  #include "utils/rel.h"
  
+ #ifdef SVR4
+ #define srandom	srand48
+ #define random	lrand48
+ #endif
+ 
  #ifdef	RANDOMDEBUG
  #include "utils/log.h"
  #endif	/* defined(RANDOMDEBUG) */
diff -r -P -c src.orig/backend/catalog/genbki.sh src/backend/catalog/genbki.sh
*** src.orig/backend/catalog/genbki.sh	Fri Apr  1 14:44:51 1994
--- src/backend/catalog/genbki.sh	Fri Apr  8 13:56:07 1994
***************
*** 16,22 ****
  #   IDENTIFICATION
  # 	/usr/local/devel/postgres-v4r2/src/backend/catalog/RCS/genbki.sh,v 1.8 1993/08/14 04:43:19 aoki Exp
  # ----------------------------------------------------------------
! PATH=$PATH:/lib		# to find cpp
  BKIOPTS=''
  if [ $? != 0 ]
  then
--- 16,22 ----
  #   IDENTIFICATION
  # 	/usr/local/devel/postgres-v4r2/src/backend/catalog/RCS/genbki.sh,v 1.8 1993/08/14 04:43:19 aoki Exp
  # ----------------------------------------------------------------
! PATH=$PATH:/lib:/usr/ccs/lib		# to find cpp
  BKIOPTS=''
  if [ $? != 0 ]
  then
diff -r -P -c src.orig/backend/commands/vacuum.c src/backend/commands/vacuum.c
*** src.orig/backend/commands/vacuum.c	Fri Apr  1 14:44:44 1994
--- src/backend/commands/vacuum.c	Fri Apr  8 13:56:07 1994
***************
*** 3,8 ****
--- 3,11 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  
  #include "tmp/postgres.h"
  #include "tmp/c.h"
diff -r -P -c src.orig/backend/executor/ex_flatten.c src/backend/executor/ex_flatten.c
*** src.orig/backend/executor/ex_flatten.c	Fri Apr  1 14:42:41 1994
--- src/backend/executor/ex_flatten.c	Fri Apr  8 13:56:07 1994
***************
*** 87,93 ****
  	/*
  	 * Initialize the inner node
  	 */
! 	resVect[0] = ExecEvalIter((Iter)tl_expr(get_fj_innerNode(fjNode)),
  				  econtext,
  				  &isNullVect[0],
  				  &isDone);
--- 87,94 ----
  	/*
  	 * Initialize the inner node
  	 */
! 	resVect[0] = ExecEvalIter((Iter)
! 				  tl_expr((List)get_fj_innerNode(fjNode)),
  				  econtext,
  				  &isNullVect[0],
  				  &isDone);
***************
*** 131,137 ****
  	    return;
  	}
  	else
! 	    resVect[0] = ExecEvalIter((Iter)tl_expr(get_fj_innerNode(fjNode)),
  				      econtext,
  				      &isNullVect[0],
  				      &isDone);
--- 132,139 ----
  	    return;
  	}
  	else
! 	    resVect[0] = ExecEvalIter((Iter)
! 				      tl_expr((List)get_fj_innerNode(fjNode)),
  				      econtext,
  				      &isNullVect[0],
  				      &isDone);
***************
*** 149,155 ****
  	if (*fj_isDone)
  	    return;
  
! 	resVect[0] = ExecEvalIter((Iter)tl_expr(get_fj_innerNode(fjNode)),
  				  econtext,
  				  &isNullVect[0],
  				  &isDone);
--- 151,158 ----
  	if (*fj_isDone)
  	    return;
  
! 	resVect[0] = ExecEvalIter((Iter)
! 				  tl_expr((List)get_fj_innerNode(fjNode)),
  				  econtext,
  				  &isNullVect[0],
  				  &isDone);
diff -r -P -c src.orig/backend/executor/ex_junk.c src/backend/executor/ex_junk.c
*** src.orig/backend/executor/ex_junk.c	Fri Apr  1 14:42:41 1994
--- src/backend/executor/ex_junk.c	Fri Apr  8 13:56:07 1994
***************
*** 110,117 ****
  	    cleanFjoin = (Fjoin)CopyObject((Node) fjNode);
  	    cleanFjList = lispCons((LispValue) cleanFjoin, LispNil);
  
! 	    resdom = (Resdom) CAR(get_fj_innerNode(fjNode));
! 	    expr =   CADR(get_fj_innerNode(fjNode));
  	    cleanResdom = (Resdom) CopyObject((Node) resdom);
  	    set_resno(cleanResdom, cleanResno);
  	    cleanResno++;
--- 110,117 ----
  	    cleanFjoin = (Fjoin)CopyObject((Node) fjNode);
  	    cleanFjList = lispCons((LispValue) cleanFjoin, LispNil);
  
! 	    resdom = (Resdom) CAR((List)get_fj_innerNode(fjNode));
! 	    expr =   CADR((List)get_fj_innerNode(fjNode));
  	    cleanResdom = (Resdom) CopyObject((Node) resdom);
  	    set_resno(cleanResdom, cleanResno);
  	    cleanResno++;
***************
*** 178,184 ****
  		List fjList = CAR(t);
  		Fjoin fjNode = (Fjoin)CAR(fjList);
  
! 		resdom = (Resdom) CAR(get_fj_innerNode(fjNode));
  		cleanMap[cleanResno-1] = get_resno(resdom);
  		cleanResno++;
  
--- 178,184 ----
  		List fjList = CAR(t);
  		Fjoin fjNode = (Fjoin)CAR(fjList);
  
! 		resdom = (Resdom) CAR((List)get_fj_innerNode(fjNode));
  		cleanMap[cleanResno-1] = get_resno(resdom);
  		cleanResno++;
  
diff -r -P -c src.orig/backend/executor/ex_qual.c src/backend/executor/ex_qual.c
*** src.orig/backend/executor/ex_qual.c	Fri Apr  1 14:42:55 1994
--- src/backend/executor/ex_qual.c	Fri Apr  8 13:56:07 1994
***************
*** 1669,1675 ****
  	    /*
  	     * get the result from the inner node
  	     */
! 	    fjRes = (Resdom)CAR(get_fj_innerNode(fjNode));
  	    resind = get_resno(fjRes) - 1;
  	    if (fjIsNull[0])
  		null_head[resind] = 'n';
--- 1669,1675 ----
  	    /*
  	     * get the result from the inner node
  	     */
! 	    fjRes = (Resdom)CAR((List)get_fj_innerNode(fjNode));
  	    resind = get_resno(fjRes) - 1;
  	    if (fjIsNull[0])
  		null_head[resind] = 'n';
diff -r -P -c src.orig/backend/executor/ex_tuples.c src/backend/executor/ex_tuples.c
*** src.orig/backend/executor/ex_tuples.c	Fri Apr  1 14:42:43 1994
--- src/backend/executor/ex_tuples.c	Fri Apr  8 13:56:08 1994
***************
*** 1095,1101 ****
  	    List  fjList = CAR(tlcdr);
  	    Fjoin fjNode = (Fjoin)tl_node(fjList);
  
! 	    fjRes = (Resdom)tl_resdom(get_fj_innerNode(fjNode));
  	    restype = get_restype(fjRes);
  
  	    ExecSetTypeInfo(
--- 1095,1101 ----
  	    List  fjList = CAR(tlcdr);
  	    Fjoin fjNode = (Fjoin)tl_node(fjList);
  
! 	    fjRes = (Resdom)tl_resdom((List)get_fj_innerNode(fjNode));
  	    restype = get_restype(fjRes);
  
  	    ExecSetTypeInfo(
diff -r -P -c src.orig/backend/executor/n_hash.c src/backend/executor/n_hash.c
*** src.orig/backend/executor/n_hash.c	Fri Apr  1 14:42:46 1994
--- src/backend/executor/n_hash.c	Fri Apr  8 13:56:08 1994
***************
*** 19,24 ****
--- 19,29 ----
  
  #include <math.h>
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <unistd.h>
+ #define L_XTND	SEEK_END
+ #endif
  #include "storage/ipci.h"
  #include "storage/bufmgr.h"	/* for BLCKSZ */
  #include "tcop/slaves.h"
diff -r -P -c src.orig/backend/executor/n_hashjoin.c src/backend/executor/n_hashjoin.c
*** src.orig/backend/executor/n_hashjoin.c	Fri Apr  1 14:42:46 1994
--- src/backend/executor/n_hashjoin.c	Fri Apr  8 13:56:08 1994
***************
*** 16,21 ****
--- 16,26 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <unistd.h>
+ #define L_XTND	SEEK_END
+ #endif
  #include "storage/bufmgr.h"	/* for BLCKSZ */
  #include "tcop/slaves.h"
  #include "executor/executor.h"
diff -r -P -c src.orig/backend/executor/n_indexscan.c src/backend/executor/n_indexscan.c
*** src.orig/backend/executor/n_indexscan.c	Fri Apr  1 14:42:42 1994
--- src/backend/executor/n_indexscan.c	Fri Apr  8 13:56:08 1994
***************
*** 869,875 ****
      if (ruleInfo != NULL && ruleInfo->relationStubsHaveChanged) {
  	ObjectId reloid;
  	reloid =
! 	    RelationGetRelationId(
  			  get_css_currentRelation((CommonScanState)scanstate));
          prs2ReplaceRelationStub(reloid, ruleInfo->relationStubs);
      }
--- 869,875 ----
      if (ruleInfo != NULL && ruleInfo->relationStubsHaveChanged) {
  	ObjectId reloid;
  	reloid =
! 	    RelationGetRelationId((Relation)
  			  get_css_currentRelation((CommonScanState)scanstate));
          prs2ReplaceRelationStub(reloid, ruleInfo->relationStubs);
      }
diff -r -P -c src.orig/backend/executor/n_scantemps.c src/backend/executor/n_scantemps.c
*** src.orig/backend/executor/n_scantemps.c	Fri Apr  1 14:42:48 1994
--- src/backend/executor/n_scantemps.c	Fri Apr  8 13:56:08 1994
***************
*** 19,24 ****
--- 19,27 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include "utils/palloc.h"
  #include "utils/relcache.h"
  #include "tcop/slaves.h"
diff -r -P -c src.orig/backend/executor/n_seqscan.c src/backend/executor/n_seqscan.c
*** src.orig/backend/executor/n_seqscan.c	Fri Apr  1 14:42:48 1994
--- src/backend/executor/n_seqscan.c	Fri Apr  8 13:56:08 1994
***************
*** 444,450 ****
      if (ruleInfo != NULL && ruleInfo->relationStubsHaveChanged) {
  	ObjectId reloid;
  	reloid =
! 	    RelationGetRelationId(
  			  get_css_currentRelation((CommonScanState)scanstate));
  	prs2ReplaceRelationStub(reloid, ruleInfo->relationStubs);
      }
--- 444,450 ----
      if (ruleInfo != NULL && ruleInfo->relationStubsHaveChanged) {
  	ObjectId reloid;
  	reloid =
! 	    RelationGetRelationId((Relation)
  			  get_css_currentRelation((CommonScanState)scanstate));
  	prs2ReplaceRelationStub(reloid, ruleInfo->relationStubs);
      }
diff -r -P -c src.orig/backend/lib/fcache.c src/backend/lib/fcache.c
*** src.orig/backend/lib/fcache.c	Fri Apr  1 14:45:03 1994
--- src/backend/lib/fcache.c	Fri Apr  8 13:56:08 1994
***************
*** 68,74 ****
  
      Assert(ExactNodeType(arg,Var));
  
!     rtid = CInteger(CAR(get_varid(arg)));
      relname = CString(getrelname(rtid, get_ecxt_range_table(econtext)));
  
      tup = SearchSysCacheTuple(TYPNAME, relname, NULL, NULL, NULL);
--- 68,74 ----
  
      Assert(ExactNodeType(arg,Var));
  
!     rtid = CInteger(CAR((List)get_varid(arg)));
      relname = CString(getrelname(rtid, get_ecxt_range_table(econtext)));
  
      tup = SearchSysCacheTuple(TYPNAME, relname, NULL, NULL, NULL);
diff -r -P -c src.orig/backend/libpq/be-fsstubs.c src/backend/libpq/be-fsstubs.c
*** src.orig/backend/libpq/be-fsstubs.c	Fri Apr  1 14:45:11 1994
--- src/backend/libpq/be-fsstubs.c	Fri Apr  8 13:56:09 1994
***************
*** 86,91 ****
--- 86,94 ----
  #include "tmp/libpq.h"
  #include "tmp/libpq-fs.h"
  /*#include "utils/large_object.h"*/
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include "utils/mcxt.h"
  #include "utils/palloc.h"
  #include "catalog/pg_lobj.h"
diff -r -P -c src.orig/backend/nodes/Gen_accessors.sh src/backend/nodes/Gen_accessors.sh
*** src.orig/backend/nodes/Gen_accessors.sh	Fri Apr  1 14:44:35 1994
--- src/backend/nodes/Gen_accessors.sh	Fri Apr  8 13:56:09 1994
***************
*** 19,25 ****
  	CB=$CAT
  fi
  CPP=cpp
! PATH=/usr/lib:/lib:$PATH	# to find cpp if not in /usr/bin
  EGREP=egrep
  RM=rm
  SED=sed
--- 19,25 ----
  	CB=$CAT
  fi
  CPP=cpp
! PATH=/usr/lib:/lib:$PATH:/usr/ccs/lib	# to find cpp if not in /usr/bin
  EGREP=egrep
  RM=rm
  SED=sed
diff -r -P -c src.orig/backend/parser/ylib.c src/backend/parser/ylib.c
*** src.orig/backend/parser/ylib.c	Fri Apr  1 14:42:59 1994
--- src/backend/parser/ylib.c	Fri Apr  8 13:56:09 1994
***************
*** 476,482 ****
  		  IsA(CDR(CAR(fargs)),Iter) && 
  		  (argrelid = typeid_get_relid
  		   ((int)(argtype=funcid_get_rettype
! 			  (get_funcid((Func)(CAR(get_iterexpr((Iter)CDR(CAR(fargs)))))))))))
  	  {
  	      /* the argument is a function returning a tuple, so funcname
  		 may be a projection */
--- 476,482 ----
  		  IsA(CDR(CAR(fargs)),Iter) && 
  		  (argrelid = typeid_get_relid
  		   ((int)(argtype=funcid_get_rettype
! 			  (get_funcid((Func)(CAR((List)get_iterexpr((Iter)CDR(CAR(fargs)))))))))))
  	  {
  	      /* the argument is a function returning a tuple, so funcname
  		 may be a projection */
***************
*** 494,500 ****
  		   if (RelationIsValid(rd))
  		    {
  			iter = (Iter)CDR(CAR(fargs));
! 			set_func_tlist((Func)CAR(get_iterexpr(iter)), 
  				       setup_tlist(funcname, argrelid));
  			return(lispCons(lispInteger(att_typeid(rd,attnum)),iter));
  		    }
--- 494,500 ----
  		   if (RelationIsValid(rd))
  		    {
  			iter = (Iter)CDR(CAR(fargs));
! 			set_func_tlist((Func)CAR((List)get_iterexpr(iter)), 
  				       setup_tlist(funcname, argrelid));
  			return(lispCons(lispInteger(att_typeid(rd,attnum)),iter));
  		    }
diff -r -P -c src.orig/backend/planner/path/clausesel.c src/backend/planner/path/clausesel.c
*** src.orig/backend/planner/path/clausesel.c	Fri Apr  1 14:43:11 1994
--- src/backend/planner/path/clausesel.c	Fri Apr  8 13:56:09 1994
***************
*** 235,241 ****
      } else if (IsA(clause,Const)) {
  	s1 = ((bool) get_constvalue((Const) clause)) ? 1.0 : 0.0;
      } else if (IsA(clause,Var)) {
! 	LispValue relid = translate_relid(CAR(get_varid((Var) clause)));
  
  	/*
  	 * we have a bool Var.  This is exactly equivalent to the clause:
--- 235,241 ----
      } else if (IsA(clause,Const)) {
  	s1 = ((bool) get_constvalue((Const) clause)) ? 1.0 : 0.0;
      } else if (IsA(clause,Var)) {
! 	LispValue relid = translate_relid(CAR((List)get_varid((Var) clause)));
  
  	/*
  	 * we have a bool Var.  This is exactly equivalent to the clause:
***************
*** 247,253 ****
  	s1 = restriction_selectivity(EqualSelectivityProcedure,
  				     BooleanEqualOperator,
  				     CInteger(relid),
! 				     CInteger(CADR(get_varid((Var) clause))),
  				     (Datum) 't',
  				     _SELEC_CONSTANT_RIGHT_);
      } else if (or_selectivities) {
--- 247,253 ----
  	s1 = restriction_selectivity(EqualSelectivityProcedure,
  				     BooleanEqualOperator,
  				     CInteger(relid),
! 				     CInteger(CADR((List)get_varid((Var) clause))),
  				     (Datum) 't',
  				     _SELEC_CONSTANT_RIGHT_);
      } else if (or_selectivities) {
diff -r -P -c src.orig/backend/planner/path/hashutils.c src/backend/planner/path/hashutils.c
*** src.orig/backend/planner/path/hashutils.c	Fri Apr  1 14:43:11 1994
--- src/backend/planner/path/hashutils.c	Fri Apr  8 13:56:09 1994
***************
*** 108,117 ****
  	    }
  	    else {
  		temp = lispList();
! 		CAR(temp) = CAR(get_clauses((JoinMethod)xhashinfo));
! 		CDR(temp) = CDR(get_clauses((JoinMethod)xhashinfo));
! 		CDR(get_clauses((JoinMethod)xhashinfo)) = temp;
! 		CAR(get_clauses((JoinMethod)xhashinfo)) = clause;
  	    }
  	    if (null(get_jmkeys((JoinMethod)xhashinfo)))
  	    {
--- 108,117 ----
  	    }
  	    else {
  		temp = lispList();
! 		CAR(temp) = CAR((List)get_clauses((JoinMethod)xhashinfo));
! 		CDR(temp) = CDR((List)get_clauses((JoinMethod)xhashinfo));
! 		CDR((List)get_clauses((JoinMethod)xhashinfo)) = temp;
! 		CAR((List)get_clauses((JoinMethod)xhashinfo)) = clause;
  	    }
  	    if (null(get_jmkeys((JoinMethod)xhashinfo)))
  	    {
***************
*** 120,129 ****
  	    else {
  		temp2 = lispList();
  	    
! 		CAR(temp2) = CAR(get_jmkeys((JoinMethod)xhashinfo));
! 		CDR(temp2) = CDR(get_jmkeys((JoinMethod)xhashinfo));
! 		CDR(get_jmkeys((JoinMethod)xhashinfo)) = temp2;
! 		CAR(get_jmkeys((JoinMethod)xhashinfo)) = (LispValue)keys;
  	    }
  
  /*	    temp2 = get_jmkeys(xhashinfo);
--- 120,129 ----
  	    else {
  		temp2 = lispList();
  	    
! 		CAR(temp2) = CAR((List)get_jmkeys((JoinMethod)xhashinfo));
! 		CDR(temp2) = CDR((List)get_jmkeys((JoinMethod)xhashinfo));
! 		CDR((List)get_jmkeys((JoinMethod)xhashinfo)) = temp2;
! 		CAR((List)get_jmkeys((JoinMethod)xhashinfo)) = (LispValue)keys;
  	    }
  
  /*	    temp2 = get_jmkeys(xhashinfo);
diff -r -P -c src.orig/backend/planner/path/indxpath.c src/backend/planner/path/indxpath.c
*** src.orig/backend/planner/path/indxpath.c	Fri Apr  1 14:43:13 1994
--- src/backend/planner/path/indxpath.c	Fri Apr  8 13:56:09 1994
***************
*** 131,138 ****
      {
  	match_index_orclauses (rel,
  			       index,
! 			       CAR(get_indexkeys(index)),
! 			       CAR(get_classlist(index)),
  			       clauseinfo_list);
      }
  
--- 131,138 ----
      {
  	match_index_orclauses (rel,
  			       index,
! 			       CAR((List)get_indexkeys(index)),
! 			       CAR((List)get_classlist(index)),
  			       clauseinfo_list);
      }
  
***************
*** 188,194 ****
  	 && null(scanclausegroups)
  	 && null(joinclausegroups)
  	 && (CInteger(get_relid((SortKey)sortkeys)) == 
! 	     CInteger(CAR(get_relids(rel))))
  	 && equal_path_path_ordering(get_sortorder((SortKey)sortkeys),
  				     get_ordering(index))
  	 && equal ((Node)get_sortkeys((SortKey)sortkeys),
--- 188,194 ----
  	 && null(scanclausegroups)
  	 && null(joinclausegroups)
  	 && (CInteger(get_relid((SortKey)sortkeys)) == 
! 	     CInteger(CAR((List)get_relids(rel))))
  	 && equal_path_path_ordering(get_sortorder((SortKey)sortkeys),
  				     get_ordering(index))
  	 && equal ((Node)get_sortkeys((SortKey)sortkeys),
***************
*** 1022,1034 ****
  	 clausegroup = CAR(i);
  	 pathnode = RMakeIndexPath();
  	 relattvals =                
! 	   get_joinvars (CAR(get_relids(rel)),clausegroup);
  	 pagesel = 
! 	   index_selectivity (CInteger(CAR(get_relids (index))),
  			      get_classlist (index),
  			      get_opnos (clausegroup),
  			      CInteger(getrelid (CInteger(CAR
! 							  (get_relids (rel))),
  						 _query_range_table_)),
  			      CAR (relattvals),
  			      CADR (relattvals),
--- 1022,1034 ----
  	 clausegroup = CAR(i);
  	 pathnode = RMakeIndexPath();
  	 relattvals =                
! 	   get_joinvars (CAR((List)get_relids(rel)),clausegroup);
  	 pagesel = 
! 	   index_selectivity (CInteger(CAR((List)get_relids (index))),
  			      get_classlist (index),
  			      get_opnos (clausegroup),
  			      CInteger(getrelid (CInteger(CAR
! 							  ((List)get_relids (rel))),
  						 _query_range_table_)),
  			      CAR (relattvals),
  			      CADR (relattvals),
***************
*** 1045,1051 ****
  	 temp_selec = CDouble(CADR(pagesel));
  
  	 set_path_cost ((Path)pathnode,cost_index(
! 					(ObjectId)CInteger(CAR(get_relids (index))),
  					temp_pages,
  					temp_selec,
  					get_pages (rel),
--- 1045,1051 ----
  	 temp_selec = CDouble(CADR(pagesel));
  
  	 set_path_cost ((Path)pathnode,cost_index(
! 					(ObjectId)CInteger(CAR((List)get_relids (index))),
  					temp_pages,
  					temp_selec,
  					get_pages (rel),
***************
*** 1180,1186 ****
      Rel rel;
      Rel index;
  {
!     ObjectId heapRelid	= CInteger(CAR(get_relids(rel)));
      Func function 	= (Func)get_function(funcOpnd);
      LispValue funcargs	= get_funcargs(funcOpnd);
      LispValue indexKeys	= get_indexkeys(index);
--- 1180,1186 ----
      Rel rel;
      Rel index;
  {
!     ObjectId heapRelid	= CInteger(CAR((List)get_relids(rel)));
      Func function 	= (Func)get_function(funcOpnd);
      LispValue funcargs	= get_funcargs(funcOpnd);
      LispValue indexKeys	= get_indexkeys(index);
diff -r -P -c src.orig/backend/planner/path/joinpath.c src/backend/planner/path/joinpath.c
*** src.orig/backend/planner/path/joinpath.c	Fri Apr  1 14:43:12 1994
--- src/backend/planner/path/joinpath.c	Fri Apr  8 13:56:09 1994
***************
*** 87,94 ****
  	  Path bestinnerjoin;
  	  LispValue pathlist = LispNil;
  
! 	  innerrelids = CADR(get_relids(joinrel));
! 	  outerrelids = CAR(get_relids(joinrel));
  	  innerrelid = form_relid(innerrelids);
  	  outerrelid = form_relid(outerrelids);
  	  innerrel = get_rel(innerrelid);
--- 87,94 ----
  	  Path bestinnerjoin;
  	  LispValue pathlist = LispNil;
  
! 	  innerrelids = CADR((List)get_relids(joinrel));
! 	  outerrelids = CAR((List)get_relids(joinrel));
  	  innerrelid = form_relid(innerrelids);
  	  outerrelid = form_relid(outerrelids);
  	  innerrel = get_rel(innerrelid);
***************
*** 99,111 ****
  	  if( _enable_mergesort_ ) {
  	       mergeinfo_list = 
  		 group_clauses_by_order(get_clauseinfo(joinrel),
! 					 CAR(get_relids(innerrel)));
  	  } 
  	  
  	  if( _enable_hashjoin_ ) {
  	      hashinfo_list = 
  		group_clauses_by_hashop(get_clauseinfo(joinrel),
! 					CAR(get_relids(innerrel)));
  	  } 
  	  
  	  /* need to flatten the relids list */
--- 99,111 ----
  	  if( _enable_mergesort_ ) {
  	       mergeinfo_list = 
  		 group_clauses_by_order(get_clauseinfo(joinrel),
! 					 CAR((List)get_relids(innerrel)));
  	  } 
  	  
  	  if( _enable_hashjoin_ ) {
  	      hashinfo_list = 
  		group_clauses_by_hashop(get_clauseinfo(joinrel),
! 					CAR((List)get_relids(innerrel)));
  	  } 
  	  
  	  /* need to flatten the relids list */
***************
*** 217,223 ****
      LispValue join_path = LispNil;
      
      foreach(join_path, join_paths) {
! 	if (member(CAR(get_joinid((Path)CAR(join_path))),outer_relid)
  	   && ((null(cheapest) || path_is_cheaper((Path)CAR(join_path),cheapest)))) {
  	    cheapest = (Path)CAR(join_path);
  	}
--- 217,223 ----
      LispValue join_path = LispNil;
      
      foreach(join_path, join_paths) {
! 	if (member(CAR((List)get_joinid((Path)CAR(join_path))),outer_relid)
  	   && ((null(cheapest) || path_is_cheaper((Path)CAR(join_path),cheapest)))) {
  	    cheapest = (Path)CAR(join_path);
  	}
***************
*** 423,429 ****
  	      /* if base relation, then */
  	      foreach (x, get_innerjoin(innerrel)) {
  	          innerpath = (Path)CAR(x);
! 	          if (member(CAR(get_joinid(innerpath)),outer_relid)) {
  	              paths = lispCons((LispValue)create_nestloop_path(joinrel, outerrel,
  						            outerpath, innerpath,
  						            merge_pathkeys),
--- 423,429 ----
  	      /* if base relation, then */
  	      foreach (x, get_innerjoin(innerrel)) {
  	          innerpath = (Path)CAR(x);
! 	          if (member(CAR((List)get_joinid(innerpath)),outer_relid)) {
  	              paths = lispCons((LispValue)create_nestloop_path(joinrel, outerrel,
  						            outerpath, innerpath,
  						            merge_pathkeys),
diff -r -P -c src.orig/backend/planner/path/orindxpath.c src/backend/planner/path/orindxpath.c
*** src.orig/backend/planner/path/orindxpath.c	Fri Apr  1 14:43:12 1994
--- src/backend/planner/path/orindxpath.c	Fri Apr  8 13:56:10 1994
***************
*** 229,239 ****
  	  else {
  	       flag = _SELEC_CONSTANT_RIGHT_;
  	  } 
! 	  pagesel = index_selectivity (CInteger(CAR(get_relids (index))) ,
  				       get_classlist (index),
  				       lispInteger(opno),
  				       CInteger(getrelid (CInteger
! 						    (CAR(get_relids(rel))),
  						_query_range_table_)),
  				       lispCons (lispInteger(attno),LispNil),
  				       lispCons (lispInteger(value),LispNil),
--- 229,239 ----
  	  else {
  	       flag = _SELEC_CONSTANT_RIGHT_;
  	  } 
! 	  pagesel = index_selectivity (CInteger(CAR((List)get_relids (index))) ,
  				       get_classlist (index),
  				       lispInteger(opno),
  				       CInteger(getrelid (CInteger
! 						    (CAR((List)get_relids(rel))),
  						_query_range_table_)),
  				       lispCons (lispInteger(attno),LispNil),
  				       lispCons (lispInteger(value),LispNil),
diff -r -P -c src.orig/backend/planner/path/xfunc.c src/backend/planner/path/xfunc.c
*** src.orig/backend/planner/path/xfunc.c	Fri Apr  1 14:43:13 1994
--- src/backend/planner/path/xfunc.c	Fri Apr  8 13:56:10 1994
***************
*** 624,630 ****
  	      Assert(length(get_param_tlist((Param)clause)) == 1); /* sanity */
  	      retval = 
  		xfunc_width((LispValue)
! 			    get_expr((TLE)CAR(get_param_tlist((Param)clause))));
  	  }
  	 else
  	  {
--- 624,630 ----
  	      Assert(length(get_param_tlist((Param)clause)) == 1); /* sanity */
  	      retval = 
  		xfunc_width((LispValue)
! 			    get_expr((TLE)CAR((List)get_param_tlist((Param)clause))));
  	  }
  	 else
  	  {
***************
*** 670,676 ****
  	      Assert(length(get_func_tlist(func)) == 1);   /* sanity */
  	      retval = 
  		xfunc_width((LispValue)
! 			    get_expr((TLE)CAR(get_func_tlist(func))));
  	      goto exit;
  	  }
  	 else
--- 670,676 ----
  	      Assert(length(get_func_tlist(func)) == 1);   /* sanity */
  	      retval = 
  		xfunc_width((LispValue)
! 			    get_expr((TLE)CAR((List)get_func_tlist(func))));
  	      goto exit;
  	  }
  	 else
***************
*** 709,715 ****
      foreach (temp,_base_relation_list_)
       {
  	 Assert(CDR(get_relids((Rel)CAR(temp))) == LispNil);
! 	 allrelids = nappend1(allrelids, CAR(get_relids((Rel)CAR(temp))));
       }
  	 
      /* find all relids referenced in query but not in clause */
--- 709,715 ----
      foreach (temp,_base_relation_list_)
       {
  	 Assert(CDR(get_relids((Rel)CAR(temp))) == LispNil);
! 	 allrelids = nappend1(allrelids, CAR((List)get_relids((Rel)CAR(temp))));
       }
  	 
      /* find all relids referenced in query but not in clause */
***************
*** 770,776 ****
  
      /* Base cases */
      if (IsA(clause,Var)) 
!       return(lispCons(CAR(get_varid((Var)clause)), LispNil));
      else if (IsA(clause,Const) || IsA(clause,Param))
        return((List)LispNil);
  
--- 770,776 ----
  
      /* Base cases */
      if (IsA(clause,Var)) 
!       return(lispCons(CAR((List)get_varid((Var)clause)), LispNil));
      else if (IsA(clause,Const) || IsA(clause,Param))
        return((List)LispNil);
  
diff -r -P -c src.orig/backend/planner/plan/createplan.c src/backend/planner/plan/createplan.c
*** src.orig/backend/planner/plan/createplan.c	Fri Apr  1 14:43:14 1994
--- src/backend/planner/plan/createplan.c	Fri Apr  8 13:56:10 1994
***************
*** 369,375 ****
       fixed_indxqual = fix_indxqual_references(indxqual,best_path);
       scan_node = make_indexscan(tlist,
  				 qpqual,
! 				 CInteger(CAR(get_relids 
  					      (get_parent((Path)best_path)))),
  				 get_indexid(best_path),
  				 fixed_indxqual);
--- 369,375 ----
       fixed_indxqual = fix_indxqual_references(indxqual,best_path);
       scan_node = make_indexscan(tlist,
  				 qpqual,
! 				 CInteger(CAR((List)get_relids 
  					      (get_parent((Path)best_path)))),
  				 get_indexid(best_path),
  				 fixed_indxqual);
***************
*** 389,395 ****
  {
      LispValue newclause;
      if(IsA(clause,Var) && 
!        CInteger(CAR(get_relids(get_parent(index_path)))) ==
         get_varno((Var)clause)) {
  	int pos = 0;
  	LispValue x = LispNil;
--- 389,395 ----
  {
      LispValue newclause;
      if(IsA(clause,Var) && 
!        CInteger(CAR((List)get_relids(get_parent(index_path)))) ==
         get_varno((Var)clause)) {
  	int pos = 0;
  	LispValue x = LispNil;
***************
*** 418,424 ****
  	   * 	 (make_opclause(replace_opid(get_op clause))
  	   */
  	  return(make_opclause((Oper)get_op(clause),
! 			       MakeVar((Index)CInteger(CAR(get_relids
  				       (get_parent(index_path)))),
  				       1, /* func indices have one key */
  				       get_functype((Func)get_function(clause)),
--- 418,424 ----
  	   * 	 (make_opclause(replace_opid(get_op clause))
  	   */
  	  return(make_opclause((Oper)get_op(clause),
! 			       MakeVar((Index)CInteger(CAR((List)get_relids
  				       (get_parent(index_path)))),
  				       1, /* func indices have one key */
  				       get_functype((Func)get_function(clause)),
***************
*** 498,504 ****
  	 *    qualifications in indxqual. 
  	 */
  
! 	List inner_indxqual = CAR(get_indxqual((IndexScan)inner_node));
  	List inner_qual = (inner_indxqual == LispNil)? LispNil:CAR(inner_indxqual);
  
  	/* If we have in fact found a join index qualification, remove these
--- 498,504 ----
  	 *    qualifications in indxqual. 
  	 */
  
! 	List inner_indxqual = CAR((List)get_indxqual((IndexScan)inner_node));
  	List inner_qual = (inner_indxqual == LispNil)? LispNil:CAR(inner_indxqual);
  
  	/* If we have in fact found a join index qualification, remove these
diff -r -P -c src.orig/backend/planner/prep/semanopt.c src/backend/planner/prep/semanopt.c
*** src.orig/backend/planner/prep/semanopt.c	Fri Apr  1 14:43:16 1994
--- src/backend/planner/prep/semanopt.c	Fri Apr  8 13:56:10 1994
***************
*** 290,296 ****
        if (get_varno((Var)tle) == right) {
  	set_varno((Var)tle,left);
  	set_varid((Var)tle, lispCons(lispInteger(left),
! 				lispCons(CADR(get_varid((Var)tle)),
  					 LispNil)) );
        }
      } else
--- 290,296 ----
        if (get_varno((Var)tle) == right) {
  	set_varno((Var)tle,left);
  	set_varid((Var)tle, lispCons(lispInteger(left),
! 				lispCons(CADR((List)get_varid((Var)tle)),
  					 LispNil)) );
        }
      } else
***************
*** 319,332 ****
        if (get_varno((Var)leftop) == right) {
  	set_varno((Var)leftop,left);
  	set_varid((Var)leftop, lispCons(lispInteger(left),
! 				   lispCons(CADR(get_varid((Var)leftop)),
  					    LispNil)) );
        } else
  	if (IsA(rightop,Var))
  	  if (get_varno((Var)rightop) == right) {
  	    set_varno((Var)rightop,left);
  	    set_varid((Var)rightop, lispCons(lispInteger(left),
! 				       lispCons(CADR(get_varid((Var)rightop)),
  						LispNil)) );	    
  	  }
    }
--- 319,332 ----
        if (get_varno((Var)leftop) == right) {
  	set_varno((Var)leftop,left);
  	set_varid((Var)leftop, lispCons(lispInteger(left),
! 				   lispCons(CADR((List)get_varid((Var)leftop)),
  					    LispNil)) );
        } else
  	if (IsA(rightop,Var))
  	  if (get_varno((Var)rightop) == right) {
  	    set_varno((Var)rightop,left);
  	    set_varid((Var)rightop, lispCons(lispInteger(left),
! 				       lispCons(CADR((List)get_varid((Var)rightop)),
  						LispNil)) );	    
  	  }
    }
diff -r -P -c src.orig/backend/port/sparc_solaris/Makefile.inc src/backend/port/sparc_solaris/Makefile.inc
*** src.orig/backend/port/sparc_solaris/Makefile.inc	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/Makefile.inc	Sat Mar 26 10:31:11 1994
***************
*** 0 ****
--- 1,13 ----
+ #
+ # SPARC/Solaris 2.x specific stuff
+ #
+ #
+ 
+ CFLAGS+= -DUSE_POSIX_TIME -DNEED_ISINF
+ 
+ LDADD+= -lsocket -lnsl -ll -ldl
+ 
+ #
+ 
+ SRCS+= port.c dynloader.c
+ HEADERS+= machine.h
diff -r -P -c src.orig/backend/port/sparc_solaris/dynloader.c src/backend/port/sparc_solaris/dynloader.c
*** src.orig/backend/port/sparc_solaris/dynloader.c	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/dynloader.c	Thu Mar 24 17:18:03 1994
***************
*** 0 ****
--- 1,54 ----
+ /*
+  *   FILE
+  *	dynloader.c
+  *
+  *   DESCRIPTION
+  *	dynamic loader for SunOS 4 using the shared library mechanism
+  *
+  *   INTERFACE ROUTINES
+  *	pg_dlopen
+  *	pg_dlsym
+  *	pg_dlclose
+  *
+  *   NOTES
+  *	pg_dlsym and pg_dlclose are actually macros, defined in 
+  *	port-protos.h.
+  *
+  *   IDENTIFICATION
+  *	/usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/dynloader.c,v 1.20 1993/08/04 11:02:54 aoki Exp
+  */
+ 
+ #include <stdio.h>
+ #include <dlfcn.h>
+ 
+ #include "port-protos.h"
+ 
+ RcsId("/usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/dynloader.c,v 1.20 1993/08/04 11:02:54 aoki Exp");
+ 
+ /*
+  * Dynamic Loader on SunOS 4.
+  *
+  * this dynamic loader uses the system dynamic loading interface for shared 
+  * libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
+  * library as the file to be dynamically loaded.
+  *
+  * Note that only pg_dlopen is defined here. pg_dlsym and pg_dlclose
+  * are actually macros.
+  */
+ 
+ /*
+  * pg_dlopen--
+  *	attempts to dynamically loaded in filename and returns error in
+  *	err, if any. 
+  */
+ void *
+ pg_dlopen(filename, err)
+     char *filename; char **err;
+ {
+     void *handle;
+ 
+     if ((handle = dlopen(filename, 1)) == (void *) NULL) {
+ 	*err = dlerror();
+     }
+     return((void *) handle);
+ }
diff -r -P -c src.orig/backend/port/sparc_solaris/float.h src/backend/port/sparc_solaris/float.h
*** src.orig/backend/port/sparc_solaris/float.h	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/float.h	Thu Mar 24 17:18:03 1994
***************
*** 0 ****
--- 1,30 ----
+ /* ----------------------------------------------------------------
+  *   FILE
+  *	float.h
+  *
+  *   DESCRIPTION
+  *	definitions for ANSI floating point
+  *
+  *   NOTES
+  *	These come straight out of ANSI X3.159-1989 (p.18) and
+  *	would be unnecessary if SunOS 4 were ANSI-compliant.
+  *
+  *	This is only a partial listing because I'm lazy to type
+  *	the whole thing in.
+  *
+  *   IDENTIFICATION
+  *	/usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/float.h,v 1.1 1994/02/09 00:17:30 aoki Exp
+  * ----------------------------------------------------------------
+  */
+ 
+ #ifndef floatIncluded		/* include this file only once */
+ #define floatIncluded	1
+ 
+ #define FLT_DIG	6
+ #define FLT_MIN	((float) 1.17549435e-38)
+ #define FLT_MAX	((float) 3.40282347e+38)
+ #define DBL_DIG	15
+ #define DBL_MIN	2.2250738585072014e-308
+ #define DBL_MAX	1.7976931348623157e+308
+ 
+ #endif /* floatIncluded */
diff -r -P -c src.orig/backend/port/sparc_solaris/machine.h src/backend/port/sparc_solaris/machine.h
*** src.orig/backend/port/sparc_solaris/machine.h	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/machine.h	Thu Mar 24 17:18:03 1994
***************
*** 0 ****
--- 1,12 ----
+ 
+ /*
+  *  /usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/machine.h,v 1.2 1989/09/05 17:20:51 mao Version_2
+  */
+ 
+ #ifndef MACHINE_H
+ #define MACHINE_H
+ 
+ #define BLCKSZ	8192
+ 
+ #endif
+ 
diff -r -P -c src.orig/backend/port/sparc_solaris/port-protos.h src/backend/port/sparc_solaris/port-protos.h
*** src.orig/backend/port/sparc_solaris/port-protos.h	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/port-protos.h	Fri Mar 25 13:15:32 1994
***************
*** 0 ****
--- 1,31 ----
+ /*
+  *   FILE
+  *	port-protos.h
+  *
+  *   DESCRIPTION
+  *	port-specific prototypes for SunOS 4
+  *
+  *   NOTES
+  *
+  *   IDENTIFICATION
+  *	/usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/port-protos.h,v 1.5 1993/08/04 11:02:54 aoki Exp
+  */
+ 
+ #ifndef PortProtos_H			/* include this file only once */
+ #define PortProtos_H 1
+ 
+ #include <dlfcn.h>
+ #include <tmp/postgres.h>
+ #include "fmgr.h"			/* for func_ptr */
+ #include "utils/dynamic_loader.h"
+ 
+ /* dynloader.c */
+ 
+ #define	pg_dlsym	dlsym
+ #define	pg_dlclose	dlclose
+ 
+ /* port.c */
+ 
+ void sparc_bug_set_outerjoincost ARGS((char *p, long val));
+ 
+ #endif /* PortProtos_H */
diff -r -P -c src.orig/backend/port/sparc_solaris/port.c src/backend/port/sparc_solaris/port.c
*** src.orig/backend/port/sparc_solaris/port.c	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/port.c	Thu Mar 24 17:18:03 1994
***************
*** 0 ****
--- 1,31 ----
+ /*
+  *   FILE
+  *	port.c
+  *
+  *   DESCRIPTION
+  *	SunOS4-specific routines
+  *
+  *   INTERFACE ROUTINES
+  *	sparc_bug_set_outerjoincost
+  *
+  *   NOTES
+  *
+  *   IDENTIFICATION
+  *	/usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/port.c,v 1.7 1993/08/10 19:54:48 aoki Exp
+  */
+ #include "nodes/relation.h"
+ 
+ RcsId("/usr/local/devel/postgres-4.2-devel/src/backend/port/sparc/RCS/port.c,v 1.7 1993/08/10 19:54:48 aoki Exp");
+ 
+ /*
+  * Hackety-hack for Sparc compiler error.
+  *
+  * See planner/path/joinpath.c
+  */
+ void
+ sparc_bug_set_outerjoincost(p, val)
+     char *p;
+     long val;
+ {
+     set_outerjoincost((Path)p, (Cost)val);
+ }
diff -r -P -c src.orig/backend/port/sparc_solaris/strings.h src/backend/port/sparc_solaris/strings.h
*** src.orig/backend/port/sparc_solaris/strings.h	Wed Dec 31 16:00:00 1969
--- src/backend/port/sparc_solaris/strings.h	Mon Mar 28 14:36:40 1994
***************
*** 0 ****
--- 1,3 ----
+ #include <string.h>
+ #define index(s,c)	strchr(s,c)
+ #define	rindex(s,c)	strrchr(s,c)
diff -r -P -c src.orig/backend/postmaster/postmaster.c src/backend/postmaster/postmaster.c
*** src.orig/backend/postmaster/postmaster.c	Fri Apr  1 14:45:12 1994
--- src/backend/postmaster/postmaster.c	Fri Apr  8 13:56:10 1994
***************
*** 34,39 ****
--- 34,42 ----
  #include <sys/stat.h>		/* for umask */
  #include <sys/time.h>
  #include <sys/param.h>		/* for MAXHOSTNAMELEN */
+ #ifdef SVR4
+ #include <netdb.h>		/* for MAXHOSTNAMELEN */
+ #endif
  #include <errno.h>
  #include <fcntl.h>
  #include <stdio.h>
***************
*** 588,601 ****
--- 591,614 ----
   */
  reaper()
  {
+ #ifdef SVR4
+     pid_t	pid;
+     int		status;
+ #else
      union wait	status;		/* backend exit status */
      int		pid;		/* process id of dead backend */
+ #endif
      
      if (DebugLvl)
  	fprintf(stderr, "%s: reaping dead processes...\n",
  		progname);
+ #ifdef SVR4
+     while((pid = waitpid(-1,&status, WNOHANG)) > 0)
+ 	CleanupProc(pid, status);
+ #else
      while((pid = wait3(&status, WNOHANG, (struct rusage  *) NULL)) > 0)
  	CleanupProc(pid, status.w_status);
+ #endif
  }
  
  /*
diff -r -P -c src.orig/backend/storage/buf_internals.h src/backend/storage/buf_internals.h
*** src.orig/backend/storage/buf_internals.h	Fri Apr  1 14:43:49 1994
--- src/backend/storage/buf_internals.h	Fri Apr  8 13:56:10 1994
***************
*** 148,154 ****
      defined(PORTNAME_hpux)
      char		sb_pad[60];	/* no slock_t */
  #endif /* mips */
! #if defined(PORTNAME_sparc)
      char		sb_pad[56];	/* has slock_t */
  #endif /* sparc */
  #if defined(PORTNAME_alpha)
--- 148,154 ----
      defined(PORTNAME_hpux)
      char		sb_pad[60];	/* no slock_t */
  #endif /* mips */
! #if defined(PORTNAME_sparc) || defined(PORTNAME_sparc_solaris)
      char		sb_pad[56];	/* has slock_t */
  #endif /* sparc */
  #if defined(PORTNAME_alpha)
***************
*** 157,163 ****
  #else /* HAS_TEST_AND_SET */
      char		sb_pad[48];	/* no slock_t */
  #endif /* HAS_TEST_AND_SET */
! #endif /* sparc */
  };
  
  /*
--- 157,163 ----
  #else /* HAS_TEST_AND_SET */
      char		sb_pad[48];	/* no slock_t */
  #endif /* HAS_TEST_AND_SET */
! #endif /* alpha */
  };
  
  /*
diff -r -P -c src.orig/backend/storage/file/fd.c src/backend/storage/file/fd.c
*** src.orig/backend/storage/file/fd.c	Fri Apr  1 14:43:51 1994
--- src/backend/storage/file/fd.c	Fri Apr  8 13:56:10 1994
***************
*** 28,33 ****
--- 28,39 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <unistd.h>
+ #define L_XTND	SEEK_END
+ #define L_INCR	SEEK_CUR
+ #endif
  #include <sys/param.h>
  #include <errno.h>
  #include <sys/stat.h>
***************
*** 1494,1502 ****
--- 1500,1514 ----
  	stbuf->st_ctime = ustatbuf.st_ctimespec.ts_sec;
  	stbuf->st_mtime = ustatbuf.st_mtimespec.ts_sec;
  #else
+ #if defined(PORTNAME_sparc_solaris)
+ 	stbuf->st_atim.tv_sec = ustatbuf.st_atim.tv_sec;
+ 	stbuf->st_ctim.tv_sec = ustatbuf.st_ctim.tv_sec;
+ 	stbuf->st_mtim.tv_sec = ustatbuf.st_mtim.tv_sec;
+ #else
  	stbuf->st_atime = ustatbuf.st_atime;
  	stbuf->st_ctime = ustatbuf.st_ctime;
  	stbuf->st_mtime = ustatbuf.st_mtime;
+ #endif
  #endif
      }
      return ret;
diff -r -P -c src.orig/backend/storage/ipc.h src/backend/storage/ipc.h
*** src.orig/backend/storage/ipc.h	Fri Apr  1 14:43:43 1994
--- src/backend/storage/ipc.h	Fri Apr  8 13:56:11 1994
***************
*** 93,98 ****
--- 93,99 ----
  #if defined(sequent) || \
      defined(PORTNAME_aix) || \
      defined(PORTNAME_alpha) || \
+     defined(PORTNAME_sparc_solaris) || \
      defined(PORTNAME_hpux) || \
      defined(PORTNAME_ultrix4) || \
      defined(PORTNAME_bsd44)
diff -r -P -c src.orig/backend/storage/large_object/lo_api.c src/backend/storage/large_object/lo_api.c
*** src.orig/backend/storage/large_object/lo_api.c	Fri Apr  1 14:43:56 1994
--- src/backend/storage/large_object/lo_api.c	Fri Apr  8 13:56:11 1994
***************
*** 11,16 ****
--- 11,21 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <unistd.h>
+ #define	L_XTND	SEEK_END
+ #endif
  #include "tmp/c.h"
  #include "tmp/libpq-fs.h"
  #include "access/relscan.h"
diff -r -P -c src.orig/backend/storage/smgr/md.c src/backend/storage/smgr/md.c
*** src.orig/backend/storage/smgr/md.c	Fri Apr  1 14:43:58 1994
--- src/backend/storage/smgr/md.c	Fri Apr  8 13:56:11 1994
***************
*** 5,10 ****
--- 5,15 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <unistd.h>
+ #define L_XTND	SEEK_END
+ #endif
  
  #include "tmp/c.h"
  #include "tmp/postgres.h"
diff -r -P -c src.orig/backend/storage/smgr/sj.c src/backend/storage/smgr/sj.c
*** src.orig/backend/storage/smgr/sj.c	Fri Apr  1 14:43:58 1994
--- src/backend/storage/smgr/sj.c	Fri Apr  8 13:56:11 1994
***************
*** 11,16 ****
--- 11,19 ----
  #ifdef SONY_JUKEBOX
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include <math.h>
  #include "machine.h"
  
diff -r -P -c src.orig/backend/tcop/postgres.c src/backend/tcop/postgres.c
*** src.orig/backend/tcop/postgres.c	Fri Apr  1 14:44:03 1994
--- src/backend/tcop/postgres.c	Fri Apr  8 16:07:42 1994
***************
*** 1144,1151 ****
       * ----------------
       */
      signal(SIGHUP, handle_warn);
!     
      if (setjmp(Warn_restart) != 0) {
  	Warnings++;
  	time(&tim);
  	
--- 1144,1154 ----
       * ----------------
       */
      signal(SIGHUP, handle_warn);
! 
      if (setjmp(Warn_restart) != 0) {
+ #if defined(PORTNAME_sparc_solaris)
+ 	sigrelse(SIGHUP);
+ #endif
  	Warnings++;
  	time(&tim);
  	
***************
*** 1290,1304 ****
--- 1293,1320 ----
      }
  }
  
+ #ifdef SVR4
+ #include <sys/times.h>
+ #include <limits.h>
+ 
+ struct tms Save_r;
+ 
+ #else
  #include <sys/resource.h>
  
  struct rusage Save_r;
+ #endif
+ 
  struct timeval Save_t;
  
  ResetUsage()
  {
          struct timezone tz;
+ #ifdef SVR4
+ 	(void)times(&Save_r);
+ #else
  	getrusage(RUSAGE_SELF, &Save_r);
+ #endif
          gettimeofday(&Save_t, &tz);
  	ResetBufferUsage();
  	ResetTupleCount();
***************
*** 1306,1311 ****
--- 1322,1328 ----
  
  ShowUsage()
  {
+ #ifndef SVR4
  	struct rusage r;
  	struct timeval user, sys;
          struct timeval elapse_t;
***************
*** 1374,1379 ****
--- 1391,1397 ----
  		r.ru_nvcsw - Save_r.ru_nvcsw,
  		r.ru_nivcsw - Save_r.ru_nivcsw,
  		r.ru_nvcsw, r.ru_nivcsw);
+ #endif /* SVR4 */
  	fprintf(StatFp, "! postgres usage stats:\n");
  	PrintBufferUsage(StatFp);
  	DisplayTupleCount(StatFp);
diff -r -P -c src.orig/backend/tmp/c.h src/backend/tmp/c.h
*** src.orig/backend/tmp/c.h	Fri Apr  1 14:44:05 1994
--- src/backend/tmp/c.h	Fri Apr  8 13:56:11 1994
***************
*** 924,929 ****
--- 924,935 ----
  #include "port/hpux/fixade.h"	/* for 8.07 unaligned access fixup */
  #endif /* PORTNAME_hpux */
  
+ #if defined(PORTNAME_sparc_solaris)	/* SVR4 redefinitions for BSDisms */
+ #define bcopy(src,dst,len)	memmove(dst,src,len)
+ #define bzero(dst,len)		memset(dst, 0, len)
+ #define bcmp(src, dst, len)	memcmp(src, dst, len)
+ #endif /* PORTNAME_sparc_solaris */
+ 
  /* ----------------
   *	end of c.h
   * ----------------
diff -r -P -c src.orig/backend/tmp/libpq-fe.h src/backend/tmp/libpq-fe.h
*** src.orig/backend/tmp/libpq-fe.h	Fri Apr  1 14:44:06 1994
--- src/backend/tmp/libpq-fe.h	Fri Apr  8 14:59:04 1994
***************
*** 41,47 ****
  extern char *PQexec ARGS((char *query));
  extern Pointer palloc ARGS((Size size));
  extern void pfree ARGS((Pointer pointer));
! extern void elog ARGS((int lev, ...));
  extern void AssertionFailed ARGS((const String assertionName, const String fileName, const int lineNumber));
  
  #endif LibpqFeIncluded
--- 41,47 ----
  extern char *PQexec ARGS((char *query));
  extern Pointer palloc ARGS((Size size));
  extern void pfree ARGS((Pointer pointer));
! extern void elog ARGS((int lev, char *, ...));
  extern void AssertionFailed ARGS((const String assertionName, const String fileName, const int lineNumber));
  
  #endif LibpqFeIncluded
diff -r -P -c src.orig/backend/tmp/libpq-fs.h src/backend/tmp/libpq-fs.h
*** src.orig/backend/tmp/libpq-fs.h	Fri Apr  1 14:44:07 1994
--- src/backend/tmp/libpq-fs.h	Fri Apr  8 13:56:11 1994
***************
*** 100,108 ****
--- 100,114 ----
      unsigned int st_sizehigh;	/* high order bits */
  /* 2^64 == 1.8 x 10^20 bytes */
      int st_uid;
+ #ifdef SVR4
+     timestruc_t st_atim;
+     timestruc_t st_mtim;
+     timestruc_t st_ctim;
+ #else /* SVR4 */
      int st_atime;
      int st_mtime;
      int st_ctime;
+ #endif /* SVR4 */
  };
  
  typedef struct Direntry_ {
diff -r -P -c src.orig/backend/utils/Gen_fmgrtab.sh src/backend/utils/Gen_fmgrtab.sh
*** src.orig/backend/utils/Gen_fmgrtab.sh	Fri Apr  1 14:44:18 1994
--- src/backend/utils/Gen_fmgrtab.sh	Fri Apr  8 13:56:12 1994
***************
*** 15,21 ****
  #----------------------------------------------------------------
  
  # cpp is usually in one of these two places...
! PATH=/usr/lib:/lib:$PATH
  
  BKIOPTS=''
  if [ $? != 0 ]
--- 15,21 ----
  #----------------------------------------------------------------
  
  # cpp is usually in one of these two places...
! PATH=/usr/lib:/lib:$PATH:/usr/ccs/lib
  
  BKIOPTS=''
  if [ $? != 0 ]
diff -r -P -c src.orig/backend/utils/adt/arrayfuncs.c src/backend/utils/adt/arrayfuncs.c
*** src.orig/backend/utils/adt/arrayfuncs.c	Fri Apr  1 14:44:24 1994
--- src/backend/utils/adt/arrayfuncs.c	Fri Apr  8 13:56:12 1994
***************
*** 8,13 ****
--- 8,17 ----
  
  #include <ctype.h>
  #include <stdio.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <strings.h>
+ #endif
  #include "tmp/postgres.h"
  #include "tmp/libpq-fs.h"
  
diff -r -P -c src.orig/backend/utils/adt/chunk.c src/backend/utils/adt/chunk.c
*** src.orig/backend/utils/adt/chunk.c	Fri Apr  1 14:44:25 1994
--- src/backend/utils/adt/chunk.c	Fri Apr  8 13:56:12 1994
***************
*** 1,5 ****
--- 1,8 ----
  #include <ctype.h>
  #include "tmp/postgres.h"
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include "utils/memutils.h"
  #include "tmp/libpq-fs.h"
  
diff -r -P -c src.orig/backend/utils/adt/float.c src/backend/utils/adt/float.c
*** src.orig/backend/utils/adt/float.c	Fri Apr  1 14:44:20 1994
--- src/backend/utils/adt/float.c	Fri Apr  8 13:56:12 1994
***************
*** 1285,1289 ****
--- 1285,1309 ----
      return(0);
  }
  #endif /* PORTNAME_alpha */
+ #if defined(PORTNAME_sparc_solaris)
+ #include <ieeefp.h>
+ static int
+ isinf(d)
+ 	double d;
+ {
+ 	fpclass_t	type = fpclass(d);
+ 	switch (type) {
+ 	case FP_SNAN:
+ 	case FP_QNAN:
+ 	case FP_NINF:
+ 	case FP_PINF:
+ 	    return (1);
+ 	default:
+ 	    break;
+ 	}
+ 				       
+ 	return (0);
+ }
+ #endif /* PORTNAME_sparc_solaris */
  
  #endif /* NEED_ISINF */
diff -r -P -c src.orig/backend/utils/adt/ftype.c src/backend/utils/adt/ftype.c
*** src.orig/backend/utils/adt/ftype.c	Fri Apr  1 14:44:22 1994
--- src/backend/utils/adt/ftype.c	Fri Apr  8 13:56:12 1994
***************
*** 3,8 ****
--- 3,11 ----
   */
  
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include <sys/types.h>
  #include <sys/socket.h>
  #include <netinet/in.h>
diff -r -P -c src.orig/backend/utils/adt/geo-ops.c src/backend/utils/adt/geo-ops.c
*** src.orig/backend/utils/adt/geo-ops.c	Fri Apr  1 14:44:23 1994
--- src/backend/utils/adt/geo-ops.c	Fri Apr  8 13:56:12 1994
***************
*** 49,54 ****
--- 49,57 ----
  	if (str == NULL)
  	  elog (WARN," Bad (null) box external representation");
  
+ #if defined(PORTNAME_sparc_solaris)
+ 	coord[0] = coord[1] = coord[2] = coord[3] = "0";
+ #endif
  	if ((p = (char *)index(str, LDELIM)) == (char *)NULL)
  		elog (WARN, "Bad box external representation '%s'",str);
  	for (i = 0, p = str; *p && i < BOXNARGS && *p != RDELIM; p++)
diff -r -P -c src.orig/backend/utils/adt/nabstime.c src/backend/utils/adt/nabstime.c
*** src.orig/backend/utils/adt/nabstime.c	Fri Apr  1 14:44:21 1994
--- src/backend/utils/adt/nabstime.c	Fri Apr  8 13:56:12 1994
***************
*** 296,302 ****
  	(void) ftime(&now);
  	*tzp = now.timezone;
  #else /* USE_POSIX_TIME */
! #if defined(PORTNAME_hpux) || defined(PORTNAME_aix)
  	tzset();
  	*tzp = timezone / 60;		/* this is an X/Open-ism */
  #else /* PORTNAME_hpux || PORTNAME_aix */
--- 296,302 ----
  	(void) ftime(&now);
  	*tzp = now.timezone;
  #else /* USE_POSIX_TIME */
! #if defined(PORTNAME_hpux) || defined(PORTNAME_aix) || defined(PORTNAME_sparc_solaris)
  	tzset();
  	*tzp = timezone / 60;		/* this is an X/Open-ism */
  #else /* PORTNAME_hpux || PORTNAME_aix */
diff -r -P -c src.orig/backend/utils/adt/sets.c src/backend/utils/adt/sets.c
*** src.orig/backend/utils/adt/sets.c	Fri Apr  1 14:44:25 1994
--- src/backend/utils/adt/sets.c	Fri Apr  8 13:56:13 1994
***************
*** 8,23 ****
   */
  
  #include "tmp/postgres.h"
  #include "utils/log.h"
  #include "rules/prs2.h"
- #include "nodes/pg_lisp.h"          /* for LispValue and List */
  #include "access/htup.h"            /* for HeapTuple */
  #include "catalog/pg_proc.h"        /* for Form_pg_proc */
  #include "catalog/syscache.h"       /* for PROOID */
  #include "catalog/catname.h"        /* for ProcedureRelationName */
  #include "catalog/indexing.h"       /* for Num_pg_proc_indices */
  #include "utils/sets.h"             /* for GENERICSETNAME      */
- #include "tcop/dest.h"
  
  extern CommandDest whereToSendOutput;  /* defined in tcop/postgres.c */
  
--- 8,23 ----
   */
  
  #include "tmp/postgres.h"
+ #include "nodes/pg_lisp.h"          /* for LispValue and List */
+ #include "tcop/dest.h"
  #include "utils/log.h"
  #include "rules/prs2.h"
  #include "access/htup.h"            /* for HeapTuple */
  #include "catalog/pg_proc.h"        /* for Form_pg_proc */
  #include "catalog/syscache.h"       /* for PROOID */
  #include "catalog/catname.h"        /* for ProcedureRelationName */
  #include "catalog/indexing.h"       /* for Num_pg_proc_indices */
  #include "utils/sets.h"             /* for GENERICSETNAME      */
  
  extern CommandDest whereToSendOutput;  /* defined in tcop/postgres.c */
  
diff -r -P -c src.orig/backend/utils/cache/relcache.c src/backend/utils/cache/relcache.c
*** src.orig/backend/utils/cache/relcache.c	Fri Apr  1 14:44:26 1994
--- src/backend/utils/cache/relcache.c	Fri Apr  8 13:56:13 1994
***************
*** 27,32 ****
--- 27,35 ----
   */
  #include <errno.h>
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include <string.h>
   
  /* XXX check above includes */
***************
*** 34,40 ****
  #include "tmp/postgres.h"
  #include "tmp/miscadmin.h"
  
! RcsId("/usr/local/devel/postgres-v4r2/src/backend/utils/cache/RCS/relcache.c,v 1.76 1994/02/11 21:35:00 aoki Exp");
   
  #include "access/att.h"
  #include "access/attnum.h"
--- 37,43 ----
  #include "tmp/postgres.h"
  #include "tmp/miscadmin.h"
  
! RcsId("/usr/local/devel/postgres-4.2-devel/src/backend/utils/cache/RCS/relcache.c,v 1.76 1994/02/11 21:35:00 aoki Exp");
   
  #include "access/att.h"
  #include "access/attnum.h"
diff -r -P -c src.orig/backend/utils/error/elog.c src/backend/utils/error/elog.c
*** src.orig/backend/utils/error/elog.c	Fri Apr  1 14:44:28 1994
--- src/backend/utils/error/elog.c	Fri Apr  8 13:56:13 1994
***************
*** 7,13 ****
--- 7,18 ----
  #include <time.h>
  #include <sys/file.h>
  #include <sys/types.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #include <stdarg.h>
+ #else
  #include <varargs.h>
+ #endif
  
  #include "tmp/postgres.h"
  #include "tmp/miscadmin.h"
***************
*** 61,72 ****
  
  /*VARARGS2*/
  void
  elog(va_alist)
  va_dcl
  {
- 	va_list ap;
  	register int	lev;
  	char		*fmt;
  	char		buf[ELOG_MAXLEN], line[ELOG_MAXLEN];
  	register char	*bp, *cp;
  	extern	int	errno, sys_nerr;
--- 66,82 ----
  
  /*VARARGS2*/
  void
+ #ifdef SVR4
+ elog(int lev, char *fmt, ...)
+ {
+ #else
  elog(va_alist)
  va_dcl
  {
  	register int	lev;
  	char		*fmt;
+ #endif
+ 	va_list ap;
  	char		buf[ELOG_MAXLEN], line[ELOG_MAXLEN];
  	register char	*bp, *cp;
  	extern	int	errno, sys_nerr;
***************
*** 78,86 ****
--- 88,100 ----
  	int		len;
  	int		i = 0;
  
+ #ifdef SVR4
+ 	va_start(ap, fmt);
+ #else
  	va_start(ap);
  	lev = va_arg(ap, int);
  	fmt = va_arg(ap, char *);
+ #endif
  	if (lev == DEBUG && Debugfile < 0) {
  		return;
  	}
***************
*** 169,174 ****
--- 183,193 ----
  	if (lev == WARN) {
  		ProcReleaseSpins(NULL);	/* get rid of spinlocks we hold */
  		kill(getpid(), 1);	/* abort to traffic cop */
+ #if defined(PORTNAME_sparc_solaris)
+ 		/* if we're running on an MP machine, we'd better
+ 		   wait for the signal */
+ 		pause();
+ #endif
  	}
  
  	if (lev == FATAL) {
diff -r -P -c src.orig/backend/utils/geo-decls.h src/backend/utils/geo-decls.h
*** src.orig/backend/utils/geo-decls.h	Fri Apr  1 14:44:14 1994
--- src/backend/utils/geo-decls.h	Fri Apr  8 13:56:13 1994
***************
*** 47,53 ****
   *	Handy things...
   *-------------------------------------------------------------------*/
  
! #ifdef sun
  extern char *sprintf();
  #endif sun
  
--- 47,53 ----
   *	Handy things...
   *-------------------------------------------------------------------*/
  
! #if defined(sun) && !defined(PORTNAME_sparc_solaris)
  extern char *sprintf();
  #endif sun
  
diff -r -P -c src.orig/backend/utils/init/magic.c src/backend/utils/init/magic.c
*** src.orig/backend/utils/init/magic.c	Fri Apr  1 14:44:31 1994
--- src/backend/utils/init/magic.c	Fri Apr  8 13:56:13 1994
***************
*** 10,15 ****
--- 10,18 ----
  
  #include <sys/file.h>
  #include <sys/types.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include <sys/stat.h>
  #include <ctype.h>
  #include <strings.h>
diff -r -P -c src.orig/backend/utils/init/miscinit.c src/backend/utils/init/miscinit.c
*** src.orig/backend/utils/init/miscinit.c	Fri Apr  1 14:44:31 1994
--- src/backend/utils/init/miscinit.c	Fri Apr  8 13:56:13 1994
***************
*** 21,26 ****
--- 21,29 ----
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  
  #include "tmp/postgres.h"
  
diff -r -P -c src.orig/backend/utils/log.h src/backend/utils/log.h
*** src.orig/backend/utils/log.h	Fri Apr  1 14:44:10 1994
--- src/backend/utils/log.h	Fri Apr  8 13:56:13 1994
***************
*** 55,61 ****
   * elog --
   *	Old error logging function.
   */
! extern void elog ARGS((int, ...));
  
  #endif /* !UFP */
  
--- 55,61 ----
   * elog --
   *	Old error logging function.
   */
! extern void elog ARGS((int, char *, ...));
  
  #endif /* !UFP */
  
diff -r -P -c src.orig/backend/utils/mmgr/aset.c src/backend/utils/mmgr/aset.c
*** src.orig/backend/utils/mmgr/aset.c	Fri Apr  1 14:44:32 1994
--- src/backend/utils/mmgr/aset.c	Fri Apr  8 13:56:13 1994
***************
*** 15,21 ****
--- 15,23 ----
  #include "utils/memutils.h"
  #include "utils/log.h"
  
+ #ifndef SVR4
  extern void bcopy();	/* XXX use header */
+ #endif
  
  #undef AllocSetReset
  #undef malloc
diff -r -P -c src.orig/backend/utils/mmgr/mcxt.c src/backend/utils/mmgr/mcxt.c
*** src.orig/backend/utils/mmgr/mcxt.c	Fri Apr  1 14:44:32 1994
--- src/backend/utils/mmgr/mcxt.c	Fri Apr  8 13:56:13 1994
***************
*** 22,28 ****
--- 22,30 ----
  
  #include "utils/palloc.h"
  
+ #ifndef SVR4
  extern void bcopy();	/* XXX use header */
+ #endif
  
  #undef MemoryContextAlloc
  #undef MemoryContextFree
diff -r -P -c src.orig/backend/utils/mmgr/pg_malloc.c src/backend/utils/mmgr/pg_malloc.c
*** src.orig/backend/utils/mmgr/pg_malloc.c	Fri Apr  1 14:44:33 1994
--- src/backend/utils/mmgr/pg_malloc.c	Fri Apr  8 13:56:14 1994
***************
*** 72,78 ****
--- 72,82 ----
   * Force all returned addresses to be on long boundaries.
   */
   
+ #if defined(PORTNAME_sparc_solaris)
+     size = MAXALIGN(size);
+ #else
      size = LONGALIGN(size);
+ #endif
  
  /*
   * GetNodeMemory returns NULL if size is not really a node size
diff -r -P -c src.orig/bin/Makefile.global src/bin/Makefile.global
*** src.orig/bin/Makefile.global	Fri Apr  1 14:40:13 1994
--- src/bin/Makefile.global	Fri Apr  8 13:56:14 1994
***************
*** 24,29 ****
--- 24,33 ----
  LDADD+= ${KRBLIBS}
  CFLAGS+= ${KRBFLAGS}
  .endif
+ .if (${PORTNAME} == "sparc_solaris")
+ LDADD+= -lsocket -lnsl -lm
+ .endif
+ 
  
  #
  # And all the shell scripts here get stuffed with the default
diff -r -P -c src.orig/bin/fsutils/icopy/icopy.c src/bin/fsutils/icopy/icopy.c
*** src.orig/bin/fsutils/icopy/icopy.c	Fri Apr  1 14:40:27 1994
--- src/bin/fsutils/icopy/icopy.c	Fri Apr  8 13:56:14 1994
***************
*** 6,11 ****
--- 6,14 ----
  
  #include <sys/types.h>
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  #include <sys/stat.h>
  #include <dirent.h>
  #include <stdio.h>
***************
*** 494,502 ****
--- 497,513 ----
  	    if (strcmp(entry->d_name, ".") == 0
  		|| strcmp(entry->d_name, "..") == 0)
  		continue;
+ #ifdef SVR4
+ 	{	int	len = entry->d_reclen-sizeof (struct dirent);
+ 	    newsrc = (char *) palloc(strlen(srcfname) + len + 2);
+ 	    sprintf(newsrc, "%s/%s", srcfname, entry->d_name);
+ 	    newdest = (char *) palloc(strlen(destfname) + len + 2);
+ 	}
+ #else
  	    newsrc = (char *) palloc(strlen(srcfname) + entry->d_namlen + 2);
  	    sprintf(newsrc, "%s/%s", srcfname, entry->d_name);
  	    newdest = (char *) palloc(strlen(destfname) + entry->d_namlen + 2);
+ #endif
  	    sprintf(newdest, "%s/%s", destfname, entry->d_name);
  	    tail->cl_next = build_inlist(newsrc, newdest);
  	    while (tail->cl_next != (COPYLIST *) NULL)
diff -r -P -c src.orig/bin/fsutils/pcat/pcat.c src/bin/fsutils/pcat/pcat.c
*** src.orig/bin/fsutils/pcat/pcat.c	Fri Apr  1 14:40:22 1994
--- src/bin/fsutils/pcat/pcat.c	Fri Apr  8 13:56:14 1994
***************
*** 1,5 ****
--- 1,8 ----
  #include <stdio.h>
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  
  #include "tmp/libpq-fs.h"
  
diff -r -P -c src.orig/bin/fsutils/pls/ls.c src/bin/fsutils/pls/ls.c
*** src.orig/bin/fsutils/pls/ls.c	Fri Apr  1 14:40:23 1994
--- src/bin/fsutils/pls/ls.c	Fri Apr  8 13:56:15 1994
***************
*** 48,63 ****
  static char sccsid[] = "@(#)ls.c	5.69 (Berkeley) 10/17/92";
  #endif /* not lint */
  
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>
  #include <dirent.h>
  #include <unistd.h>
  #include <fts.h>
  #include <string.h>
  #include <errno.h>
! #include <stdio.h>
! #ifdef PORTNAME_hpux
  #include <sys/termio.h>
  #endif /* PORTNAME_hpux */
  
--- 48,67 ----
  static char sccsid[] = "@(#)ls.c	5.69 (Berkeley) 10/17/92";
  #endif /* not lint */
  
+ #include <stdio.h>
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <sys/ioctl.h>
  #include <dirent.h>
  #include <unistd.h>
  #include <fts.h>
+ #ifdef SVR4
+ #include <strings.h>
+ #else
  #include <string.h>
+ #endif
  #include <errno.h>
! #if defined(PORTNAME_hpux) || defined(PORTNAME_sparc_solaris)
  #include <sys/termio.h>
  #endif /* PORTNAME_hpux */
  
diff -r -P -c src.orig/bin/fsutils/pmv/pmv.c src/bin/fsutils/pmv/pmv.c
*** src.orig/bin/fsutils/pmv/pmv.c	Fri Apr  1 14:40:25 1994
--- src/bin/fsutils/pmv/pmv.c	Fri Apr  8 13:56:15 1994
***************
*** 53,59 ****
--- 53,63 ----
  #include <unistd.h>
  #include <stdio.h>
  /*#include <stdlib.h>*/
+ #ifdef SVR4
+ #include <strings.h>
+ #else
  #include <string.h>
+ #endif
  #include "pathnames.h"
  #include "tmp/libpq-fs.h"
  
diff -r -P -c src.orig/bin/fsutils/prm/prm.c src/bin/fsutils/prm/prm.c
*** src.orig/bin/fsutils/prm/prm.c	Fri Apr  1 14:40:26 1994
--- src/bin/fsutils/prm/prm.c	Fri Apr  8 13:56:15 1994
***************
*** 5,11 ****
--- 5,15 ----
  #include <stdio.h>
  #include <sys/param.h>
  #include <sys/stat.h>
+ #ifdef SVR4
+ #include <dirent.h>
+ #else
  #include <sys/dir.h>
+ #endif
  #include <sys/file.h>
  #include <string.h>
  #include "tmp/libpq-fs.h"
diff -r -P -c src.orig/bin/ipcclean/Makefile src/bin/ipcclean/Makefile
*** src.orig/bin/ipcclean/Makefile	Fri Apr  1 14:40:16 1994
--- src/bin/ipcclean/Makefile	Fri Apr  8 13:56:15 1994
***************
*** 8,15 ****
  
  .if (${PORTNAME} == "ultrix4" || ${PORTNAME} == "hpux")
  IPCCLEANPATH=/bin:/usr/bin:/usr/ucb
! .elif (${PORTNAME} == "sparc" || ${PORTNAME} == "alpha" || ${PORTNAME} == "aix")
! IPCCLEANPATH=/bin:/sbin:/usr/ucb
  .endif
  
  SEDSCRIPT= -e "s^_fUnKy_IPCCLEANPATH_sTuFf_^${IPCCLEANPATH}^g"
--- 8,15 ----
  
  .if (${PORTNAME} == "ultrix4" || ${PORTNAME} == "hpux")
  IPCCLEANPATH=/bin:/usr/bin:/usr/ucb
! .elif (${PORTNAME} == "sparc" || ${PORTNAME} == "alpha" || ${PORTNAME} == "aix" || ${PORTNAME} == "sparc_solaris")
! IPCCLEANPATH=/bin:/sbin:/usr/ucb:/usr/local/sbin
  .endif
  
  SEDSCRIPT= -e "s^_fUnKy_IPCCLEANPATH_sTuFf_^${IPCCLEANPATH}^g"
diff -r -P -c src.orig/bin/ipcclean/sparc_solaris/ipcclean.sh src/bin/ipcclean/sparc_solaris/ipcclean.sh
*** src.orig/bin/ipcclean/sparc_solaris/ipcclean.sh	Wed Dec 31 16:00:00 1969
--- src/bin/ipcclean/sparc_solaris/ipcclean.sh	Sat Mar 26 10:41:22 1994
***************
*** 0 ****
--- 1,8 ----
+ #!/bin/sh
+ #
+ # /usr/local/devel/postgres-4.2-devel/src/bin/ipcclean/sparc/RCS/ipcclean.sh,v 1.3 1993/07/10 04:31:17 aoki Exp
+ #
+ PATH=_fUnKy_IPCCLEANPATH_sTuFf_:$PATH
+ export PATH
+ ipcs | egrep '^m .*|^s .*' | egrep "`whoami`|postgres|picasso" | \
+ awk '{printf "ipcrm -%s %s\n", $1, $2}' '-' | sh
diff -r -P -c src.orig/bin/monitor/monitor.c src/bin/monitor/monitor.c
*** src.orig/bin/monitor/monitor.c	Fri Apr  1 14:40:14 1994
--- src/bin/monitor/monitor.c	Fri Apr  8 13:56:15 1994
***************
*** 9,14 ****
--- 9,20 ----
  #include <strings.h>
  #include <sys/file.h>
  #include <sys/param.h>	/* for MAXHOSTNAMELEN */
+ #ifdef SVR4
+ #include <netdb.h>	/* for MAXHOSTNAMELEN */
+ #include <fcntl.h>
+ #include <unistd.h>
+ #define	L_INCR	SEEK_CUR
+ #endif
  #include <sys/types.h>
  #include <sys/uio.h>
  
diff -r -P -c src.orig/bin/pagedoc/pagedoc.c src/bin/pagedoc/pagedoc.c
*** src.orig/bin/pagedoc/pagedoc.c	Fri Apr  1 14:40:15 1994
--- src/bin/pagedoc/pagedoc.c	Fri Apr  8 13:56:15 1994
***************
*** 21,26 ****
--- 21,29 ----
  
  #include <stdio.h>
  #include <sys/file.h>
+ #ifdef SVR4
+ #include <fcntl.h>
+ #endif
  
  static char *RcsId = "/usr/local/devel/postgres-v4r2/src/bin/pagedoc/RCS/pagedoc.c,v 1.5 1993/06/13 23:10:14 mao Exp";
  
diff -r -P -c src.orig/bin/pg_ufp/Makefile src/bin/pg_ufp/Makefile
*** src.orig/bin/pg_ufp/Makefile	Fri Apr  1 14:40:28 1994
--- src/bin/pg_ufp/Makefile	Fri Apr  8 13:56:15 1994
***************
*** 22,28 ****
  # (minus the lex/yacc libraries).
  # Unfortunately, it must be sync'd by hand.
  #
! .if (${PORTNAME} == "ultrix4" || ${PORTNAME} == "sparc")
  LDADD+= -ldl
  .elif (${PORTNAME} == "alpha")
  # nothing
--- 22,29 ----
  # (minus the lex/yacc libraries).
  # Unfortunately, it must be sync'd by hand.
  #
! .if (${PORTNAME} == "ultrix4" || ${PORTNAME} == "sparc" || \
!       ${PORTNAME} == "sparc_solaris")
  LDADD+= -ldl
  .elif (${PORTNAME} == "alpha")
  # nothing
diff -r -P -c src.orig/libpq/fe-dumpdata.c src/libpq/fe-dumpdata.c
*** src.orig/libpq/fe-dumpdata.c	Fri Apr  1 14:40:05 1994
--- src/libpq/fe-dumpdata.c	Fri Apr  8 13:56:15 1994
***************
*** 82,88 ****
--- 82,92 ----
      for (i = 0; i < nfields; i++) {
  	/* If the field value is absent, do nothing. */
  	if (!(bmap & 0200))
+ #if defined(PORTNAME_sparc_solaris)
+ 	    values[i] = "";
+ #else
  	    values[i] = NULL;
+ #endif
  	else {
  	    /* Get the value length (the first four bytes are for length). */
  	    vlen = pq_getint(4) - 4;
diff -r -P -c src.orig/libpq/fe-pqstubs.c src/libpq/fe-pqstubs.c
*** src.orig/libpq/fe-pqstubs.c	Fri Apr  1 14:40:06 1994
--- src/libpq/fe-pqstubs.c	Fri Apr  8 13:56:16 1994
***************
*** 22,28 ****
--- 22,32 ----
  
  #include <stdio.h>
  #include <sys/types.h>
+ #ifdef SVR4
+ #include <stdarg.h>
+ #else
  #include <varargs.h>
+ #endif
  
  #include "tmp/c.h"
  #undef palloc
***************
*** 123,138 ****
   * ----------------
   */
  void
  elog(va_alist)
      va_dcl
  {
      va_list ap;
      int lev;
      char *fmt;
- 
      va_start(ap);
      lev = va_arg(ap, int);
      fmt = va_arg(ap, char *);
      va_end(ap);
      fprintf(stderr, "FATAL: error level %d: %s\n", lev, fmt);
      if (lev == FATAL)
--- 127,149 ----
   * ----------------
   */
  void
+ #ifdef SVR4
+ elog(int lev, char *fmt, ...)
+ {
+     va_list ap;
+     va_start(ap,fmt);
+ #else
  elog(va_alist)
      va_dcl
  {
      va_list ap;
      int lev;
      char *fmt;
      va_start(ap);
      lev = va_arg(ap, int);
      fmt = va_arg(ap, char *);
+ #endif
+ 
      va_end(ap);
      fprintf(stderr, "FATAL: error level %d: %s\n", lev, fmt);
      if (lev == FATAL)
diff -r -P -c src.orig/libpq/fe-pqufs.c src/libpq/fe-pqufs.c
*** src.orig/libpq/fe-pqufs.c	Fri Apr  1 14:40:05 1994
--- src/libpq/fe-pqufs.c	Fri Apr  8 15:01:25 1994
***************
*** 62,67 ****
--- 62,68 ----
   * as queries.
   */
  
+ #include <strings.h>
  #include "tmp/simplelists.h"
  #include "tmp/libpq.h"
  #include "tmp/libpq-fe.h"
diff -r -P -c src.orig/regress/Makefile.global src/regress/Makefile.global
*** src.orig/regress/Makefile.global	Fri Apr  1 23:56:16 1994
--- src/regress/Makefile.global	Fri Apr  8 15:55:38 1994
***************
*** 17,22 ****
--- 17,29 ----
  .SUFFIXES: ${SLSUFF}
  .o${SLSUFF}:
  	${LD} -dc -dp -Bdynamic -o ${.TARGET} ${.ALLSRC}
+ .elif (${PORTNAME} == "sparc_solaris")
+ CFLAGS+= -shared
+ SLSUFF=.so
+ .SUFFIXES: ${SLSUFF}
+ LDADD+= -lsocket -lnsl
+ .o${SLSUFF}:
+ 	${CC} -shared -o ${.TARGET} ${.ALLSRC}
  .elif (${PORTNAME} == "alpha")
  SLSUFF=.so
  .SUFFIXES: ${SLSUFF}
diff -r -P -c src.orig/tools/bmake/Bootstrap src/tools/bmake/Bootstrap
*** src.orig/tools/bmake/Bootstrap	Fri Apr  1 14:45:20 1994
--- src/tools/bmake/Bootstrap	Fri Apr  8 18:52:31 1994
***************
*** 70,79 ****
  s/^MORELIBS=.*/MORELIBS=/
  EOF
  		;;
  	ultrix4)
  		cat > $SEDFILE << 'EOF'
  s/^PORTNAME=.*/PORTNAME=ultrix4/
! s/^OLD_CC=.*/OLD_CC=-Dvoid="char *" -Dconst=/
  s/^AR_TYPE=.*/AR_TYPE=-DUSE_RANLIB/
  s/^NEED_STRINGS=.*/NEED_STRINGS=/
  s/^BSD_WAIT3.*=/BSD_WAIT3=/
--- 70,99 ----
  s/^MORELIBS=.*/MORELIBS=/
  EOF
  		;;
+ 	sparc_solaris)
+ 		cat > $SEDFILE << 'EOF'
+ s/^PORTNAME=.*/PORTNAME=sparc_solaris/
+ s/^OLD_CC=.*/OLD_CC=-BSD -notraditional/
+ s/^AR_TYPE=.*/AR_TYPE=/
+ s/^NEED_STRINGS=.*/NEED_STRINGS=/
+ s/^BSD_WAIT3.*=/BSD_WAIT3=/
+ s/^MORESRCS=.*/MORESRCS=setenv.c/
+ s/^MOREOBJS=.*/MOREOBJS=setenv.o/
+ s/^MORELIBS=.*/MORELIBS=/
+ EOF
+ 		eval \
+ 		`grep "^TOOLSBINDIR" ../../Makefile.global|sed -e 's/ //g'`
+ 		eval \
+ 		`grep "^GCCBINDIR" ../../Makefile.global|sed -e 's/ //g'`
+ 		cat cc.solaris|sed -e "s,GCCBINDIR,$GCCBINDIR,g" \
+ 		> ${TOOLSBINDIR}/cc
+ 		chmod +x ${TOOLSBINDIR}/cc
+ 		PATH=${TOOLSBINDIR}:$PATH; export PATH
+ 		;;
  	ultrix4)
  		cat > $SEDFILE << 'EOF'
  s/^PORTNAME=.*/PORTNAME=ultrix4/
! s/^OLD_CC=.*/OLD_CC=-Dvoid="char *" -Dconst= /
  s/^AR_TYPE=.*/AR_TYPE=-DUSE_RANLIB/
  s/^NEED_STRINGS=.*/NEED_STRINGS=/
  s/^BSD_WAIT3.*=/BSD_WAIT3=/
diff -r -P -c src.orig/tools/bmake/Makefile src/tools/bmake/Makefile
*** src.orig/tools/bmake/Makefile	Fri Apr  1 14:45:13 1994
--- src/tools/bmake/Makefile	Fri Apr  8 13:56:16 1994
***************
*** 18,23 ****
--- 18,29 ----
  SRCS+= strerror.c setenv.c
  .endif
  
+ .if ( ${PORTNAME} == "sparc_solaris" )
+ CFLAGS+= -BSD -notraditional
+ SRCS+= setenv.c
+ LDADD+= -BSD
+ .endif
+ 
  .if ( ${PORTNAME} == "alpha" )
  CFLAGS+= -D_BSD
  LDADD+= -lbsd
Binary files src.orig/tools/bmake/arch.o and src/tools/bmake/arch.o differ
Binary files src.orig/tools/bmake/buf.o and src/tools/bmake/buf.o differ
diff -r -P -c src.orig/tools/bmake/cc.solaris src/tools/bmake/cc.solaris
*** src.orig/tools/bmake/cc.solaris	Wed Dec 31 16:00:00 1969
--- src/tools/bmake/cc.solaris	Fri Apr  8 18:51:30 1994
***************
*** 0 ****
--- 1,98 ----
+ #!/bin/sh
+ # /usr/local/bin/cc	Solaris 2.3	940408	SIO/ODF	fmd
+ # cc -- compile/link with gcc under Solaris 2.x
+ # Compilation environment is determined by environmental
+ # variable COMPILER_ENVIRONMENT (BSD or SYSV), or by -BSD or -SYSV
+ # command-line switches.
+ #
+ INCLUDES=
+ LIBS=
+ LIBDIRS=
+ FILES=
+ OPTIONS=
+ link=1
+ noRoption=0
+ trad=1
+ OutputFile=
+ 
+ while [ $# -gt 0 ]
+ do
+     case "$1" in
+     -c | -E | -M* | -S)
+ 	link=0
+ 	OPTIONS="${OPTIONS} $1"
+ 	shift
+ 	;;
+     -notraditional)
+ 	trad=0
+ 	shift
+ 	;;
+     -BSD)
+ 	COMPILER_ENVIRONMENT=BSD
+ 	shift
+ 	;;
+     -SYSV)
+ 	COMPILER_ENVIRONMENT=SYSV
+ 	shift
+ 	;;
+     -R*)
+ 	noRoption=1
+ 	OPTIONS="${OPTIONS} $1"
+ 	shift
+ 	;;
+     -I*)
+ 	INCLUDES="${INCLUDES} $1"
+ 	shift
+ 	;;
+     -L*)
+ 	LIBDIRS="${LIBDIRS} $1"
+ 	LIBS="${LIBS} $1"
+ 	shift
+ 	;;
+     -l*)
+ 	LIBS="${LIBS} $1"
+ 	shift
+ 	;;
+     -o)
+ 	OutputFile="$1 $2"
+ 	shift 2
+ 	;;
+     -*)
+ 	OPTIONS="${OPTIONS} $1"
+ 	shift
+ 	;;
+     *)
+ 	FILES="${FILES} $1"
+ 	shift
+ 	;;
+     esac
+ done
+ 
+ COMPILER_ENVIRONMENT=${COMPILER_ENVIRONMENT:-SYSV}
+ 
+ if [ $link -eq 1 ]; then
+     if [ ${COMPILER_ENVIRONMENT} = BSD ]; then
+ 	LIBS="${LIBS} -L/usr/ucblib -lucb -lsocket -lnsl -lelf -laio"
+ 	LIBDIRS="${LIBDIRS} -L/usr/ucblib"
+     fi
+     if [ ${noRoption} -eq 0 -a "${LIBDIRS}" != "" ]; then
+ 	LIBDIRS=`echo ${LIBDIRS}|sed -e 's/-L//g' -e 's/ /:/g'`
+ 	LIBS="-R${LIBDIRS}${LD_RUN_PATH+:$LD_RUN_PATH} ${LIBS}"
+     fi
+ fi
+ 
+ case "${COMPILER_ENVIRONMENT}" in
+ SYSV)
+     PATH=/usr/bin:GCCBINDIR:/usr/ucb:/usr/ccs/bin:; export PATH
+     ;;
+ BSD)
+     if [ $trad -eq 1 ]; then
+ 	OPTIONS="${OPTIONS} -traditional"
+     fi
+     INCLUDES="${INCLUDES} -I/usr/ucbinclude"
+     PATH=/usr/ucb:GCCBINDIR:/usr/bin:/usr/ccs/bin:; export PATH
+     ;;
+ esac
+ 
+ exec GCCBINDIR/gcc ${OPTIONS} ${INCLUDES} ${FILES} ${LIBS} ${OutputFile}
+ 
diff -r -P -c src.orig/tools/bmake/compat.c src/tools/bmake/compat.c
*** src.orig/tools/bmake/compat.c	Fri Apr  1 14:45:18 1994
--- src/tools/bmake/compat.c	Fri Apr  8 13:56:16 1994
***************
*** 277,285 ****
  	}
  	
  	if (stat > -1) {
! 	    if (WIFSTOPPED(reason)) {
  		status = reason.w_stopval;		/* stopped */
! 	    } else if (WIFEXITED(reason)) {
  		status = reason.w_retcode;		/* exited */
  		if (status != 0) {
  		    printf ("*** Error code %d", status);
--- 277,285 ----
  	}
  	
  	if (stat > -1) {
! 	    if (WIFSTOPPED(reason.w_status)) {
  		status = reason.w_stopval;		/* stopped */
! 	    } else if (WIFEXITED(reason.w_status)) {
  		status = reason.w_retcode;		/* exited */
  		if (status != 0) {
  		    printf ("*** Error code %d", status);
***************
*** 290,296 ****
  	    } 

! 	    if (!WIFEXITED(reason) || (status != 0)) {
  		if (errCheck) {
  		    gn->made = ERROR;
  		    if (keepgoing) {
--- 290,296 ----
  	    } 

! 	    if (!WIFEXITED(reason.w_status) || (status != 0)) {
  		if (errCheck) {
  		    gn->made = ERROR;
  		    if (keepgoing) {
diff -r -P -c src.orig/tools/bmake/dir.c src/tools/bmake/dir.c
*** src.orig/tools/bmake/dir.c	Fri Apr  1 14:45:18 1994
--- src/tools/bmake/dir.c	Fri Apr  8 13:56:16 1994
***************
*** 83,89 ****
--- 83,93 ----
  
  #include <stdio.h>
  #include <sys/types.h>
+ #ifdef SVR4
+ #include <sys/dirent.h>
+ #else
  #include <sys/dir.h>
+ #endif
  #include <sys/stat.h>
  #include "make.h"
  #include "hash.h"
***************
*** 1039,1045 ****
  		 * (0-inode slots just take up space), so we have to do
  		 * it ourselves.
  		 */
! 		if (dp->d_fileno == 0) {
  		    continue;
  		}
  #endif sun
--- 1043,1049 ----
  		 * (0-inode slots just take up space), so we have to do
  		 * it ourselves.
  		 */
! 		if (dp->d_ino == 0) {
  		    continue;
  		}
  #endif sun
diff -r -P -c src.orig/tools/bmake/job.c src/tools/bmake/job.c
*** src.orig/tools/bmake/job.c	Fri Apr  1 14:45:17 1994
--- src/tools/bmake/job.c	Fri Apr  8 13:56:16 1994
***************
*** 572,580 ****
  {
      Boolean 	  done;
  
!     if ((WIFEXITED(status) &&
  	  (((status.w_retcode != 0) && !(job->flags & JOB_IGNERR)))) ||
! 	(WIFSIGNALED(status) && (status.w_termsig != SIGCONT)))
      {
  	/*
  	 * If it exited non-zero and either we're doing things our
--- 572,580 ----
  {
      Boolean 	  done;
  
!     if ((WIFEXITED(status.w_status) &&
  	  (((status.w_retcode != 0) && !(job->flags & JOB_IGNERR)))) ||
! 	(WIFSIGNALED(status.w_status) && (status.w_termsig != SIGCONT)))
      {
  	/*
  	 * If it exited non-zero and either we're doing things our
***************
*** 604,610 ****
  	    fclose(job->cmdFILE);
  	}
  	done = TRUE;
!     } else if (WIFEXITED(status) && status.w_retcode != 0) {
  	/*
  	 * Deal with ignored errors in -B mode. We need to print a message
  	 * telling of the ignored error as well as setting status.w_status
--- 604,610 ----
  	    fclose(job->cmdFILE);
  	}
  	done = TRUE;
!     } else if (WIFEXITED(status.w_status) && status.w_retcode != 0) {
  	/*
  	 * Deal with ignored errors in -B mode. We need to print a message
  	 * telling of the ignored error as well as setting status.w_status
***************
*** 622,629 ****
      }
      
      if (done ||
! 	WIFSTOPPED(status) ||
! 	(WIFSIGNALED(status) && (status.w_termsig == SIGCONT)) ||
  	DEBUG(JOB))
      {
  	FILE	  *out;
--- 622,629 ----
      }
      
      if (done ||
! 	WIFSTOPPED(status.w_status) ||
! 	(WIFSIGNALED(status.w_status) && (status.w_termsig == SIGCONT)) ||
  	DEBUG(JOB))
      {
  	FILE	  *out;
***************
*** 639,645 ****
  	    out = stdout;
  	}
  
! 	if (WIFEXITED(status)) {
  	    if (status.w_retcode != 0) {
  		if (usePipes && job->node != lastNode) {
  		    fprintf (out, targFmt, job->node->name);
--- 639,645 ----
  	    out = stdout;
  	}
  
! 	if (WIFEXITED(status.w_status)) {
  	    if (status.w_retcode != 0) {
  		if (usePipes && job->node != lastNode) {
  		    fprintf (out, targFmt, job->node->name);
***************
*** 658,664 ****
  		}
  		fprintf (out, "*** Completed successfully\n");
  	    }
! 	} else if (WIFSTOPPED(status)) {
  	    if (usePipes && job->node != lastNode) {
  		fprintf (out, targFmt, job->node->name);
  		lastNode = job->node;
--- 658,664 ----
  		}
  		fprintf (out, "*** Completed successfully\n");
  	    }
! 	} else if (WIFSTOPPED(status.w_status)) {
  	    if (usePipes && job->node != lastNode) {
  		fprintf (out, targFmt, job->node->name);
  		lastNode = job->node;
***************
*** 1930,1936 ****
  	jnode = Lst_Find (jobs, (ClientData)pid, JobCmpPid);
  
  	if (jnode == NILLNODE) {
! 	    if (WIFSIGNALED(status) && (status.w_termsig == SIGCONT)) {
  		jnode = Lst_Find(stoppedJobs, (ClientData)pid, JobCmpPid);
  		if (jnode == NILLNODE) {
  		    Error("Resumed child (%d) not in table", pid);
--- 1930,1936 ----
  	jnode = Lst_Find (jobs, (ClientData)pid, JobCmpPid);
  
  	if (jnode == NILLNODE) {
! 	    if (WIFSIGNALED(status.w_status) && (status.w_termsig == SIGCONT)) {
  		jnode = Lst_Find(stoppedJobs, (ClientData)pid, JobCmpPid);
  		if (jnode == NILLNODE) {
  		    Error("Resumed child (%d) not in table", pid);