Description: disable USE_SYSCALL_FUTEX on architectures other than x86/x64
 USE_SYSCALL_FUTEX seems to enable x86/x64 specific assembler
 With USE_SYSCALL_FUTEX disabled we also need to link in the pthread
 library
Author: Peter Green <plugwash@p10link.net>
Bug-Debian: http://bugs.debian.org/653040


Index: stud-0.3.new/Makefile
===================================================================
--- stud-0.3.new.orig/Makefile	2011-12-22 23:48:09.000000000 +0000
+++ stud-0.3.new/Makefile	2011-12-23 00:17:44.000000000 +0000
@@ -15,10 +15,24 @@
 
 # Shared cache feature
 ifneq ($(USE_SHARED_CACHE),)
-CFLAGS += -DUSE_SHARED_CACHE -DUSE_SYSCALL_FUTEX
+CFLAGS += -DUSE_SHARED_CACHE 
 OBJS   += shctx.o ebtree/libebtree.a
 ALL    += ebtree
 
+DEB_HOST_ARCH ?=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+#USE_SYSCALL_FUTEX depends on x86/x64 specific assembler code
+#and afaict FUTEXes are linux-specific
+ifeq ($(DEB_HOST_ARCH),i386)
+CFLAGS += -DUSE_SYSCALL_FUTEX
+else
+ifeq ($(DEB_HOST_ARCH),amd64)
+CFLAGS += -DUSE_SYSCALL_FUTEX
+else
+#we are on neither i396 or amd64, we need to link the pthread library
+LDFLAGS += -lpthread
+endif
+endif
+
 ebtree/libebtree.a: $(wildcard ebtree/*.c)
 	make -C ebtree
 ebtree:
