diff -Nur postgresql-8.2/build-tree/postgresql-8.2.3/src/include/storage/s_lock.h postgresql-8.2.new/build-tree/postgresql-8.2.3/src/include/storage/s_lock.h
--- postgresql-8.2.3/src/include/storage/s_lock.h	2006-06-08 00:24:45.000000000 +0200
+++ postgresql-8.2.3/src/include/storage/s_lock.h	2007-04-14 20:50:07.000000000 +0200
@@ -566,6 +566,15 @@
 #endif
 
 
+#if defined(__m32r__)
+#include <sys/tas.h>
+#define HAS_TEST_AND_SET
+
+typedef int slock_t;
+#define TAS(lock) tas(lock)
+
+#endif
+
 #endif	/* __GNUC__ */
 
 
