Additional build system update for libefi library.

This include updating all the Makefile.am to have the correct
include paths and libraries.  In addition, the zlib m4 macro was
updated to more correctly integrate with the Makefiles.  And I
added two new macros libblkid and libuuid which will be needed by
subsequent commits for blkid and uuid support respectively.  The
blkid support is optional, the uuid support is mandatory for libefi.
This commit is contained in:
Brian Behlendorf 2009-10-14 15:47:41 -07:00
parent cb91bbe6ce
commit 09a8c99097
10 changed files with 144 additions and 15 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

94
config/user-libblkid.m4 Normal file
View File

@ -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 <stdio.h>
#include <blkid/blkid.h>
],
[
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])])
]
[])
])
])

18
config/user-libuuid.m4 Normal file
View File

@ -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])
])

View File

@ -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])
])

View File

@ -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
])

View File

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