]> err.no Git - util-linux/commitdiff
build-sys: use pkg-config to find the libs for static build
authorStepan Kasal <skasal@redhat.com>
Tue, 11 Dec 2007 17:47:37 +0000 (18:47 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 18 Feb 2008 12:27:26 +0000 (13:27 +0100)
Signed-off-by: Stepan Kasal <skasal@redhat.com>
configure.ac

index 9117990451b81989790daae136e5c57f7ad71135..bf6787fb453d62236f38ca5dd71d3961486d94b9 100644 (file)
@@ -154,15 +154,27 @@ if test $have_blkid = no && test $have_volume_id = no; then
   AC_MSG_ERROR([blkid or volume_id is needed to build util-linux-ng.])
 fi
 
+dnl UTIL_PKG_STATIC(VARIABLE, MODULES)
+dnl ----------------------------------
+AC_DEFUN([UTIL_PKG_STATIC], [
+  if AC_RUN_LOG([pkg-config --exists --print-errors "$2"]); then
+    $1=`pkg-config --libs --static "$2"`
+  else
+    AC_MSG_ERROR([pkg-config description of $2, needed for static build, is not available])
+  fi
+])
+
 # These default values should work in most cases:
 : ${BLKID_LIBS='-lblkid'}
 : ${VOLUMEID_LIBS='-lvolume_id'}
 
-# OTOH, the following two has little chance to succeed; please specify the
-# right values on the configure command-line:
-#
-: ${BLKID_LIBS_STATIC='$(BLKID_LIBS)'}
-: ${VOLUMEID_LIBS_STATIC='$(VOLUMEID_LIBS)'}
+# ... but for static build, we need to consult pkg-config:
+if test -n "$enable_static_programs"; then
+  case $with_fsprobe in
+  blkid) UTIL_PKG_STATIC([BLKID_LIBS_STATIC], [blkid]) ;;
+  volume_id) UTIL_PKG_STATIC([VOLUMEID_LIBS_STATIC], [libvolume_id]) ;;
+  esac
+fi
 
 AC_ARG_VAR([BLKID_LIBS], [-l options for linking dynamically with blkid])
 AC_ARG_VAR([BLKID_LIBS_STATIC], [-l options for linking statically with blkid])