diff --git a/src/include/libpq/pqcomm.h b/src/include/libpq/pqcomm.h
index 98d4ad0350333b73c1e36f34fdf30f220db0f7f5..a9bb120552d7b58e32bcaf26be278ce1bf2bd15b 100644
--- a/src/include/libpq/pqcomm.h
+++ b/src/include/libpq/pqcomm.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pqcomm.h,v 1.26 1998/07/09 03:29:01 scrappy Exp $
+ * $Id: pqcomm.h,v 1.27 1998/08/22 04:24:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -34,9 +34,14 @@ typedef union SockAddr
 
 /* Configure the UNIX socket address for the well known port. */
 
+#if defined(SUN_LEN)
+#define UNIXSOCK_PATH(sun,port) \
+ 	(sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)), SUN_LEN(&(sun)))
+#else
 #define UNIXSOCK_PATH(sun,port) \
  	(sprintf((sun).sun_path, "/tmp/.s.PGSQL.%d", (port)), \
  	 strlen((sun).sun_path)+ offsetof(struct sockaddr_un, sun_path))
+#endif
 
 /*
  *		We do this because sun_len is in BSD's struct, while others don't.
diff --git a/src/include/port/unixware.h b/src/include/port/unixware.h
index e552202f5f97d28be07f353103a632e6de978b48..c52b9b0948dc8f9e86b3a71350759ea1f519c5fc 100644
--- a/src/include/port/unixware.h
+++ b/src/include/port/unixware.h
@@ -5,13 +5,17 @@
 
 #define HAS_TEST_AND_SET
 #define NEED_I386_TAS_ASM
+
 /***************************************
  * Define this if you are compiling with
  * the native UNIXWARE C compiler.
  ***************************************/
-#define UNIXWARE
+#define USE_UNIVEL_CC
+
 typedef unsigned char slock_t;
 
+#define DISABLE_COMPLEX_MACRO
+
 /***************************************************************
  * The following include will get the needed prototype for the 
  * strcasecmp() function. 
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index c48153deef6a4d8739fd9ce3616e83fe44cd4a62..37eb40a2bf7a94c21a9cffda14c843e858039ac1 100644
--- a/src/include/storage/s_lock.h
+++ b/src/include/storage/s_lock.h
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.43 1998/07/20 17:45:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.44 1998/08/22 04:24:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -188,7 +188,7 @@ tas(volatile slock_t *lock)
 #if defined(NEED_I386_TAS_ASM)
 /* non gcc i386 based things */
 
-#if defined(USE_UNIVEL_CC) || defined(UNIXWARE)
+#if defined(USE_UNIVEL_CC)
 #define TAS(lock)	tas(lock)
 
 asm int 
@@ -203,7 +203,7 @@ tas(slock_t *s_lock)
 	popl	%ebx
 }
 
-#endif /* USE_UNIVEL_CC || UNIXWARE */
+#endif /* USE_UNIVEL_CC */
 
 #endif /* NEED_I386_TAS_ASM */
 
diff --git a/src/interfaces/libpgtcl/Makefile.in b/src/interfaces/libpgtcl/Makefile.in
index 2823aeade13f6db8303c5a410741e2117d3ae107..705ff0b9e5744f771e958c4dd74720516157a22f 100644
--- a/src/interfaces/libpgtcl/Makefile.in
+++ b/src/interfaces/libpgtcl/Makefile.in
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.19 1998/07/12 18:48:05 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.20 1998/08/22 04:24:26 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -66,6 +66,13 @@ ifeq ($(PORTNAME), solaris)
   CFLAGS		+= $(CFLAGS_SL)
 endif
 
+ifeq ($(PORTNAME), unixware)
+  install-shlib-dep	:= install-shlib
+  shlib			:= libpgtcl.so.1
+  LDFLAGS_SL		= -G -z text
+  CFLAGS		+= $(CFLAGS_SL)
+endif
+
 ifeq ($(PORTNAME), univel)
   install-shlib-dep	:= install-shlib
   shlib			:= libpgtcl.so.1
diff --git a/src/interfaces/libpq++/Makefile b/src/interfaces/libpq++/Makefile
index fb619a90d3124edb078791104de1e636aa100e5d..9ccbe946578b6d4943fd781b8aa8a2f0aacb6f4e 100644
--- a/src/interfaces/libpq++/Makefile
+++ b/src/interfaces/libpq++/Makefile
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.19 1998/07/12 19:20:45 momjian Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/libpq++/Attic/Makefile,v 1.20 1998/08/22 04:24:35 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -56,6 +56,20 @@ ifeq ($(PORTNAME), solaris)
   CFLAGS += $(CFLAGS_SL)
 endif
 
+ifeq ($(PORTNAME), unixware)
+  install-shlib-dep := install-shlib
+  shlib := libpq.so.1
+  LDFLAGS_SL = -G -z text
+  CFLAGS += $(CFLAGS_SL)
+endif
+
+ifeq ($(PORTNAME), univel)
+  install-shlib-dep := install-shlib
+  shlib := libpq.so.1
+  LDFLAGS_SL = -G -z text
+  CFLAGS += $(CFLAGS_SL)
+endif
+
 ifeq ($(PORTNAME), hpux)
   install-shlib-dep := install-shlib
   shlib := libpq.sl
diff --git a/src/interfaces/libpq/Makefile.in b/src/interfaces/libpq/Makefile.in
index b13e7753c17317e20e2786930251806ddead1471..11c37624731d7fc67a1c207d49ca8348b8575fac 100644
--- a/src/interfaces/libpq/Makefile.in
+++ b/src/interfaces/libpq/Makefile.in
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.26 1998/08/17 03:50:29 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.27 1998/08/22 04:24:28 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -73,9 +73,16 @@ ifeq ($(PORTNAME), solaris)
   CFLAGS += $(CFLAGS_SL)
 endif
 
+ifeq ($(PORTNAME), unixware)
+  install-shlib-dep := install-shlib
+  shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+  LDFLAGS_SL = -G -z text
+  CFLAGS += $(CFLAGS_SL)
+endif
+
 ifeq ($(PORTNAME), univel)
   install-shlib-dep := install-shlib
-  shlib := libpq.so.1
+  shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
   LDFLAGS_SL = -G -z text
   CFLAGS += $(CFLAGS_SL)
 endif
diff --git a/src/template/unixware b/src/template/unixware
index d68d4aaa63a0ce298655c22328ea251fb7bc6985..a174807cb3775b11c910dc1dd415aaff2cde37e3 100644
--- a/src/template/unixware
+++ b/src/template/unixware
@@ -1,8 +1,9 @@
 AROPT:crs
 CFLAGS:-Xa -v -O -K i486,host,inline,loop_unroll,alloca -Dsvr4
 SHARED_LIB:-K PIC
-SRCH_INC:
-SRCH_LIB:
+SRCH_INC:/opt/include
+SRCH_LIB:/opt/lib
 USE_LOCALE:no
 DLSUFFIX:.so
 CC:cc
+YFLAGS:-d