--- gpsd-2.95.orig/Makefile.in	2010-07-14 00:48:24.000000000 +0200
+++ gpsd-2.95/Makefile.in	2011-01-15 19:56:22.000000000 +0100
@@ -612,8 +612,8 @@ libgps_la_SOURCES = $(libgps_c_sources) 
 libgpsd_la_SOURCES = $(libgpsd_c_sources) $(libgpsd_h_sources) \
 				driver_rtcm2.h packet_states.h
 
-@LIBGPSMM_ENABLE_FALSE@libgps_la_LINK = /bin/sh ./libtool --tag=CC --mode=link gcc $(libgps_la_LDFLAGS) -o $@
-@LIBGPSMM_ENABLE_TRUE@libgps_la_LINK = /bin/sh ./libtool --tag=CXX --mode=link g++ $(libgps_la_LDFLAGS) -o $@
+@LIBGPSMM_ENABLE_FALSE@libgps_la_LINK = $(SHELL) ./libtool --tag=CC --mode=link gcc $(libgps_la_LDFLAGS) -o $@
+@LIBGPSMM_ENABLE_TRUE@libgps_la_LINK = $(SHELL) ./libtool --tag=CXX --mode=link g++ $(libgps_la_LDFLAGS) -o $@
 nodist_libgpsd_la_SOURCES = packet_names.h ais_json.i
 libgps_la_LIBADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(LIBPTHREAD)
 libgpsd_la_LIBADD = $(LIBM) $(LIBC) $(LIBNSL) $(LIBSOCKET) $(LIBPTHREAD) $(BLUEZ_LIBS) libgps.la
@@ -996,7 +996,7 @@ clean-libLTLIBRARIES:
 	  rm -f "$${dir}/so_locations"; \
 	done
 libgps.la: $(libgps_la_OBJECTS) $(libgps_la_DEPENDENCIES) 
-	$(libgps_la_LINK) -rpath $(libdir) $(libgps_la_OBJECTS) $(libgps_la_LIBADD) $(LIBS)
+	$(libgps_la_LINK) -rpath $(libdir) $(libgps_la_OBJECTS) $(libgps_la_LIBADD) $(LDFLAGS) $(LIBS)
 libgpsd.la: $(libgpsd_la_OBJECTS) $(libgpsd_la_DEPENDENCIES) 
 	$(LINK) -rpath $(libdir) $(libgpsd_la_OBJECTS) $(libgpsd_la_LIBADD) $(LIBS)
 install-binPROGRAMS: $(bin_PROGRAMS)
