[PATCH] build-sys: use pkg-config to find the libs for static build

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Stepan Kasal <skasal@xxxxxxxxxx>
---

Hello again,
   I have run "make distcheck" after applying all 8 patches submitted
in this tree; it passed.

Have a nice day,
	Stepan

 configure.ac |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9991bd6..82b989c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,15 +143,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])
-- 
1.5.3.4

-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux