diff --git a/configure.in b/configure.in
index ec147bd..b7c5af1 100644
--- a/configure.in
+++ b/configure.in
@@ -412,7 +412,9 @@ fi
 ### Check size of long_long - some guile's are broken.
 AC_MSG_CHECKING(if guile long_long is at least as big as gint64)
 GNC_OLDCFLAGS="$CFLAGS"
-CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
+GNC_OLDLDFLAGS="$LDFLAGS"
+CFLAGS="${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
+LDFLAGS="${LDFLAGS} ${GLIB_LIBS}"
 AC_TRY_RUN([
   #include <glib.h>
   #include <libguile/__scm.h>
@@ -433,6 +435,7 @@ AC_TRY_RUN([
 	       sizeof(gint64)))
 ])
 CFLAGS="$GNC_OLDCFLAGS"
+LDFLAGS="$GNC_OLDLDFLAGS"
 
 # One of the places this is critical is in gnc_scm_to_gint64 and inverse.
 # However, I'm sure we require this elsewhere, so don't remove this test
