--- f-spot-0.1.11/configure.in	2006/07/22 10:21:02	1.1
+++ f-spot-0.1.11/configure.in	2006/07/22 10:42:14
@@ -116,22 +116,29 @@ AC_SUBST(EXIF_SOVERSION)
 
 dnl --- Set up paths
 
+PKG_CHECK_EXISTS(gnome-screensaver, have_gs_pkgconfig=yes, have_gs_pkgconfig=no)
 AC_ARG_WITH(gnome-screensaver,[ --with-gnome-screensaver=PREFIX  set gnome gnome-screensaver prefix])
 
-if test "x$with_gnome_screensaver" != "x"; then
-	gnome_screensaver_prefix=$with_gnome_screensaver
+if test "$have_gs_pkgconfig" = "yes"; then
+	gnome_screensaver_prefix=`$PKG_CONFIG --variable=prefix gnome-screensaver`
+	GNOME_SCREENSAVER_SAVERDIR=`$PKG_CONFIG --variable=privlibexecdir gnome-screensaver`
+	GNOME_SCREENSAVER_THEMESDIR=`$PKG_CONFIG --variable=themesdir gnome-screensaver`
 else
-	gnome_screensaver_prefix=$prefix		   
-fi
+	if test "x$with_gnome_screensaver" != "x"; then
+		gnome_screensaver_prefix=$with_gnome_screensaver
+	else
+		gnome_screensaver_prefix=$prefix
+	fi
+
+	if test -d $gnome_screensaver_prefix/lib/gnome-screensaver; then
+		GNOME_SCREENSAVER_SAVERDIR=$gnome_screensaver_prefix/lib/gnome-screensaver/gnome-screensaver
+	else 
+		GNOME_SCREENSAVER_SAVERDIR=$gnome_screensaver_prefix/libexec/gnome-screensaver
+	fi
 
-if test -d $gnome_screensaver_prefix/lib/gnome-screensaver; then
-	GNOME_SCREENSAVER_SAVERDIR=$gnome_screensaver_prefix/lib/gnome-screensaver/gnome-screensaver
-else 
-	GNOME_SCREENSAVER_SAVERDIR=$gnome_screensaver_prefix/libexec/gnome-screensaver
+	GNOME_SCREENSAVER_THEMESDIR=$gnome_screensaver_prefix/share/gnome-screensaver/themes
 fi
 
-GNOME_SCREENSAVER_THEMESDIR=$gnome_screensaver_prefix/share/gnome-screensaver/themes
-
 AC_SUBST(GNOME_SCREENSAVER_SAVERDIR)
 AC_SUBST(GNOME_SCREENSAVER_THEMESDIR)
 
