diff -ruN postgresql-7.4.13-old/src/include/port/linux.h postgresql-7.4.13/src/include/port/linux.h
--- postgresql-7.4.13-old/src/include/port/linux.h	2003-10-26 01:41:10.000000000 +0000
+++ postgresql-7.4.13/src/include/port/linux.h	2004-01-05 14:16:42.000000000 +0000
@@ -48,4 +48,12 @@
 
 #define HAS_TEST_AND_SET
 
+#elif defined(__hppa__)
+typedef struct
+{
+	int			sema[4];
+} slock_t;
+
+#define HAS_TEST_AND_SET
+
 #endif
diff -ruN postgresql-7.4.13-old/src/include/storage/s_lock.h postgresql-7.4.13/src/include/storage/s_lock.h
--- postgresql-7.4.13-old/src/include/storage/s_lock.h	2003-11-04 09:43:56.000000000 +0000
+++ postgresql-7.4.13/src/include/storage/s_lock.h	2004-01-05 22:51:50.000000000 +0000
@@ -151,6 +151,29 @@
 
 #endif	 /* __arm__ */
 
+#if defined(__hppa__)
+/*
+ *  * HP PA-RISC Linux
+ *   */
+#define TAS(lock)          tas(lock)
+#define TAS_ACTIVE_WORD(lock)   ((volatile int *) (((long) (lock) + 15) & ~15))
+#define S_UNLOCK(lock)  (*TAS_ACTIVE_WORD(lock) = -1)
+                                                                                
+static __inline__ int
+tas(volatile slock_t *lock)
+{
+	        volatile int *lockword = TAS_ACTIVE_WORD(lock);
+		        register int lockval;
+			                                                                                
+			        __asm__ __volatile__(
+						                "       ldcwx   0(0,%2),%0      \n"
+								:               "=r"(lockval), "=m"(*lockword)
+								:               "r"(lockword));
+				        return (lockval == 0);
+}
+                                                                                
+#endif   /* __hppa__ */
+                                                                                
 
 #if defined(__s390__) && !defined(__s390x__)
 /*
