diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 452a5a0af894e3b2d6ae8a086e710678e78a60e4..39640b9193b90dc1dc54f49a58171da10cf32a8e 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -7,7 +7,7 @@
 #
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.33 1998/01/27 03:24:51 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.34 1998/02/13 05:09:12 scrappy Exp $
 #
 # NOTES
 #    Essentially all Postgres make files include this file and use the 
@@ -48,6 +48,11 @@
 # compiling to a.out (which means you're using the dld dynamic loading 
 # library), set LINUX_ELF to null in Makefile.custom.
 LINUX_ELF= true
+#
+# Ignore BSD_SHLIB if you're not using one of the BSD ports.  But if you
+# are, and it's one that doesn't have shared libraries (NetBSD/vax is an
+# example of this), set BSD_SHLIB to null in Makefile.custom.
+BSD_SHLIB= true
 
 LIBPQDIR:= $(SRCDIR)/interfaces/libpq
 
diff --git a/src/backend/parser/scan.c b/src/backend/parser/scan.c
index 74f72609fcb8a3e842bd2dc8f9ad97f5c34aa0df..5480abd55515b413acb4de7c43a685e2cf30add8 100644
--- a/src/backend/parser/scan.c
+++ b/src/backend/parser/scan.c
@@ -1,7 +1,7 @@
 /* A lexical scanner generated by flex */
 
 /* Scanner skeleton version:
- * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.12 1998/02/11 03:56:08 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.13 1998/02/13 05:09:15 scrappy Exp $
  */
 
 #define FLEX_SCANNER
@@ -539,7 +539,7 @@ char *yytext;
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.12 1998/02/11 03:56:08 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.13 1998/02/13 05:09:15 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
diff --git a/src/backend/port/dynloader/bsd.c b/src/backend/port/dynloader/bsd.c
index b1c0c3d1d3c39f87b1b20fe2a4c442b5ae105053..8c9f680a812a5d519a024d674961dd5b941e7b0f 100644
--- a/src/backend/port/dynloader/bsd.c
+++ b/src/backend/port/dynloader/bsd.c
@@ -61,7 +61,7 @@ BSD44_derived_dlerror(void)
 void	   *
 BSD44_derived_dlopen(const char *file, int num)
 {
-#ifdef __mips__
+#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
 	sprintf(error_message, "dlopen (%s) not supported", file);
 	return NULL;
 #else
@@ -78,7 +78,7 @@ BSD44_derived_dlopen(const char *file, int num)
 void	   *
 BSD44_derived_dlsym(void *handle, const char *name)
 {
-#ifdef __mips__
+#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
 	sprintf(error_message, "dlsym (%s) failed", name);
 	return NULL;
 #else
@@ -101,7 +101,8 @@ BSD44_derived_dlsym(void *handle, const char *name)
 void
 BSD44_derived_dlclose(void *handle)
 {
-#ifndef __mips__
+#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
+#else
 	dlclose(handle);
 #endif
 }
diff --git a/src/include/port/bsd.h b/src/include/port/bsd.h
index 12787118aea2448e7a3dc80b050935d612f810ea..f64ea094563656179a242e3315d4e3be140df0ce 100644
--- a/src/include/port/bsd.h
+++ b/src/include/port/bsd.h
@@ -10,6 +10,11 @@
 #define HAS_TEST_AND_SET
 #endif
 
+#if defined(vax)
+#define NEED_VAX_TAS_ASM
+#define HAS_TEST_AND_SET
+#endif
+
 #if defined(ns32k)
 #define NEED_NS32k_TAS_ASM
 #define HAS_TEST_AND_SET
diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h
index 68f93a1a045ed887373d37a81c146079472a8b7f..455329dce0dc4371f770dad04c3a97756bc89450 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.24 1998/02/05 03:31:01 scrappy Exp $
+ *	  $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.25 1998/02/13 05:09:50 scrappy Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -287,6 +287,18 @@ tas_dummy()
 
 #endif							/* NEED_SPARC_TAS_ASM */
 
+/*
+ * VAXen -- even multiprocessor ones
+ */
+
+#if defined(NEED_VAX_TAS_ASM)
+
+#define S_LOCK(addr)		__asm__("1: bbssi $0,(%0),1b": :"r"(addr))
+#define S_UNLOCK(addr)		(*(addr) = 0)
+#define S_INIT_LOCK(addr)	(*(addr) = 0)
+
+#endif							/* NEED_VAX_TAS_ASM */
+
 /*
  * i386 based things
  */
diff --git a/src/interfaces/libpgtcl/Makefile.in b/src/interfaces/libpgtcl/Makefile.in
index 0552736518bc6579540a98d27daf70929f85fe58..0905a8a7227b8c5027a4fc5dcb32ac48aad93632 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.2 1998/01/17 23:33:32 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/Makefile.in,v 1.3 1998/02/13 05:09:57 scrappy Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -42,10 +42,12 @@ ifeq ($(PORTNAME), linux)
 endif
 
 ifeq ($(PORTNAME), bsd)
-  install-shlib-dep	:= install-shlib
-  shlib			:= libpgtcl.so.1.0
-  LDFLAGS_SL		= -x -Bshareable -Bforcearchive
-  CFLAGS		+= $(CFLAGS_SL)
+  ifdef BSD_SHLIB
+    install-shlib-dep	:= install-shlib
+    shlib		:= libpgtcl.so.1.0
+    LDFLAGS_SL		= -x -Bshareable -Bforcearchive
+    CFLAGS		+= $(CFLAGS_SL)
+  endif
 endif
 
 ifeq ($(PORTNAME), i386_solaris)
diff --git a/src/interfaces/libpq/Makefile.in b/src/interfaces/libpq/Makefile.in
index 5f9c26d2db632346d141321cc9856cfa660f2664..6eeca467fea595a85a94b60fc2682a6158f9ac9f 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.5 1998/01/26 01:42:24 scrappy Exp $
+#    $Header: /cvsroot/pgsql/src/interfaces/libpq/Attic/Makefile.in,v 1.6 1998/02/13 05:10:06 scrappy Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -43,10 +43,12 @@ ifeq ($(PORTNAME), linux)
   endif
 endif
 ifeq ($(PORTNAME), bsd)
-  install-shlib-dep := install-shlib
-  shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
-  LDFLAGS_SL = -x -Bshareable -Bforcearchive
-  CFLAGS += $(CFLAGS_SL)
+  ifdef BSD_SHLIB
+    install-shlib-dep := install-shlib
+    shlib := libpq.so.$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+    LDFLAGS_SL = -x -Bshareable -Bforcearchive
+    CFLAGS += $(CFLAGS_SL)
+  endif
 endif
 ifeq ($(PORTNAME), i386_solaris)
   install-shlib-dep := install-shlib