diff --git a/glib/Makefile.am b/glib/Makefile.am
old mode 100644
new mode 100755
index 95f46ff..885e7db
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -94,7 +94,7 @@ libpoppler_glib_la_LIBADD =				\
 	$(FONTCONFIG_LIBS)				\
 	$(cairo_libs)
 
-libpoppler_glib_la_LDFLAGS = -version-info 4:0:0
+libpoppler_glib_la_LDFLAGS = -version-info 4:0:0 @create_shared_lib@
 
 if BUILD_WITH_GDK
 noinst_PROGRAMS = test-poppler-glib
diff --git a/glib/demo/info.cc b/glib/demo/info.cc
old mode 100644
new mode 100755
index 4176158..574b0f5
--- a/glib/demo/info.cc
+++ b/glib/demo/info.cc
@@ -18,6 +18,7 @@
 
 #include <gtk/gtk.h>
 
+#include "config.h"
 #include "info.h"
 #include "utils.h"
 
@@ -25,14 +26,20 @@ static gchar *
 poppler_format_date (GTime utime)
 {
 	time_t time = (time_t) utime;
-	struct tm t;
 	char s[256];
 	const char *fmt_hack = "%c";
 	size_t len;
 
+#ifdef HAVE_LOCALTIME_R
+	struct tm t;
 	if (time == 0 || !localtime_r (&time, &t)) return NULL;
-
 	len = strftime (s, sizeof (s), fmt_hack, &t);
+#else
+	struct tm *t;
+	if (time == 0 || !(t = localtime (&time)) ) return NULL;
+	len = strftime (s, sizeof (s), fmt_hack, t);
+#endif
+
 	if (len == 0 || s[0] == '\0') return NULL;
 
 	return g_locale_to_utf8 (s, -1, NULL, NULL, NULL);
diff --git a/test/Makefile.am b/test/Makefile.am
old mode 100644
new mode 100755
index b721229..cfd3bc7
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -69,7 +69,7 @@ pdf_inspector_SOURCES =			\
 
 pdf_inspector_LDADD =					\
 	$(top_builddir)/poppler/libpoppler.la		\
-	$(top_builddir)/poppler/libpoppler-cairo.la	\
+	$(top_builddir)/glib/libpoppler-glib.la	\
 	$(CAIRO_LIBS)					\
 	$(FREETYPE_LIBS)				\
 	$(GTK_TEST_LIBS)
diff --git a/test/gtk-cairo-test.cc b/test/gtk-cairo-test.cc
old mode 100644
new mode 100755
index 2049d72..fc5ed0c
--- a/test/gtk-cairo-test.cc
+++ b/test/gtk-cairo-test.cc
@@ -15,9 +15,11 @@
 
 #include <math.h>
 #include <gdk/gdk.h>
+#ifndef X_DISPLAY_MISSING
 #include <gdk/gdkx.h>
 #include <cairo-xlib.h>
 #include <X11/Xutil.h>
+#endif
 #include <gtk/gtk.h>
 #include <poppler.h>
 
diff --git a/test/pdf-inspector.cc b/test/pdf-inspector.cc
old mode 100644
new mode 100755
index 811adfe..6dbfb30
--- a/test/pdf-inspector.cc
+++ b/test/pdf-inspector.cc
@@ -23,10 +23,14 @@
 #include "GfxState.h"
 
 #include <gdk/gdk.h>
+#ifndef X_DISPLAY_MISSING
 #include <gdk/gdkx.h>
+#endif
 #include "CairoOutputDev.h"
+#ifndef X_DISPLAY_MISSING
 #include <cairo-xlib.h>
 #include <X11/Xutil.h>
+#endif
 
 #include "PDFDoc.h"
 #include "GlobalParams.h"
