diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index e58a2a1f43..469ff7f9ab 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libspl/include \ + -I${top_srcdir}/lib/libefi/include \ -I${top_srcdir}/lib/libzpool/include \ -I${top_srcdir}/lib/libnvpair/include \ -I${top_srcdir}/lib/libzfs/include \ @@ -20,10 +21,11 @@ zdb_SOURCES = \ zdb_LDADD = \ $(top_builddir)/lib/libspl/libspl.la \ $(top_builddir)/lib/libavl/libavl.la \ + $(top_builddir)/lib/libefi/libefi.la \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libunicode/libunicode.la \ $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la -zdb_LDFLAGS = -pthread -lm -lz -lrt +zdb_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index 8b2dfd6be6..1d21a905a5 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libspl/include \ + -I${top_srcdir}/lib/libefi/include \ -I${top_srcdir}/lib/libuutil/include \ -I${top_srcdir}/lib/libzfs/include \ -I${top_srcdir}/lib/libnvpair/include \ @@ -21,10 +22,11 @@ zfs_SOURCES = \ zfs_LDADD = \ $(top_builddir)/lib/libspl/libspl.la \ $(top_builddir)/lib/libavl/libavl.la \ + $(top_builddir)/lib/libefi/libefi.la \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libunicode/libunicode.la \ $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la -zfs_LDFLAGS = -pthread -lm -lz -lrt +zfs_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index 861d5933ad..3dc95532c7 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libspl/include \ + -I${top_srcdir}/lib/libefi/include \ -I${top_srcdir}/lib/libzpool/include \ -I${top_srcdir}/lib/libuutil/include \ -I${top_srcdir}/lib/libzfs/include \ @@ -23,10 +24,11 @@ zinject_SOURCES = \ zinject_LDADD = \ $(top_builddir)/lib/libspl/libspl.la \ $(top_builddir)/lib/libavl/libavl.la \ + $(top_builddir)/lib/libefi/libefi.la \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libunicode/libunicode.la \ $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la -zinject_LDFLAGS = -pthread -lm -lz -lrt +zinject_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 076954c039..2900abb2f8 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -30,4 +30,4 @@ zpool_LDADD = \ $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la -zpool_LDFLAGS = -pthread -lm -lz -lrt +zpool_LDFLAGS = -pthread -lm $(ZLIB) -lrt $(LIBUUID) diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index c1dae8f592..5ed0890dea 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -2,6 +2,7 @@ include $(top_srcdir)/config/Rules.am DEFAULT_INCLUDES += \ -I${top_srcdir}/lib/libspl/include \ + -I${top_srcdir}/lib/libefi/include \ -I${top_srcdir}/lib/libzpool/include \ -I${top_srcdir}/lib/libuutil/include \ -I${top_srcdir}/lib/libzfs/include \ @@ -21,10 +22,11 @@ ztest_SOURCES = \ ztest_LDADD = \ $(top_builddir)/lib/libspl/libspl.la \ $(top_builddir)/lib/libavl/libavl.la \ + $(top_builddir)/lib/libefi/libefi.la \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libunicode/libunicode.la \ $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzpool/libzpool.la \ $(top_builddir)/lib/libzfs/libzfs.la -ztest_LDFLAGS = -pthread -lm -lz -lrt -ldl +ztest_LDFLAGS = -pthread -lm $(ZLIB) -lrt -ldl $(LIBUUID) diff --git a/config/user-libblkid.m4 b/config/user-libblkid.m4 new file mode 100644 index 0000000000..8934d0ab80 --- /dev/null +++ b/config/user-libblkid.m4 @@ -0,0 +1,94 @@ +dnl # +dnl # Check for ZFS support in libblkid. This test needs to check +dnl # more than if the library exists because we expect there are +dnl # at least 3 flavors of the library out in the wild: +dnl # +dnl # 1) blkid which has no ZFS support +dnl # 2) blkid with ZFS support and a flawed method of probing +dnl # 3) blkid with ZFS support and a working method of probing +dnl # +dnl # To handle this the check first validates that there is a version +dnl # of the library installed. If there is it creates a simulated +dnl # ZFS filesystem and then links a small test app which attempts +dnl # to detect the simualated filesystem type. If it correctly +dnl # identifies the filesystem as ZFS we can safely assume case 3). +dnl # Otherwise we disable blkid support and resort to manual probing. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [ + AC_ARG_WITH([blkid], + [AS_HELP_STRING([--with-blkid], + [support blkid caching @<:@default=check@:>@])], + [], + [with_blkid=check]) + + LIBBLKID= + AS_IF([test "x$with_blkid" != xno], + [ + AC_CHECK_LIB([blkid], [blkid_get_cache], + [ + AC_MSG_CHECKING([for blkid zfs support]) + + ZFS_DEV=`mktemp` + dd if=/dev/zero of=$ZFS_DEV bs=1024k count=8 \ + >/dev/null 2>/dev/null + echo -en "\x0c\xb1\xba\0\0\0\0\0" | \ + dd of=$ZFS_DEV bs=1k count=8 \ + seek=132 conv=notrunc &>/dev/null \ + >/dev/null 2>/dev/null + + saved_LDFLAGS="$LDFLAGS" + LDFLAGS="-lblkid" + + AC_RUN_IFELSE(AC_LANG_PROGRAM( + [ + #include + #include + ], + [ + blkid_cache cache; + char *value; + + if (blkid_get_cache(&cache, NULL) < 0) + return 1; + + value = blkid_get_tag_value(cache, "TYPE", + "$ZFS_DEV"); + if (!value) { + blkid_put_cache(cache); + return 2; + } + + if (strcmp(value, "zfs")) { + free(value); + blkid_put_cache(cache); + return 3; + } + + free(value); + blkid_put_cache(cache); + ]), + [ + rm -f $ZFS_DEV + AC_MSG_RESULT([yes]) + AC_SUBST([LIBBLKID], ["-lblkid"]) + AC_DEFINE([HAVE_LIBBLKID], 1, + [Define if you have libblkid]) + ], + [ + rm -f $ZFS_DEV + AC_MSG_RESULT([no]) + AS_IF([test "x$with_blkid" != xcheck], + [AC_MSG_FAILURE( + [--with-blkid given but unavailable])]) + ]) + + LDFLAGS="$saved_LDFLAGS" + ], + [ + AS_IF([test "x$with_blkid" != xcheck], + [AC_MSG_FAILURE( + [--with-blkid given but unavailable])]) + ] + []) + ]) +]) diff --git a/config/user-libuuid.m4 b/config/user-libuuid.m4 new file mode 100644 index 0000000000..0a669b7d6a --- /dev/null +++ b/config/user-libuuid.m4 @@ -0,0 +1,18 @@ +dnl # +dnl # Check for libuuid +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUUID], [ + LIBUUID= + + AC_CHECK_HEADER([uuid/uuid.h], [], [AC_MSG_FAILURE([ + *** uuid/uuid.h missing, e2fsprogs-devel package required])]) + + AC_CHECK_LIB([uuid], [uuid_generate], [], [AC_MSG_FAILURE([ + *** uuid_generate() missing, e2fsprogs-devel package required])]) + + AC_CHECK_LIB([uuid], [uuid_is_null], [], [AC_MSG_FAILURE([ + *** uuid_is_null() missing, e2fsprogs-devel package required])]) + + AC_SUBST([LIBUUID], ["-luuid"]) + AC_DEFINE([HAVE_LIBUUID], 1, [Define if you have libuuid]) +]) diff --git a/config/user-zlib.m4 b/config/user-zlib.m4 index 999c409eda..5f2a545823 100644 --- a/config/user-zlib.m4 +++ b/config/user-zlib.m4 @@ -2,10 +2,17 @@ dnl # dnl # Check for zlib dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_ZLIB], [ - AC_CHECK_HEADER([zlib.h], [], [AC_MSG_ERROR([ - *** zlib.h missing, the zlib-devel package is required])]) - AC_CHECK_LIB([z], [compress2], [], [AC_MSG_ERROR([ - *** compress2() missing, the zlib-devel package is required])]) - AC_CHECK_LIB([z], [uncompress], [], [AC_MSG_ERROR([ - *** uncompress() missing, the zlib-devel package is required])]) + ZLIB= + + AC_CHECK_HEADER([zlib.h], [], [AC_MSG_FAILURE([ + *** zlib.h missing, zlib-devel package required])]) + + AC_CHECK_LIB([z], [compress2], [], [AC_MSG_FAILURE([ + *** compress2() missing, zlib-devel package required])]) + + AC_CHECK_LIB([z], [uncompress], [], [AC_MSG_FAILURE([ + *** uncompress() missing, zlib-devel package required])]) + + AC_SUBST([ZLIB], ["-lz"]) + AC_DEFINE([HAVE_ZLIB], 1, [Define if you have zlib]) ]) diff --git a/config/user.m4 b/config/user.m4 index 7ecc241afe..f8bda8e0ff 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -7,4 +7,6 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [ ZFS_AC_CONFIG_USER_LIBSHARE ZFS_AC_CONFIG_USER_IOCTL ZFS_AC_CONFIG_USER_ZLIB + ZFS_AC_CONFIG_USER_LIBUUID + ZFS_AC_CONFIG_USER_LIBBLKID ]) diff --git a/zfs.spec.in b/zfs.spec.in index 87093ea590..34c32a47f0 100644 --- a/zfs.spec.in +++ b/zfs.spec.in @@ -12,8 +12,8 @@ License: CDDL URL: git://eris.llnl.gov/zfs.git BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id} -un) Source: %{name}-%{version}.tar.gz -Requires: zlib -BuildRequires: zlib-devel +Requires: zlib e2fsprogs +BuildRequires: zlib-devel e2fsprogs-devel %description The %{name} package contains the libzfs library and support utilities @@ -22,8 +22,8 @@ for the zfs file system. %package devel Summary: ZFS File System User Headers Group: Development/Libraries -Requires: zlib -BuildRequires: zlib-devel +Requires: zlib e2fsprogs +BuildRequires: zlib-devel e2fsprogs-devel %description devel The %{name}-devel package contains the header files needed for building