configure.in: Improve checking for libstatgrab using pkg-config.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 16 Feb 2009 12:08:06 +0000 (13:08 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Mon, 16 Feb 2009 12:08:06 +0000 (13:08 +0100)
configure.in

index 2b4ab73..9a467d8 100644 (file)
@@ -2285,41 +2285,43 @@ with_libstatgrab_cflags=""
 with_libstatgrab_ldflags=""
 AC_ARG_WITH(libstatgrab, [AS_HELP_STRING([--with-libstatgrab@<:@=PREFIX@:>@], [Path to libstatgrab.])],
 [
-       if test "x$withval" != "xno" \
-               && test "x$withval" != "xyes"
-       then
-               with_libstatgrab_cflags="-I$withval/include"
-               with_libstatgrab_ldflags="-L$withval/lib"
-               with_libstatgrab="yes"
-       else
-               with_libstatgrab="$withval"
-       fi
-],
+ if test "x$withval" != "xno" \
+   && test "x$withval" != "xyes"
+ then
+   with_libstatgrab_cflags="-I$withval/include"
+   with_libstatgrab_ldflags="-L$withval/lib -lstatgrab"
+   with_libstatgrab="yes"
+   with_libstatgrab_pkg_config="no"
+ else
+   with_libstatgrab="$withval"
+   with_libstatgrab_pkg_config="yes"
+ fi
+ ],
 [
-       if test "x$ac_system" = "xunknown"
-       then
-               with_libstatgrab="yes"
-       else
-               with_libstatgrab="no"
-       fi
+ with_libstatgrab="yes"
+ with_libstatgrab_pkg_config="yes"
 ])
-with_libstatgrab_pkg_config="yes"
+
 if test "x$with_libstatgrab" = "xyes" \
-  && test "x$PKG_CONFIG" != "x"
+  && test "x$with_libstatgrab_pkg_config" = "xyes"
 then
-  AC_MSG_CHECKING([pkg-config for libstatgrab])
-  temp_result="found"
-  $PKG_CONFIG --exists libstatgrab 2>/dev/null
-  if test "$?" != "0"
+  if test "x$PKG_CONFIG" != "x"
   then
+    AC_MSG_CHECKING([pkg-config for libstatgrab])
+    temp_result="found"
+    $PKG_CONFIG --exists libstatgrab 2>/dev/null
+    if test "$?" != "0"
+    then
+      with_libstatgrab_pkg_config="no"
+      with_libstatgrab="no ($PKG_CONFIG doesn't know libstatgrab)"
+      temp_result="not found"
+    fi
+    AC_MSG_RESULT([$temp_result])
+  else
+    AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
     with_libstatgrab_pkg_config="no"
-    temp_result="not found"
+    with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
   fi
-  AC_MSG_RESULT([$temp_result])
-else
-  AC_MSG_NOTICE([pkg-config not available, trying to guess flags for the statgrab library.])
-  with_libstatgrab_pkg_config="no"
-  with_libstatgrab_ldflags="$with_libstatgrab_ldflags -lstatgrab"
 fi
 
 if test "x$with_libstatgrab" = "xyes" \