Re: util-linux-ng: mount, umount and swapon need libuuid

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

 



On Tue, Sep 02, 2008 at 10:03:34PM +0200, Karel Zak wrote:
> > We could use pkg-config to get the dependend libs for libblkid, but I'm
> > not sure if all possible e2fsprogs versions are pkgconfigized.
> 
>  Right. Please, read also Stepan's excellent post about pkg-config:
>  http://article.gmane.org/gmane.linux.utilities.util-linux-ng/953

Ok, so what about this variant? It's still missing the -static feature
of the original code, but I'd like to get an impression if I'm on the
right track.

From: Robert Schwebel <r.schwebel@xxxxxxxxxxxxxx>
Subject: util-linux-ng: change fsprobe lib handling to use pkg-config

Currently we don't handle libblkid handling correctly because the
library test with UTIL_CHECK_LIB doesn't care about dependency libs.

Change the test to use pkg-config to determine all necessary linker
flags for either blkid or volume_id.

Signed-off-by: Robert Schwebel <r.schwebel@xxxxxxxxxxxxxx>

---
 configure.ac      |   49 +++++++++++++++----------------------------------
 mount/Makefile.am |    8 ++++----
 2 files changed, 19 insertions(+), 38 deletions(-)

Index: util-linux-ng-2.14.1-rc2/configure.ac
===================================================================
--- util-linux-ng-2.14.1-rc2.orig/configure.ac
+++ util-linux-ng-2.14.1-rc2/configure.ac
@@ -149,47 +149,28 @@ AC_ARG_WITH([fsprobe],
   [], [with_fsprobe=blkid]
 )
 
-AM_CONDITIONAL(HAVE_BLKID, false)
-AM_CONDITIONAL(HAVE_VOLUME_ID, false)
+AM_CONDITIONAL(HAVE_BLKID, [test x$with_fsprobe = xblkid])
+AM_CONDITIONAL(HAVE_VOLUME_ID, [test x$with_fsprobe = xvolume_id])
 
 have_blkid=no
 have_volume_id=no
 if test "x$with_fsprobe" = xblkid; then
-  UTIL_CHECK_LIB(blkid, blkid_known_fstype)
+  REQUIRES_FSPROBE="blkid"
 elif test "x$with_fsprobe" = xvolume_id; then
-  UTIL_CHECK_LIB(volume_id, volume_id_encode_string)
+  REQUIRES_FSPROBE="volume_id"
 fi
 
-if test "x$have_blkid" = xno && test "x$have_volume_id" = xno; 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'}
-
-# ... 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])
-AC_ARG_VAR([VOLUMEID_LIBS], [-l options for linking dynamically with volume_id])
-AC_ARG_VAR([VOLUMEID_LIBS_STATIC], [-l options for linking statically with volume_id])
+#if test -n "$enable_static_programs"; then
+# FIXME - do something to tell pkg-config to probe with --static
+#fi
+AC_SUBST(REQUIRES_FSPROBE)
+PKG_CHECK_MODULES([fsprobe],
+  [${REQUIRES_FSPROBE}],
+  [],
+  [AC_MSG_ERROR([*** ${REQUIRES_FSPROBE} not found by pkg-config on your system])]
+)
+AC_SUBST(fsprobe_CFLAGS)
+AC_SUBST(fsprobe_LIBS)
 
 
 AM_GNU_GETTEXT_VERSION([0.14.1])
Index: util-linux-ng-2.14.1-rc2/mount/Makefile.am
===================================================================
--- util-linux-ng-2.14.1-rc2.orig/mount/Makefile.am
+++ util-linux-ng-2.14.1-rc2/mount/Makefile.am
@@ -66,8 +66,8 @@ endif
 
 if HAVE_BLKID
 utils_common += fsprobe_blkid.c
-LDADD_common += $(BLKID_LIBS)
-LDADD_common_static += $(BLKID_LIBS_STATIC)
+LDADD_common += $(fsprobe_LIBS)
+LDADD_common_static += $(fsprobe_STATIC)
 endif
 
 if HAVE_SELINUX
@@ -78,8 +78,8 @@ endif
 if HAVE_VOLUME_ID
 utils_common += fsprobe_volumeid.c
 swapon_SOURCES += ../lib/linux_version.c ../lib/blkdev.c
-LDADD_common += $(VOLUMEID_LIBS)
-LDADD_common_static += $(VOLUMEID_LIBS_STATIC)
+LDADD_common += $(fsprobe_LIBS)
+LDADD_common_static += $(fsprobe_LIBS)
 endif
 
 if HAVE_PIVOT_ROOT

-- 
 Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
 Pengutronix - Linux Solutions for Science and Industry
   Handelsregister:  Amtsgericht Hildesheim, HRA 2686
     Hannoversche Str. 2, 31134 Hildesheim, Germany
   Phone: +49-5121-206917-0 |  Fax: +49-5121-206917-9

--
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