diff -Npur libspnav-0.2.2.orig/Makefile.in libspnav-0.2.2/Makefile.in
--- libspnav-0.2.2.orig/Makefile.in	2012-01-31 22:34:01.448356249 +0100
+++ libspnav-0.2.2/Makefile.in	2012-01-31 22:39:20.229350669 +0100
@@ -7,7 +7,8 @@ lib_so = $(soname).1
 
 CC = gcc
 AR = ar
-CFLAGS = $(opt) $(dbg) -std=c89 -fpic -pedantic -Wall -fno-strict-aliasing -I.
+CFLAGS = $(opt) -fpic -I.
+LDFLAGS = $(ldopt) -shared -Wl,-soname,$(soname)
 
 .PHONY: all
 all: $(lib_a) $(lib_so)
@@ -16,7 +17,7 @@ $(lib_a): $(obj)
 	$(AR) rcs $@ $(obj)
 
 $(lib_so): $(obj)
-	$(CC) -shared -Wl,-soname,$(soname) -o $@ $(obj)
+	$(CC) $(LDFLAGS) -o $@ $(obj)
 
 %.o: $(srcdir)/%.c
 	$(CC) $(CFLAGS) -c $< -o $@
diff -Npur libspnav-0.2.2.orig/configure libspnav-0.2.2/configure
--- libspnav-0.2.2.orig/configure	2012-01-31 22:34:01.448356249 +0100
+++ libspnav-0.2.2/configure	2012-01-31 22:34:39.703355615 +0100
@@ -4,6 +4,7 @@ echo 'configuring spacenav library...'
 
 PREFIX=/usr/local
 OPT=yes
+LDOPT=yes
 DBG=yes
 X11=yes
 
@@ -26,6 +27,11 @@ for arg; do
 	--disable-opt)
 		OPT=no;;
 
+	--enable-ldopt)
+		LDOPT=yes;;
+	--disable-ldopt)
+		LDOPT=no;;
+
 	--enable-debug)
 		DBG=yes;;
 	--disable-debug)
@@ -44,6 +50,8 @@ for arg; do
 		echo '  --disable-x11: disable X11 communication mode'
 		echo '  --enable-opt: enable speed optimizations (default)'
 		echo '  --disable-opt: disable speed optimizations'
+		echo '  --enable-ldopt: enable link optimizations (default)'
+		echo '  --disable-ldopt: disable link optimizations'
 		echo '  --enable-debug: include debugging symbols (default)'
 		echo '  --disable-debug: do not include debugging symbols'
 		echo 'all invalid options are silently ignored'
@@ -54,6 +62,7 @@ done
 
 echo "  prefix: $PREFIX"
 echo "  optimize for speed: $OPT"
+echo "  optimize link: $LDOPT"
 echo "  include debugging symbols: $DBG"
 echo "  x11 communication method: $X11"
 echo ""
@@ -74,7 +83,11 @@ if [ "$DBG" = 'yes' ]; then
 fi
 
 if [ "$OPT" = 'yes' ]; then
-	echo 'opt = -O3' >>Makefile
+	echo "opt = ${CFLAGS:--O3}" >>Makefile
+fi
+
+if [ "$LDOPT" = 'yes' ]; then
+	echo "ldopt = ${LDFLAGS}" >>Makefile
 fi
 
 if [ "$X11" = 'yes' ]; then
