From d06d028a5a5c204ac2504e6bf6aa65a2e3b8aeb5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 17 Feb 2009 21:28:09 +0100 Subject: [PATCH] build-sys: use pkg-config for blkid and volume_id It seems that blkid.pc from e2fsprogs has been fixed: $ pkg-config --libs blkid -lblkid and the pkg-config does not return any other extra libraries (such -luuid or -ldevmapper). Signed-off-by: Karel Zak --- configure.ac | 70 +++++++++++++++++++++++++++-------------------- lib/fsprobe.c | 2 +- mount/Makefile.am | 6 ++-- 3 files changed, 44 insertions(+), 34 deletions(-) diff --git a/configure.ac b/configure.ac index 3952e83f..e5e4a5b9 100644 --- a/configure.ac +++ b/configure.ac @@ -22,14 +22,6 @@ BLKID_DATE="10-Feb-2009" BLKID_VERSION=$BLKID_VERSION_MAJOR.$BLKID_VERSION_MINOR.$BLKID_VERSION_RELEASE BLKID_VERSION_INFO=`expr $BLKID_VERSION_MAJOR + $BLKID_VERSION_MINOR`:$BLKID_VERSION_RELEASE:$BLKID_VERSION_MINOR -AC_SUBST(BLKID_VERSION_MAJOR) -AC_SUBST(BLKID_VERSION_MINOR) -AC_SUBST(BLKID_VERSION_RELEASE) -AC_SUBST(BLKID_VERSION) -AC_SUBST(BLKID_VERSION_INFO) - -AC_DEFINE_UNQUOTED(BLKID_VERSION, "$BLKID_VERSION", [libblkid version string]) -AC_DEFINE_UNQUOTED(BLKID_DATE, "$BLKID_DATE", [libblkid date string]) # Check whether exec_prefix=/usr: case $exec_prefix:$prefix in @@ -57,6 +49,8 @@ AC_C_BIGENDIAN dnl libtool-2 LT_INIT +PKG_PROG_PKG_CONFIG + linux_os=no case ${host_os} in *linux*) @@ -166,35 +160,53 @@ fi UTIL_CHECK_LIB(util, openpty) UTIL_CHECK_LIB(termcap, tgetnum) + AC_ARG_WITH([fsprobe], - [AS_HELP_STRING([--with-fsprobe], [library to guess filesystems (blkid|volume_id), default is blkid])], + [AS_HELP_STRING([--with-fsprobe], [library to guess filesystems (builtin|blkid|volume_id), default is blkid])], [], [with_fsprobe=blkid] ) -AC_ARG_ENABLE([mount], - AS_HELP_STRING([--disable-mount], [do not build mount utilities]), - [], enable_mount=check -) - -AM_CONDITIONAL(HAVE_BLKID, false) -AM_CONDITIONAL(HAVE_VOLUME_ID, false) -AM_CONDITIONAL(BUILD_LIBBLKID, false) - -build_mount=yes +build_libblkid=no +have_blkid_evaluate=no have_blkid=no have_volume_id=no + if test "x$with_fsprobe" = xblkid; then - UTIL_CHECK_LIB(blkid, blkid_known_fstype) + PKG_CHECK_MODULES(BLKID, blkid, [have_blkid=yes], []) + AC_CHECK_LIB(blkid, blkid_evaluate_spec, [have_blkid_evaluate=yes], []) elif test "x$with_fsprobe" = xvolume_id; then - UTIL_CHECK_LIB(volume_id, volume_id_encode_string) + PKG_CHECK_MODULES(VOLUME_ID, volume_id, [have_volume_id=yes], []) elif test "x$with_fsprobe" = xbuiltin; then have_blkid=yes - AC_DEFINE(HAVE_LIBBLKID,1,[Define to 1 if you have the -lblkid.]) - AC_DEFINE(HAVE_BLKID_EVALUATE_SPEC,1,[Define to 1 if you have the blkid_evaluate_spec().]) - AM_CONDITIONAL(HAVE_BLKID, true) - AM_CONDITIONAL(BUILD_LIBBLKID, true) + build_libblkid=yes + have_blkid_evaluate=yes + AC_SUBST(BLKID_VERSION_MAJOR) + AC_SUBST(BLKID_VERSION_MINOR) + AC_SUBST(BLKID_VERSION_RELEASE) + AC_SUBST(BLKID_VERSION) + AC_SUBST(BLKID_VERSION_INFO) + AC_DEFINE_UNQUOTED(BLKID_VERSION, "$BLKID_VERSION", [libblkid version string]) + AC_DEFINE_UNQUOTED(BLKID_DATE, "$BLKID_DATE", [libblkid date string]) fi +if test "x$have_blkid" = xyes; then + AC_DEFINE(HAVE_LIBBLKID, 1, [Define to 1 if you have the -lblkid.]) + if test "x$have_blkid_evaluate" = xyes; then + AC_DEFINE(HAVE_BLKID_EVALUATE_SPEC, 1, [Define to 1 if you have the blkid_evaluate_spec().]) + fi +fi + +AM_CONDITIONAL(HAVE_BLKID, test "x$have_blkid" = xyes) +AM_CONDITIONAL(HAVE_VOLUME_ID, test "x$have_volume_id" = xyes) +AM_CONDITIONAL(BUILD_LIBBLKID, test "x$build_libblkid" = xyes) + + +AC_ARG_ENABLE([mount], + AS_HELP_STRING([--disable-mount], [do not build mount utilities]), + [], enable_mount=check +) + +build_mount=yes if test "${enable_mount}" = "no"; then build_mount=no elif test "x$linux_os" = xyes; then @@ -221,20 +233,18 @@ AC_DEFUN([UTIL_PKG_STATIC], [ # These default values should work in most cases: : ${BLKID_LIBS='-lblkid -luuid'} -: ${VOLUMEID_LIBS='-lvolume_id'} +: ${VOLUME_ID_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]) ;; + volume_id) UTIL_PKG_STATIC([VOLUME_ID_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]) +AC_ARG_VAR([VOLUME_ID_LIBS_STATIC], [-l options for linking statically with volume_id]) AM_GNU_GETTEXT_VERSION([0.14.1]) diff --git a/lib/fsprobe.c b/lib/fsprobe.c index d8d927d7..5fecc649 100644 --- a/lib/fsprobe.c +++ b/lib/fsprobe.c @@ -7,7 +7,7 @@ #include #include -#include /* TODO: , -I/usr/include/blkid */ +#include #include "blkdev.h" #include "canonicalize.h" diff --git a/mount/Makefile.am b/mount/Makefile.am index 261b8c9a..b34df3c3 100644 --- a/mount/Makefile.am +++ b/mount/Makefile.am @@ -84,9 +84,9 @@ endif endif if HAVE_VOLUME_ID -ldadd_common += $(VOLUMEID_LIBS) -ldadd_static += $(VOLUMEID_LIBS_STATIC) -cflags_common += $(VOLUMEID_CFLAGS) +ldadd_common += $(VOLUME_ID_LIBS) +ldadd_static += $(VOLUME_ID_LIBS_STATIC) +cflags_common += $(VOLUME_ID_CFLAGS) endif if HAVE_SELINUX -- 2.39.5