--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -109,6 +109,10 @@ endif
 
 endif # aix
 
+ifeq ($(shell dpkg-architecture -qDEB_HOST_ARCH_OS), hurd)
+LIBS += -pthread
+endif # hurd
+
 # Update the commonly used headers before building the subdirectories
 $(SUBDIRS:%=%-recursive): | generated-headers
 
--- a/src/template/linux
+++ b/src/template/linux
@@ -28,3 +28,10 @@ if test "$SUN_STUDIO_CC" = "yes" ; then
     ;;
   esac
 fi
+
+# force use of POSIX instead of SysV semaphores on hurd-i386
+case $(dpkg-architecture -qDEB_HOST_ARCH) in
+	hurd*)
+		USE_UNNAMED_POSIX_SEMAPHORES=1
+		;;
+esac
