--- a/ext/Makefile.ext.in
+++ b/ext/Makefile.ext.in
@@ -22,7 +22,7 @@
 LIBS         = $(XLIBS) @LIBS@
 CFLAGS       = @CFLAGS@ @SHLIB_SO_CFLAGS@ $(XCFLAGS)
 CPPFLAGS     = @CPPFLAGS@ $(XCPPFLAGS)
-LDFLAGS      = $(LOCAL_LFLAGS) $(XLDFLAGS) @SHLIB_SO_LDFLAGS@
+LDFLAGS      = $(LOCAL_LFLAGS) $(XLDFLAGS) @LDFLAGS@ @SHLIB_SO_LDFLAGS@
 BUILD_GOSH_FLAGS =
 
 # These are set by configure
