--- configure.in.orig	2008-10-07 16:19:16.156281000 +0800
+++ configure.in	2008-10-08 10:02:40.137567000 +0800
@@ -413,7 +413,9 @@
 ### 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"
+GNC_OLDLDFLAGS="$LDFLAGS"
 CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
+LDFLAGS="${LDFLAGS} ${GLIB_LIBS}"
 AC_TRY_RUN([
   #include <glib.h>
   #include <libguile/__scm.h>
@@ -434,13 +436,16 @@
 	       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
 # unless you've done sufficient code review/testing.
 AC_MSG_CHECKING(if unsigned long is at least as big as guint32)
 GNC_OLDCFLAGS="$CFLAGS"
+GNC_OLDLDFLAGS="$LDFLAGS"
 CFLAGS="${GNOME_CFLAGS} ${GUILE_INCS} ${CFLAGS} ${GLIB_CFLAGS}"
+LDFLAGS="${LDFLAGS} ${GLIB_LIBS}"
 AC_TRY_RUN([
   #include <glib.h>
   int main(int argc, char *argv[]) {
@@ -455,6 +460,7 @@
   AC_MSG_RESULT(assuming yes)
 ])
 CFLAGS="$GNC_OLDCFLAGS"
+LDFLAGS="$GNC_OLDLDFLAGS"
 
 
 ### --------------------------------------------------------------------------
