diff --git a/cmd/mount_zfs/Makefile.am b/cmd/mount_zfs/Makefile.am index ddacf32c6dd5..616ee65a73da 100644 --- a/cmd/mount_zfs/Makefile.am +++ b/cmd/mount_zfs/Makefile.am @@ -1,18 +1,18 @@ include $(top_srcdir)/config/Rules.am # # Ignore the prefix for the mount helper. It must be installed in /sbin/ # because this path is hardcoded in the mount(8) for security reasons. # However, if needed, the configure option --with-mounthelperdir= can be used # to override the default install location. # sbindir=$(mounthelperdir) sbin_PROGRAMS = mount.zfs mount_zfs_SOURCES = \ mount_zfs.c mount_zfs_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/raidz_test/Makefile.am b/cmd/raidz_test/Makefile.am index 0b173ed505fd..387cc7d8a306 100644 --- a/cmd/raidz_test/Makefile.am +++ b/cmd/raidz_test/Makefile.am @@ -1,20 +1,20 @@ include $(top_srcdir)/config/Rules.am # Includes kernel code, generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) # Unconditionally enable ASSERTs AM_CPPFLAGS += -DDEBUG -UNDEBUG bin_PROGRAMS = raidz_test raidz_test_SOURCES = \ raidz_test.h \ raidz_test.c \ raidz_bench.c raidz_test_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la -raidz_test_LDADD += -lm -ldl +raidz_test_LDADD += -lm diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am index 07c1d068b04b..68de8ea3c7b0 100644 --- a/cmd/zdb/Makefile.am +++ b/cmd/zdb/Makefile.am @@ -1,15 +1,16 @@ include $(top_srcdir)/config/Rules.am # Unconditionally enable debugging for zdb AM_CPPFLAGS += -DDEBUG -UNDEBUG sbin_PROGRAMS = zdb zdb_SOURCES = \ zdb.c \ zdb_il.c \ zdb.h zdb_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index b6c89bfc36b5..89b4d899bad7 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -1,47 +1,49 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBUDEV_CFLAGS) $(LIBUUID_CFLAGS) + SUBDIRS = zed.d sbin_PROGRAMS = zed ZED_SRC = \ zed.c \ zed.h \ zed_conf.c \ zed_conf.h \ zed_disk_event.c \ zed_disk_event.h \ zed_event.c \ zed_event.h \ zed_exec.c \ zed_exec.h \ zed_file.c \ zed_file.h \ zed_log.c \ zed_log.h \ zed_strings.c \ zed_strings.h FMA_SRC = \ agents/zfs_agents.c \ agents/zfs_agents.h \ agents/zfs_diagnosis.c \ agents/zfs_mod.c \ agents/zfs_retire.c \ agents/fmd_api.c \ agents/fmd_api.h \ agents/fmd_serd.c \ agents/fmd_serd.h zed_SOURCES = $(ZED_SRC) $(FMA_SRC) zed_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la -zed_LDADD += -lrt +zed_LDADD += -lrt $(LIBUDEV_LIBS) $(LIBUUID_LIBS) zed_LDFLAGS = -pthread EXTRA_DIST = agents/README.md diff --git a/cmd/zfs/Makefile.am b/cmd/zfs/Makefile.am index c824bf61e506..1ce721a8b8f3 100644 --- a/cmd/zfs/Makefile.am +++ b/cmd/zfs/Makefile.am @@ -1,21 +1,21 @@ include $(top_srcdir)/config/Rules.am sbin_PROGRAMS = zfs zfs_SOURCES = \ zfs_iter.c \ zfs_iter.h \ zfs_main.c \ zfs_util.h \ zfs_project.c \ zfs_projectutil.h zfs_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzfs/libzfs.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la if BUILD_FREEBSD zfs_LDADD += -L/usr/local/lib -lintl -lgeom -ljail endif diff --git a/cmd/zhack/Makefile.am b/cmd/zhack/Makefile.am index ac4b6aadb655..3f6ef1215ed9 100644 --- a/cmd/zhack/Makefile.am +++ b/cmd/zhack/Makefile.am @@ -1,10 +1,11 @@ include $(top_srcdir)/config/Rules.am sbin_PROGRAMS = zhack zhack_SOURCES = \ zhack.c zhack_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/zinject/Makefile.am b/cmd/zinject/Makefile.am index b056a6db545e..7c4a5fdbb030 100644 --- a/cmd/zinject/Makefile.am +++ b/cmd/zinject/Makefile.am @@ -1,13 +1,13 @@ include $(top_srcdir)/config/Rules.am sbin_PROGRAMS = zinject zinject_SOURCES = \ translate.c \ zinject.c \ zinject.h zinject_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 1dcb9852010a..04bdbffcd7d0 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -1,132 +1,134 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUUID_CFLAGS) + DEFAULT_INCLUDES += -I$(srcdir) sbin_PROGRAMS = zpool zpool_SOURCES = \ zpool_iter.c \ zpool_main.c \ zpool_util.c \ zpool_util.h \ zpool_vdev.c if BUILD_FREEBSD zpool_SOURCES += os/freebsd/zpool_vdev_os.c endif if BUILD_LINUX zpool_SOURCES += os/linux/zpool_vdev_os.c endif zpool_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la if BUILD_FREEBSD zpool_LDADD += -L/usr/local/lib -lintl -lgeom endif -zpool_LDADD += -lm $(LIBBLKID) +zpool_LDADD += -lm $(LIBBLKID_LIBS) $(LIBUUID_LIBS) zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d EXTRA_DIST = zpool.d/README dist_zpoolexec_SCRIPTS = \ zpool.d/dm-deps \ zpool.d/enc \ zpool.d/encdev \ zpool.d/fault_led \ zpool.d/iostat \ zpool.d/iostat-1s \ zpool.d/iostat-10s \ zpool.d/label \ zpool.d/locate_led \ zpool.d/lsblk \ zpool.d/media \ zpool.d/model \ zpool.d/serial \ zpool.d/ses \ zpool.d/size \ zpool.d/slot \ zpool.d/smart \ zpool.d/smartx \ zpool.d/temp \ zpool.d/health \ zpool.d/r_proc \ zpool.d/w_proc \ zpool.d/r_ucor \ zpool.d/w_ucor \ zpool.d/nonmed \ zpool.d/defect \ zpool.d/hours_on \ zpool.d/realloc \ zpool.d/rep_ucor \ zpool.d/cmd_to \ zpool.d/pend_sec \ zpool.d/off_ucor \ zpool.d/ata_err \ zpool.d/nvme_err \ zpool.d/pwr_cyc \ zpool.d/upath \ zpool.d/vendor \ zpool.d/smart_test \ zpool.d/test_type \ zpool.d/test_status \ zpool.d/test_progress \ zpool.d/test_ended zpoolconfdefaults = \ dm-deps \ enc \ encdev \ fault_led \ iostat \ iostat-1s \ iostat-10s \ label \ locate_led \ lsblk \ media \ model \ serial \ ses \ size \ slot \ smart \ smartx \ temp \ health \ r_proc \ w_proc \ r_ucor \ w_ucor \ nonmed \ defect \ hours_on \ realloc \ rep_ucor \ cmd_to \ pend_sec \ off_ucor \ ata_err \ nvme_err \ pwr_cyc \ upath \ vendor \ smart_test \ test_type \ test_status \ test_progress \ test_ended install-data-hook: $(MKDIR_P) "$(DESTDIR)$(zpoolconfdir)" for f in $(zpoolconfdefaults); do \ test -f "$(DESTDIR)$(zpoolconfdir)/$${f}" -o \ -L "$(DESTDIR)$(zpoolconfdir)/$${f}" || \ ln -s "$(zpoolexecdir)/$${f}" "$(DESTDIR)$(zpoolconfdir)"; \ done diff --git a/cmd/zstream/Makefile.am b/cmd/zstream/Makefile.am index ebc07d2eaa04..a3b678d0aca2 100644 --- a/cmd/zstream/Makefile.am +++ b/cmd/zstream/Makefile.am @@ -1,14 +1,14 @@ include $(top_srcdir)/config/Rules.am sbin_PROGRAMS = zstream zstream_SOURCES = \ zstream.c \ zstream.h \ zstream_dump.c \ zstream_redup.c zstream_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzfs/libzfs.la + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/cmd/ztest/Makefile.am b/cmd/ztest/Makefile.am index db9a104c0c7c..4790e62ca1d0 100644 --- a/cmd/ztest/Makefile.am +++ b/cmd/ztest/Makefile.am @@ -1,22 +1,23 @@ include $(top_srcdir)/config/Rules.am # Get rid of compiler warning for unchecked truncating snprintfs on gcc 7.1.1 AM_CFLAGS += $(NO_FORMAT_TRUNCATION) # Includes kernel code, generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) # Unconditionally enable ASSERTs AM_CPPFLAGS += -DDEBUG -UNDEBUG sbin_PROGRAMS = ztest ztest_SOURCES = \ ztest.c ztest_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la ztest_LDADD += -lm ztest_LDFLAGS = -pthread diff --git a/config/find_system_library.m4 b/config/find_system_library.m4 index 9d22bcfab55f..3f2f7b709f0e 100644 --- a/config/find_system_library.m4 +++ b/config/find_system_library.m4 @@ -1,73 +1,77 @@ # find_system_lib.m4 - Macros to search for a system library. -*- Autoconf -*- dnl requires pkg.m4 from pkg-config dnl requires ax_save_flags.m4 from autoconf-archive dnl requires ax_restore_flags.m4 from autoconf-archive dnl FIND_SYSTEM_LIBRARY(VARIABLE-PREFIX, MODULE, HEADER, HEADER-PREFIXES, LIBRARY, FUNCTIONS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) AC_DEFUN([FIND_SYSTEM_LIBRARY], [ AC_REQUIRE([PKG_PROG_PKG_CONFIG]) _library_found= - PKG_CHECK_MODULES([$1], [$2], [_library_found=1], [ + AS_IF([test -n "$2"], [PKG_CHECK_MODULES([$1], [$2], [_library_found=1], [:])]) + + AS_IF([test -z "$_library_found"], [ AS_IF([test -f /usr/include/[$3]], [ AC_SUBST([$1][_CFLAGS], []) AC_SUBST([$1][_LIBS], ["-l[$5]]") _library_found=1 ],[ AS_IF([test -f /usr/local/include/[$3]], [ AC_SUBST([$1][_CFLAGS], ["-I/usr/local/include"]) AC_SUBST([$1][_LIBS], ["-L/usr/local -l[$5]]") _library_found=1 ],[dnl ELSE + : m4_foreach([prefix], [$4], [ AS_IF([test "x$_library_found" != "x1"], [ AS_IF([test -f [/usr/include/]prefix[/][$3]], [ AC_SUBST([$1][_CFLAGS], ["[-I/usr/include/]prefix["]]) AC_SUBST([$1][_LIBS], ["-l[$5]]") _library_found=1 ],[ AS_IF([test -f [/usr/local/include/]prefix[/][$3]], [ AC_SUBST([$1][_CFLAGS], ["[-I/usr/local/include/]prefix["]]) AC_SUBST([$1][_LIBS], ["-L/usr/local -l[$5]"]) _library_found=1 ])]) ]) ]) ])]) AS_IF([test -z "$_library_found"], [ - AC_MSG_WARN([cannot find [$2] via pkg-config or in the standard locations]) + AC_MSG_WARN([cannot find [$5] via pkg-config or in the standard locations]) ]) ]) dnl do some further sanity checks AS_IF([test -n "$_library_found"], [ AX_SAVE_FLAGS CPPFLAGS="$CPPFLAGS $(echo $[$1][_CFLAGS] | sed 's/-include */-include-/g; s/^/ /; s/ [^-][^ ]*//g; s/ -[^Ii][^ ]*//g; s/-include-/-include /g; s/^ //;')" CFLAGS="$CFLAGS $[$1][_CFLAGS]" LDFLAGS="$LDFLAGS $[$1][_LIBS]" AC_CHECK_HEADER([$3], [], [ - AC_MSG_WARN([header [$3] for library [$2] is not usable]) + AC_MSG_WARN([header [$3] for library [$5] is not usable]) _library_found= ]) m4_foreach([func], [$6], [ AC_CHECK_LIB([$5], func, [], [ AC_MSG_WARN([cannot find ]func[ in library [$5]]) _library_found= ]) ]) AX_RESTORE_FLAGS ]) AS_IF([test -n "$_library_found"], [ + AC_DEFINE([HAVE_][$1], [1], [Define if you have [$5]]) :;$7 ],[dnl ELSE :;$8 ]) ]) diff --git a/config/user-clock_gettime.m4 b/config/user-clock_gettime.m4 new file mode 100644 index 000000000000..c96024da797b --- /dev/null +++ b/config/user-clock_gettime.m4 @@ -0,0 +1,12 @@ +dnl # +dnl # Check if librt is required for clock_gettime. +dnl # clock_gettime is generally available in libc on modern systems. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_CLOCK_GETTIME], [ + AC_CHECK_FUNC([clock_gettime], [], [ + AC_CHECK_LIB([rt], [clock_gettime], [ + AC_SUBST([LIBCLOCK_GETTIME], [-lrt])], [ + AC_MSG_FAILURE([*** clock_gettime is missing in libc and librt]) + ]) + ]) +]) diff --git a/config/user-libaio.m4 b/config/user-libaio.m4 index d7a7cb508df8..0a58876fec35 100644 --- a/config/user-libaio.m4 +++ b/config/user-libaio.m4 @@ -1,14 +1,6 @@ dnl # dnl # Check for libaio - only used for libaiot test cases. dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [ - LIBAIO= - - AC_CHECK_HEADER([libaio.h], [ - user_libaio=yes - AC_SUBST([LIBAIO], ["-laio"]) - AC_DEFINE([HAVE_LIBAIO], 1, [Define if you have libaio]) - ], [ - user_libaio=no - ]) + FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no]) ]) diff --git a/config/user-libblkid.m4 b/config/user-libblkid.m4 index 88e6f990b74a..427c4f172c91 100644 --- a/config/user-libblkid.m4 +++ b/config/user-libblkid.m4 @@ -1,13 +1,9 @@ dnl # dnl # Check for libblkid. Basic support for detecting ZFS pools dnl # has existing in blkid since 2008. dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBBLKID], [ - LIBBLKID= - - AC_CHECK_HEADER([blkid/blkid.h], [], [AC_MSG_FAILURE([ - *** blkid.h missing, libblkid-devel package required])]) - - AC_SUBST([LIBBLKID], ["-lblkid"]) - AC_DEFINE([HAVE_LIBBLKID], 1, [Define if you have libblkid]) + FIND_SYSTEM_LIBRARY(LIBBLKID, [blkid], [blkid/blkid.h], [], [blkid], [], [], [ + AC_MSG_FAILURE([ + *** blkid.h missing, libblkid-devel package required])]) ]) diff --git a/config/user-libcrypto.m4 b/config/user-libcrypto.m4 new file mode 100644 index 000000000000..432b848385ff --- /dev/null +++ b/config/user-libcrypto.m4 @@ -0,0 +1,8 @@ +dnl # +dnl # Check for libcrypto. Used for userspace password derivation via PBKDF2. +dnl # +AC_DEFUN([ZFS_AC_CONFIG_USER_LIBCRYPTO], [ + FIND_SYSTEM_LIBRARY(LIBCRYPTO, [libcrypto], [openssl/evp.h], [], [crypto], [PKCS5_PBKDF2_HMAC_SHA1], [], [ + AC_MSG_FAILURE([ + *** evp.h missing, libssl-devel package required])]) +]) diff --git a/config/user-libssl.m4 b/config/user-libssl.m4 deleted file mode 100644 index f6824510fd41..000000000000 --- a/config/user-libssl.m4 +++ /dev/null @@ -1,12 +0,0 @@ -dnl # -dnl # Check for libssl. Used for userspace password derivation via PBKDF2. -dnl # -AC_DEFUN([ZFS_AC_CONFIG_USER_LIBSSL], [ - LIBSSL= - - AC_CHECK_HEADER([openssl/evp.h], [], [AC_MSG_FAILURE([ - *** evp.h missing, libssl-devel package required])]) - - AC_SUBST([LIBSSL], ["-lssl -lcrypto"]) - AC_DEFINE([HAVE_LIBSSL], 1, [Define if you have libssl]) -]) diff --git a/config/user-libudev.m4 b/config/user-libudev.m4 index 9b7454927ea7..5164d17cdcff 100644 --- a/config/user-libudev.m4 +++ b/config/user-libudev.m4 @@ -1,19 +1,19 @@ dnl # dnl # Check for libudev - needed for vdev auto-online and auto-replace dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_LIBUDEV], [ - LIBUDEV= + FIND_SYSTEM_LIBRARY(LIBUDEV, [libudev], [libudev.h], [], [udev], [], [user_libudev=yes], [user_libudev=no]) - AC_CHECK_HEADER([libudev.h], [ - user_libudev=yes - AC_SUBST([LIBUDEV], ["-ludev"]) - AC_DEFINE([HAVE_LIBUDEV], 1, [Define if you have libudev]) - ], [ - user_libudev=no - ]) + AS_IF([test "x$user_libudev" = xyes], [ + AX_SAVE_FLAGS + + CFLAGS="$CFLAGS $LIBUDEV_CFLAGS" + LDFLAGS="$LDFLAGS $LIBUDEV_LIBS" - AC_SEARCH_LIBS([udev_device_get_is_initialized], [udev], [ - AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1, [ - Define if udev_device_get_is_initialized is available])], []) + AC_CHECK_LIB([udev], [udev_device_get_is_initialized], [ + AC_DEFINE([HAVE_LIBUDEV_UDEV_DEVICE_GET_IS_INITIALIZED], 1, [ + Define if udev_device_get_is_initialized is available])], []) + AX_RESTORE_FLAGS + ]) ]) diff --git a/config/user-libuuid.m4 b/config/user-libuuid.m4 index f0da671a3f61..c4012f30ab27 100644 --- a/config/user-libuuid.m4 +++ b/config/user-libuuid.m4 @@ -1,18 +1,8 @@ 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, libuuid-devel package required])]) - - AC_SEARCH_LIBS([uuid_generate], [uuid], [], [AC_MSG_FAILURE([ - *** uuid_generate() missing, libuuid-devel package required])]) - - AC_SEARCH_LIBS([uuid_is_null], [uuid], [], [AC_MSG_FAILURE([ - *** uuid_is_null() missing, libuuid-devel package required])]) - - AC_SUBST([LIBUUID], ["-luuid"]) - AC_DEFINE([HAVE_LIBUUID], 1, [Define if you have libuuid]) + FIND_SYSTEM_LIBRARY(LIBUUID, [uuid], [uuid/uuid.h], [], [uuid], [uuid_generate, uuid_is_null], [], [ + AC_MSG_FAILURE([*** libuuid-devel package required]) + ]) ]) diff --git a/config/user-zlib.m4 b/config/user-zlib.m4 index 82c0962e4517..d30fde288820 100644 --- a/config/user-zlib.m4 +++ b/config/user-zlib.m4 @@ -1,21 +1,8 @@ dnl # dnl # Check for zlib dnl # AC_DEFUN([ZFS_AC_CONFIG_USER_ZLIB], [ - ZLIB= - - AC_CHECK_HEADER([zlib.h], [], [AC_MSG_FAILURE([ - *** zlib.h missing, zlib-devel package required])]) - - AC_SEARCH_LIBS([compress2], [z], [], [AC_MSG_FAILURE([ - *** compress2() missing, zlib-devel package required])]) - - AC_SEARCH_LIBS([uncompress], [z], [], [AC_MSG_FAILURE([ - *** uncompress() missing, zlib-devel package required])]) - - AC_SEARCH_LIBS([crc32], [z], [], [AC_MSG_FAILURE([ - *** crc32() missing, zlib-devel package required])]) - - AC_SUBST([ZLIB], ["-lz"]) - AC_DEFINE([HAVE_ZLIB], 1, [Define if you have zlib]) + FIND_SYSTEM_LIBRARY(ZLIB, [zlib], [zlib.h], [], [z], [compress2, uncompress, crc32], [], [ + AC_MSG_FAILURE([*** zlib-devel package required]) + ]) ]) diff --git a/config/user.m4 b/config/user.m4 index c09705bde463..c220675514e6 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -1,40 +1,45 @@ dnl # dnl # Default ZFS user configuration dnl # AC_DEFUN([ZFS_AC_CONFIG_USER], [ ZFS_AC_CONFIG_USER_GETTEXT ZFS_AC_CONFIG_USER_MOUNT_HELPER ZFS_AC_CONFIG_USER_SYSVINIT ZFS_AC_CONFIG_USER_DRACUT + AM_COND_IF([BUILD_FREEBSD], [ + PKG_INSTALLDIR(['${prefix}/libdata/pkgconfig'])], [ + PKG_INSTALLDIR + ]) ZFS_AC_CONFIG_USER_ZLIB AM_COND_IF([BUILD_LINUX], [ ZFS_AC_CONFIG_USER_UDEV ZFS_AC_CONFIG_USER_SYSTEMD ZFS_AC_CONFIG_USER_LIBUUID ZFS_AC_CONFIG_USER_LIBBLKID ]) ZFS_AC_CONFIG_USER_LIBTIRPC ZFS_AC_CONFIG_USER_LIBUDEV - ZFS_AC_CONFIG_USER_LIBSSL + ZFS_AC_CONFIG_USER_LIBCRYPTO ZFS_AC_CONFIG_USER_LIBAIO + ZFS_AC_CONFIG_USER_CLOCK_GETTIME ZFS_AC_CONFIG_USER_PAM ZFS_AC_CONFIG_USER_RUNSTATEDIR ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV ZFS_AC_CONFIG_USER_ZFSEXEC ZFS_AC_TEST_FRAMEWORK AC_CHECK_FUNCS([issetugid mlockall strlcat strlcpy]) ]) dnl # dnl # Setup the environment for the ZFS Test Suite. Currently only dnl # Linux style systems are supported but this infrastructure can dnl # be extended to support other platforms if needed. dnl # AC_DEFUN([ZFS_AC_TEST_FRAMEWORK], [ ZONENAME="echo global" AC_SUBST(ZONENAME) AC_SUBST(RM) ]) diff --git a/configure.ac b/configure.ac index c7f813d1927c..0c3a5b6605d8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,405 +1,405 @@ /* * This file is part of the ZFS Linux port. * * Copyright (c) 2009 Lawrence Livermore National Security, LLC. * Produced at Lawrence Livermore National Laboratory * Written by: * Brian Behlendorf , * Herb Wartens , * Jim Garlick * LLNL-CODE-403049 * * CDDL HEADER START * * The contents of this file are subject to the terms of the * Common Development and Distribution License, Version 1.0 only * (the "License"). You may not use this file except in compliance * with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. * See the License for the specific language governing permissions * and limitations under the License. * * When distributing Covered Code, include this CDDL HEADER in each * file and include the License file at usr/src/OPENSOLARIS.LICENSE. * If applicable, add the following below this CDDL HEADER, with the * fields enclosed by brackets "[]" replaced with your own identifying * information: Portions Copyright [yyyy] [name of copyright owner] * * CDDL HEADER END */ AC_INIT(m4_esyscmd(grep ^Name: META | cut -d ':' -f 2 | tr -d ' \n'), m4_esyscmd(grep ^Version: META | cut -d ':' -f 2 | tr -d ' \n')) AC_LANG(C) ZFS_AC_META AC_CONFIG_AUX_DIR([config]) AC_CONFIG_MACRO_DIR([config]) AC_CANONICAL_SYSTEM AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AM_INIT_AUTOMAKE([subdir-objects]) AC_CONFIG_HEADERS([zfs_config.h], [ (mv zfs_config.h zfs_config.h.tmp && awk -f ${ac_srcdir}/config/config.awk zfs_config.h.tmp >zfs_config.h && rm zfs_config.h.tmp) || exit 1]) AC_PROG_INSTALL AC_PROG_CC AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG AM_PROG_AS AM_PROG_CC_C_O AX_CODE_COVERAGE _AM_PROG_TAR(pax) ZFS_AC_LICENSE ZFS_AC_CONFIG ZFS_AC_PACKAGE ZFS_AC_DEBUG ZFS_AC_DEBUGINFO ZFS_AC_DEBUG_KMEM ZFS_AC_DEBUG_KMEM_TRACKING AC_CONFIG_FILES([ Makefile cmd/Makefile cmd/arc_summary/Makefile cmd/arcstat/Makefile cmd/dbufstat/Makefile cmd/fsck_zfs/Makefile cmd/mount_zfs/Makefile cmd/raidz_test/Makefile cmd/vdev_id/Makefile cmd/zdb/Makefile cmd/zed/Makefile cmd/zed/zed.d/Makefile cmd/zfs/Makefile cmd/zfs_ids_to_path/Makefile cmd/zgenhostid/Makefile cmd/zhack/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/zstream/Makefile cmd/zstreamdump/Makefile cmd/ztest/Makefile cmd/zvol_id/Makefile cmd/zvol_wait/Makefile contrib/Makefile contrib/bash_completion.d/Makefile contrib/bpftrace/Makefile contrib/dracut/02zfsexpandknowledge/Makefile contrib/dracut/90zfs/Makefile contrib/dracut/Makefile contrib/initramfs/Makefile contrib/initramfs/conf.d/Makefile contrib/initramfs/conf-hooks.d/Makefile contrib/initramfs/hooks/Makefile contrib/initramfs/scripts/Makefile contrib/initramfs/scripts/local-top/Makefile contrib/pam_zfs_key/Makefile contrib/pyzfs/Makefile contrib/pyzfs/setup.py contrib/zcp/Makefile etc/Makefile etc/default/Makefile etc/init.d/Makefile etc/modules-load.d/Makefile etc/sudoers.d/Makefile etc/systemd/Makefile etc/systemd/system-generators/Makefile etc/systemd/system/Makefile etc/zfs/Makefile include/Makefile include/os/Makefile include/os/freebsd/Makefile include/os/freebsd/linux/Makefile include/os/freebsd/spl/Makefile include/os/freebsd/spl/acl/Makefile include/os/freebsd/spl/rpc/Makefile include/os/freebsd/spl/sys/Makefile include/os/freebsd/zfs/Makefile include/os/freebsd/zfs/sys/Makefile include/os/linux/Makefile include/os/linux/kernel/Makefile include/os/linux/kernel/linux/Makefile include/os/linux/spl/Makefile include/os/linux/spl/rpc/Makefile include/os/linux/spl/sys/Makefile include/os/linux/zfs/Makefile include/os/linux/zfs/sys/Makefile include/sys/Makefile include/sys/crypto/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile include/sys/fs/Makefile include/sys/lua/Makefile include/sys/sysevent/Makefile lib/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libicp/Makefile lib/libnvpair/Makefile lib/libshare/Makefile lib/libspl/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/os/Makefile lib/libspl/include/os/freebsd/Makefile lib/libspl/include/os/freebsd/sys/Makefile lib/libspl/include/os/linux/Makefile lib/libspl/include/os/linux/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libtpool/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzfs/Makefile lib/libzfs/libzfs.pc - lib/libzfs/libzfs_core.pc lib/libzfs_core/Makefile + lib/libzfs_core/libzfs_core.pc lib/libzpool/Makefile lib/libzutil/Makefile man/Makefile man/man1/Makefile man/man5/Makefile man/man8/Makefile module/Kbuild module/Makefile module/avl/Makefile module/icp/Makefile module/lua/Makefile module/nvpair/Makefile module/os/linux/spl/Makefile module/os/linux/zfs/Makefile module/spl/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile rpm/Makefile rpm/generic/Makefile rpm/generic/zfs-dkms.spec rpm/generic/zfs-kmod.spec rpm/generic/zfs.spec rpm/redhat/Makefile rpm/redhat/zfs-dkms.spec rpm/redhat/zfs-kmod.spec rpm/redhat/zfs.spec scripts/Makefile tests/Makefile tests/runfiles/Makefile tests/test-runner/Makefile tests/test-runner/bin/Makefile tests/test-runner/include/Makefile tests/test-runner/man/Makefile tests/zfs-tests/Makefile tests/zfs-tests/callbacks/Makefile tests/zfs-tests/cmd/Makefile tests/zfs-tests/cmd/btree_test/Makefile tests/zfs-tests/cmd/chg_usr_exec/Makefile tests/zfs-tests/cmd/devname2devid/Makefile tests/zfs-tests/cmd/dir_rd_update/Makefile tests/zfs-tests/cmd/file_check/Makefile tests/zfs-tests/cmd/file_trunc/Makefile tests/zfs-tests/cmd/file_write/Makefile tests/zfs-tests/cmd/get_diff/Makefile tests/zfs-tests/cmd/largest_file/Makefile tests/zfs-tests/cmd/libzfs_input_check/Makefile tests/zfs-tests/cmd/mkbusy/Makefile tests/zfs-tests/cmd/mkfile/Makefile tests/zfs-tests/cmd/mkfiles/Makefile tests/zfs-tests/cmd/mktree/Makefile tests/zfs-tests/cmd/mmap_exec/Makefile tests/zfs-tests/cmd/mmap_libaio/Makefile tests/zfs-tests/cmd/mmapwrite/Makefile tests/zfs-tests/cmd/nvlist_to_lua/Makefile tests/zfs-tests/cmd/randfree_file/Makefile tests/zfs-tests/cmd/randwritecomp/Makefile tests/zfs-tests/cmd/readmmap/Makefile tests/zfs-tests/cmd/rename_dir/Makefile tests/zfs-tests/cmd/rm_lnkcnt_zero_file/Makefile tests/zfs-tests/cmd/stride_dd/Makefile tests/zfs-tests/cmd/threadsappend/Makefile tests/zfs-tests/cmd/user_ns_exec/Makefile tests/zfs-tests/cmd/xattrtest/Makefile tests/zfs-tests/include/Makefile tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile tests/zfs-tests/tests/functional/acl/posix/Makefile tests/zfs-tests/tests/functional/alloc_class/Makefile tests/zfs-tests/tests/functional/arc/Makefile tests/zfs-tests/tests/functional/atime/Makefile tests/zfs-tests/tests/functional/bootfs/Makefile tests/zfs-tests/tests/functional/btree/Makefile tests/zfs-tests/tests/functional/cache/Makefile tests/zfs-tests/tests/functional/cachefile/Makefile tests/zfs-tests/tests/functional/casenorm/Makefile tests/zfs-tests/tests/functional/channel_program/Makefile tests/zfs-tests/tests/functional/channel_program/lua_core/Makefile tests/zfs-tests/tests/functional/channel_program/synctask_core/Makefile tests/zfs-tests/tests/functional/chattr/Makefile tests/zfs-tests/tests/functional/checksum/Makefile tests/zfs-tests/tests/functional/clean_mirror/Makefile tests/zfs-tests/tests/functional/cli_root/Makefile tests/zfs-tests/tests/functional/cli_root/zdb/Makefile tests/zfs-tests/tests/functional/cli_root/zfs/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_bookmark/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_change-key/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_clone/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_copies/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_create/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_destroy/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_diff/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_get/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_ids_to_path/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_inherit/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_load-key/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_mount/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_program/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_promote/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_property/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_receive/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_rename/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_reservation/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_rollback/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_send/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_set/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_share/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_snapshot/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_sysfs/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_unload-key/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_unmount/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_unshare/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_upgrade/Makefile tests/zfs-tests/tests/functional/cli_root/zfs_wait/Makefile tests/zfs-tests/tests/functional/cli_root/zpool/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_add/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_attach/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_clear/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_create/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_destroy/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_detach/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_events/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_expand/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_export/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_get/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_history/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_import/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_import/blockfiles/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_initialize/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_labelclear/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_offline/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_online/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_remove/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_reopen/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_replace/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_resilver/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_scrub/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_set/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_split/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_status/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_sync/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_trim/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_upgrade/blockfiles/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_wait/Makefile tests/zfs-tests/tests/functional/cli_root/zpool_wait/scan/Makefile tests/zfs-tests/tests/functional/cli_user/Makefile tests/zfs-tests/tests/functional/cli_user/misc/Makefile tests/zfs-tests/tests/functional/cli_user/zfs_list/Makefile tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile tests/zfs-tests/tests/functional/cli_user/zpool_status/Makefile tests/zfs-tests/tests/functional/compression/Makefile tests/zfs-tests/tests/functional/cp_files/Makefile tests/zfs-tests/tests/functional/ctime/Makefile tests/zfs-tests/tests/functional/deadman/Makefile tests/zfs-tests/tests/functional/delegate/Makefile tests/zfs-tests/tests/functional/devices/Makefile tests/zfs-tests/tests/functional/events/Makefile tests/zfs-tests/tests/functional/exec/Makefile tests/zfs-tests/tests/functional/fallocate/Makefile tests/zfs-tests/tests/functional/fault/Makefile tests/zfs-tests/tests/functional/features/Makefile tests/zfs-tests/tests/functional/features/async_destroy/Makefile tests/zfs-tests/tests/functional/features/large_dnode/Makefile tests/zfs-tests/tests/functional/grow/Makefile tests/zfs-tests/tests/functional/history/Makefile tests/zfs-tests/tests/functional/hkdf/Makefile tests/zfs-tests/tests/functional/inheritance/Makefile tests/zfs-tests/tests/functional/inuse/Makefile tests/zfs-tests/tests/functional/io/Makefile tests/zfs-tests/tests/functional/large_files/Makefile tests/zfs-tests/tests/functional/largest_pool/Makefile tests/zfs-tests/tests/functional/libzfs/Makefile tests/zfs-tests/tests/functional/limits/Makefile tests/zfs-tests/tests/functional/link_count/Makefile tests/zfs-tests/tests/functional/log_spacemap/Makefile tests/zfs-tests/tests/functional/migration/Makefile tests/zfs-tests/tests/functional/mmap/Makefile tests/zfs-tests/tests/functional/mmp/Makefile tests/zfs-tests/tests/functional/mount/Makefile tests/zfs-tests/tests/functional/mv_files/Makefile tests/zfs-tests/tests/functional/nestedfs/Makefile tests/zfs-tests/tests/functional/no_space/Makefile tests/zfs-tests/tests/functional/nopwrite/Makefile tests/zfs-tests/tests/functional/online_offline/Makefile tests/zfs-tests/tests/functional/pam/Makefile tests/zfs-tests/tests/functional/persist_l2arc/Makefile tests/zfs-tests/tests/functional/pool_checkpoint/Makefile tests/zfs-tests/tests/functional/pool_names/Makefile tests/zfs-tests/tests/functional/poolversion/Makefile tests/zfs-tests/tests/functional/privilege/Makefile tests/zfs-tests/tests/functional/procfs/Makefile tests/zfs-tests/tests/functional/projectquota/Makefile tests/zfs-tests/tests/functional/pyzfs/Makefile tests/zfs-tests/tests/functional/quota/Makefile tests/zfs-tests/tests/functional/raidz/Makefile tests/zfs-tests/tests/functional/redacted_send/Makefile tests/zfs-tests/tests/functional/redundancy/Makefile tests/zfs-tests/tests/functional/refquota/Makefile tests/zfs-tests/tests/functional/refreserv/Makefile tests/zfs-tests/tests/functional/removal/Makefile tests/zfs-tests/tests/functional/rename_dirs/Makefile tests/zfs-tests/tests/functional/replacement/Makefile tests/zfs-tests/tests/functional/reservation/Makefile tests/zfs-tests/tests/functional/rootpool/Makefile tests/zfs-tests/tests/functional/rsend/Makefile tests/zfs-tests/tests/functional/scrub_mirror/Makefile tests/zfs-tests/tests/functional/slog/Makefile tests/zfs-tests/tests/functional/snapshot/Makefile tests/zfs-tests/tests/functional/snapused/Makefile tests/zfs-tests/tests/functional/sparse/Makefile tests/zfs-tests/tests/functional/suid/Makefile tests/zfs-tests/tests/functional/threadsappend/Makefile tests/zfs-tests/tests/functional/tmpfile/Makefile tests/zfs-tests/tests/functional/trim/Makefile tests/zfs-tests/tests/functional/truncate/Makefile tests/zfs-tests/tests/functional/upgrade/Makefile tests/zfs-tests/tests/functional/user_namespace/Makefile tests/zfs-tests/tests/functional/userquota/Makefile tests/zfs-tests/tests/functional/vdev_zaps/Makefile tests/zfs-tests/tests/functional/write_dirs/Makefile tests/zfs-tests/tests/functional/xattr/Makefile tests/zfs-tests/tests/functional/zvol/Makefile tests/zfs-tests/tests/functional/zvol/zvol_ENOSPC/Makefile tests/zfs-tests/tests/functional/zvol/zvol_cli/Makefile tests/zfs-tests/tests/functional/zvol/zvol_misc/Makefile tests/zfs-tests/tests/functional/zvol/zvol_swap/Makefile tests/zfs-tests/tests/perf/Makefile tests/zfs-tests/tests/perf/fio/Makefile tests/zfs-tests/tests/perf/regression/Makefile tests/zfs-tests/tests/perf/scripts/Makefile tests/zfs-tests/tests/stress/Makefile udev/Makefile udev/rules.d/Makefile zfs.release ]) AC_OUTPUT diff --git a/contrib/pam_zfs_key/Makefile.am b/contrib/pam_zfs_key/Makefile.am index 7feabcdcbb6d..a67153ddae28 100644 --- a/contrib/pam_zfs_key/Makefile.am +++ b/contrib/pam_zfs_key/Makefile.am @@ -1,17 +1,19 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBCRYPTO_CFLAGS) + pammodule_LTLIBRARIES=pam_zfs_key.la pam_zfs_key_la_SOURCES = pam_zfs_key.c pam_zfs_key_la_LIBADD = \ $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libuutil/libuutil.la \ $(top_builddir)/lib/libzfs/libzfs.la \ $(top_builddir)/lib/libzfs_core/libzfs_core.la pam_zfs_key_la_LDFLAGS = -version-info 1:0:0 -avoid-version -module -shared -pam_zfs_key_la_LIBADD += -lpam $(LIBSSL) +pam_zfs_key_la_LIBADD += -lpam $(LIBCRYPTO_LIBS) dist_pamconfigs_DATA = zfs_key diff --git a/lib/Makefile.am b/lib/Makefile.am index 4f59aa359c4b..02e7f7b5faca 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,14 +1,14 @@ # NB: GNU Automake Manual, Chapter 8.3.5: Libtool Convenience Libraries -# These six libraries are intermediary build components. +# These eight libraries are intermediary build components. SUBDIRS = libavl libicp libshare libspl libtpool if BUILD_LINUX SUBDIRS += libefi endif # libzutil depends on libefi if present SUBDIRS += libzutil libunicode -# These four libraries, which are installed as the final build product, -# incorporate the six convenience libraries given above. -SUBDIRS += libuutil libnvpair libzpool libzfs_core libzfs +# These five libraries, which are installed as the final build product, +# incorporate the eight convenience libraries given above. +SUBDIRS += libuutil libnvpair libzfs_core libzfs libzpool diff --git a/lib/libefi/Makefile.am b/lib/libefi/Makefile.am index 0ca04df46380..fab6c8d477a6 100644 --- a/lib/libefi/Makefile.am +++ b/lib/libefi/Makefile.am @@ -1,10 +1,12 @@ include $(top_srcdir)/config/Rules.am +AM_CFLAGS += $(LIBUUID_CFLAGS) $(ZLIB_CFLAGS) + noinst_LTLIBRARIES = libefi.la USER_C = \ rdwr_efi.c libefi_la_SOURCES = $(USER_C) -libefi_la_LIBADD = $(LIBUUID) +libefi_la_LIBADD = $(LIBUUID_LIBS) $(ZLIB_LIBS) diff --git a/lib/libicp/Makefile.am b/lib/libicp/Makefile.am index fad91e13cb34..6d3c65ea324f 100644 --- a/lib/libicp/Makefile.am +++ b/lib/libicp/Makefile.am @@ -1,75 +1,73 @@ include $(top_srcdir)/config/Rules.am VPATH = \ $(top_srcdir)/module/icp \ $(top_srcdir)/lib/libicp # Includes kernel code, generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) noinst_LTLIBRARIES = libicp.la if TARGET_CPU_X86_64 ASM_SOURCES_C = asm-x86_64/aes/aeskey.c ASM_SOURCES_AS = \ asm-x86_64/aes/aes_amd64.S \ asm-x86_64/aes/aes_aesni.S \ asm-x86_64/modes/gcm_pclmulqdq.S \ asm-x86_64/modes/aesni-gcm-x86_64.S \ asm-x86_64/modes/ghash-x86_64.S \ asm-x86_64/sha1/sha1-x86_64.S \ asm-x86_64/sha2/sha256_impl.S \ asm-x86_64/sha2/sha512_impl.S else ASM_SOURCES_C = ASM_SOURCES_AS = endif KERNEL_C = \ spi/kcf_spi.c \ api/kcf_ctxops.c \ api/kcf_digest.c \ api/kcf_cipher.c \ api/kcf_miscapi.c \ api/kcf_mac.c \ algs/aes/aes_impl_aesni.c \ algs/aes/aes_impl_generic.c \ algs/aes/aes_impl_x86-64.c \ algs/aes/aes_impl.c \ algs/aes/aes_modes.c \ algs/edonr/edonr.c \ algs/modes/modes.c \ algs/modes/cbc.c \ algs/modes/gcm_generic.c \ algs/modes/gcm_pclmulqdq.c \ algs/modes/gcm.c \ algs/modes/ctr.c \ algs/modes/ccm.c \ algs/modes/ecb.c \ algs/sha1/sha1.c \ algs/sha2/sha2.c \ algs/skein/skein.c \ algs/skein/skein_block.c \ algs/skein/skein_iv.c \ illumos-crypto.c \ io/aes.c \ io/edonr_mod.c \ io/sha1_mod.c \ io/sha2_mod.c \ io/skein_mod.c \ os/modhash.c \ os/modconf.c \ core/kcf_sched.c \ core/kcf_prov_lib.c \ core/kcf_callprov.c \ core/kcf_mech_tabs.c \ core/kcf_prov_tabs.c \ $(ASM_SOURCES_C) KERNEL_ASM = $(ASM_SOURCES_AS) nodist_libicp_la_SOURCES = \ $(KERNEL_C) \ $(KERNEL_ASM) - -libicp_la_LIBADD = -lrt diff --git a/lib/libnvpair/Makefile.am b/lib/libnvpair/Makefile.am index af99c84b7f43..c2971434211f 100644 --- a/lib/libnvpair/Makefile.am +++ b/lib/libnvpair/Makefile.am @@ -1,35 +1,40 @@ include $(top_srcdir)/config/Rules.am VPATH = \ $(top_srcdir)/module/nvpair \ $(top_srcdir)/lib/libnvpair # Includes kernel code, generate warnings for large stack frames # and required CFLAGS for libtirpc AM_CFLAGS += $(FRAME_LARGER_THAN) $(LIBTIRPC_CFLAGS) lib_LTLIBRARIES = libnvpair.la USER_C = \ libnvpair.c \ libnvpair_json.c \ nvpair_alloc_system.c KERNEL_C = \ nvpair_alloc_fixed.c \ nvpair.c \ fnvpair.c dist_libnvpair_la_SOURCES = \ $(USER_C) nodist_libnvpair_la_SOURCES = \ $(KERNEL_C) +libnvpair_la_LIBADD = \ + $(top_builddir)/lib/libspl/libspl_assert.la + +libnvpair_la_LIBADD += \ + $(LIBTIRPC_LIBS) + if BUILD_FREEBSD -libnvpair_la_LIBADD = $(LIBTIRPC_LIBS) -L/usr/local/lib -lintl +libnvpair_la_LIBADD += -L/usr/local/lib -lintl libnvpair_la_LDFLAGS = -version-info 3:0:0 else -libnvpair_la_LIBADD = $(LIBTIRPC_LIBS) libnvpair_la_LDFLAGS = -version-info 1:1:0 endif diff --git a/lib/libspl/Makefile.am b/lib/libspl/Makefile.am index ad34c3588cdd..f576d69248fa 100644 --- a/lib/libspl/Makefile.am +++ b/lib/libspl/Makefile.am @@ -1,58 +1,56 @@ include $(top_srcdir)/config/Rules.am if TARGET_CPU_I386 TARGET_CPU_ATOMIC_SOURCE = asm-i386/atomic.S else if TARGET_CPU_X86_64 TARGET_CPU_ATOMIC_SOURCE = asm-x86_64/atomic.S else TARGET_CPU_ATOMIC_SOURCE = asm-generic/atomic.c endif endif SUBDIRS = include -AM_CFLAGS += $(LIBTIRPC_CFLAGS) - AM_CCASFLAGS = \ $(CFLAGS) noinst_LTLIBRARIES = libspl_assert.la libspl.la libspl_assert_la_SOURCES = \ assert.c USER_C = \ list.c \ mkdirp.c \ page.c \ strlcat.c \ strlcpy.c \ timestamp.c \ zone.c \ include/sys/list.h \ include/sys/list_impl.h if BUILD_LINUX USER_C += \ os/linux/getexecname.c \ os/linux/gethostid.c \ os/linux/getmntany.c endif if BUILD_FREEBSD USER_C += \ os/freebsd/getexecname.c \ os/freebsd/gethostid.c \ os/freebsd/getmntany.c \ os/freebsd/mnttab.c endif libspl_la_SOURCES = \ $(USER_C) \ $(TARGET_CPU_ATOMIC_SOURCE) libspl_la_LIBADD = \ libspl_assert.la -libspl_la_LIBADD += -lrt $(LIBTIRPC_LIBS) +libspl_la_LIBADD += $(LIBCLOCK_GETTIME) diff --git a/lib/libtpool/Makefile.am b/lib/libtpool/Makefile.am index 818f49ce4cd2..22bfa4b23a8f 100644 --- a/lib/libtpool/Makefile.am +++ b/lib/libtpool/Makefile.am @@ -1,14 +1,9 @@ include $(top_srcdir)/config/Rules.am noinst_LTLIBRARIES = libtpool.la USER_C = \ thread_pool.c \ thread_pool_impl.h libtpool_la_SOURCES = $(USER_C) - -libtpool_la_LIBADD = \ - $(top_builddir)/lib/libspl/libspl.la - -libtpool_la_LDFLAGS = -pthread diff --git a/lib/libuutil/Makefile.am b/lib/libuutil/Makefile.am index 37f2eb65b837..2d8eab681862 100644 --- a/lib/libuutil/Makefile.am +++ b/lib/libuutil/Makefile.am @@ -1,26 +1,28 @@ include $(top_srcdir)/config/Rules.am lib_LTLIBRARIES = libuutil.la USER_C = \ uu_alloc.c \ uu_avl.c \ uu_dprintf.c \ uu_ident.c \ uu_list.c \ uu_misc.c \ uu_open.c \ uu_pname.c \ uu_string.c libuutil_la_SOURCES = $(USER_C) libuutil_la_LIBADD = \ $(top_builddir)/lib/libavl/libavl.la \ $(top_builddir)/lib/libspl/libspl.la +libuutil_la_LDFLAGS = -pthread + if BUILD_FREEBSD -libuutil_la_LDFLAGS = -pthread -version-info 3:0:0 +libuutil_la_LDFLAGS += -version-info 3:0:0 else -libuutil_la_LDFLAGS = -pthread -version-info 1:1:0 +libuutil_la_LDFLAGS += -version-info 1:1:0 endif diff --git a/lib/libzfs/.gitignore b/lib/libzfs/.gitignore index d719bc1ad986..9336a5c00b46 100644 --- a/lib/libzfs/.gitignore +++ b/lib/libzfs/.gitignore @@ -1,2 +1 @@ /libzfs.pc -/libzfs_core.pc diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am index efdac5ea1a95..836669e2a47d 100644 --- a/lib/libzfs/Makefile.am +++ b/lib/libzfs/Makefile.am @@ -1,93 +1,96 @@ include $(top_srcdir)/config/Rules.am VPATH = \ $(top_srcdir)/module/icp \ $(top_srcdir)/module/zcommon \ $(top_srcdir)/lib/libzfs # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) +AM_CFLAGS += $(LIBCRYPTO_CFLAGS) $(ZLIB_CFLAGS) -libzfs_pcdir = $(datarootdir)/pkgconfig -libzfs_pc_DATA = libzfs.pc libzfs_core.pc +pkgconfig_DATA = libzfs.pc lib_LTLIBRARIES = libzfs.la USER_C = \ libzfs_changelist.c \ libzfs_config.c \ libzfs_crypto.c \ libzfs_dataset.c \ libzfs_diff.c \ libzfs_import.c \ libzfs_iter.c \ libzfs_mount.c \ libzfs_pool.c \ libzfs_sendrecv.c \ libzfs_status.c \ libzfs_util.c if BUILD_FREEBSD USER_C += \ os/freebsd/libzfs_fsshare.c \ os/freebsd/libzfs_compat.c \ os/freebsd/libzfs_ioctl_compat.c \ os/freebsd/libzfs_zmount.c endif if BUILD_LINUX USER_C += \ os/linux/libzfs_mount_os.c \ os/linux/libzfs_pool_os.c \ os/linux/libzfs_sendrecv_os.c \ os/linux/libzfs_util_os.c endif KERNEL_C = \ algs/sha2/sha2.c \ cityhash.c \ zfeature_common.c \ zfs_comutil.c \ zfs_deleg.c \ zfs_fletcher.c \ zfs_fletcher_aarch64_neon.c \ zfs_fletcher_avx512.c \ zfs_fletcher_intel.c \ zfs_fletcher_sse.c \ zfs_fletcher_superscalar.c \ zfs_fletcher_superscalar4.c \ zfs_namecheck.c \ zfs_prop.c \ zfs_uio.c \ zpool_prop.c \ zprop_common.c dist_libzfs_la_SOURCES = \ $(USER_C) nodist_libzfs_la_SOURCES = \ $(KERNEL_C) -libzfs_la_LIBADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la \ - $(top_builddir)/lib/libzutil/libzutil.la +libzfs_la_LIBADD = if BUILD_LINUX libzfs_la_LIBADD += \ $(top_builddir)/lib/libshare/libshare.la endif +libzfs_la_LIBADD += \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la \ + $(top_builddir)/lib/libuutil/libuutil.la + +libzfs_la_LIBADD += -lm $(LIBCRYPTO_LIBS) $(ZLIB_LIBS) + +libzfs_la_LDFLAGS = -pthread + if BUILD_FREEBSD libzfs_la_LIBADD += -lutil -lgeom -libzfs_la_LDFLAGS = -version-info 4:0:0 +libzfs_la_LDFLAGS += -version-info 4:0:0 else -libzfs_la_LDFLAGS = -version-info 2:0:0 +libzfs_la_LDFLAGS += -version-info 2:0:0 endif -libzfs_la_LIBADD += -lm $(LIBSSL) - # Licensing data EXTRA_DIST = THIRDPARTYLICENSE.openssl THIRDPARTYLICENSE.openssl.descrip diff --git a/lib/libzfs/libzfs.pc.in b/lib/libzfs/libzfs.pc.in index d09e19fb0d4c..6caf49d221f1 100644 --- a/lib/libzfs/libzfs.pc.in +++ b/lib/libzfs/libzfs.pc.in @@ -1,12 +1,14 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libzfs Description: LibZFS library Version: @VERSION@ URL: https://zfsonlinux.org Requires: libzfs_core +Requires.private: libcrypto zlib Cflags: -I${includedir}/libzfs -I${includedir}/libspl Libs: -L${libdir} -lzfs -lnvpair +Libs.private: -luutil -lm -pthread diff --git a/lib/libzfs/.gitignore b/lib/libzfs_core/.gitignore similarity index 59% copy from lib/libzfs/.gitignore copy to lib/libzfs_core/.gitignore index d719bc1ad986..c428d6369033 100644 --- a/lib/libzfs/.gitignore +++ b/lib/libzfs_core/.gitignore @@ -1,2 +1 @@ -/libzfs.pc /libzfs_core.pc diff --git a/lib/libzfs_core/Makefile.am b/lib/libzfs_core/Makefile.am index 69ddabd88f4c..44940e9157a9 100644 --- a/lib/libzfs_core/Makefile.am +++ b/lib/libzfs_core/Makefile.am @@ -1,20 +1,23 @@ include $(top_srcdir)/config/Rules.am +pkgconfig_DATA = libzfs_core.pc + lib_LTLIBRARIES = libzfs_core.la USER_C = \ libzfs_core.c libzfs_core_la_SOURCES = $(USER_C) libzfs_core_la_LIBADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libuutil/libuutil.la \ - $(top_builddir)/lib/libzutil/libzutil.la + $(top_builddir)/lib/libzutil/libzutil.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la + +libzfs_core_la_LDFLAGS = -pthread if BUILD_FREEBSD -libzfs_core_la_LDFLAGS = -version-info 3:0:0 libzfs_core_la_LIBADD += -lutil -lgeom +libzfs_core_la_LDFLAGS += -version-info 3:0:0 else -libzfs_core_la_LDFLAGS = -version-info 1:0:0 +libzfs_core_la_LDFLAGS += -version-info 1:0:0 endif diff --git a/lib/libzfs/libzfs_core.pc.in b/lib/libzfs_core/libzfs_core.pc.in similarity index 62% rename from lib/libzfs/libzfs_core.pc.in rename to lib/libzfs_core/libzfs_core.pc.in index 9f5c6462d392..e14d42d11a5d 100644 --- a/lib/libzfs/libzfs_core.pc.in +++ b/lib/libzfs_core/libzfs_core.pc.in @@ -1,11 +1,13 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: libzfs_core Description: LibZFS core library Version: @VERSION@ URL: https://zfsonlinux.org +Requires.private: blkid uuid libtirpc zlib Cflags: -I${includedir}/libzfs -I${includedir}/libspl -Libs: -L${libdir} -lzfs_core +Libs: -L${libdir} -lzfs_core -lnvpair +Libs.private: @LIBCLOCK_GETTIME@ @LIBUDEV_LIBS@ -lm -pthread diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am index 06b89fe0a64f..bce45acc203b 100644 --- a/lib/libzpool/Makefile.am +++ b/lib/libzpool/Makefile.am @@ -1,217 +1,222 @@ include $(top_srcdir)/config/Rules.am VPATH = \ $(top_srcdir)/module/zfs \ $(top_srcdir)/module/zcommon \ $(top_srcdir)/module/lua \ $(top_srcdir)/module/os/linux/zfs \ $(top_srcdir)/lib/libzpool # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) # Includes kernel code generate warnings for large stack frames AM_CFLAGS += $(FRAME_LARGER_THAN) +AM_CFLAGS += $(ZLIB_CFLAGS) + AM_CFLAGS += -DLIB_ZPOOL_BUILD lib_LTLIBRARIES = libzpool.la USER_C = \ kernel.c \ taskq.c \ util.c KERNEL_C = \ zfeature_common.c \ zfs_comutil.c \ zfs_deleg.c \ zfs_fletcher.c \ zfs_fletcher_aarch64_neon.c \ zfs_fletcher_avx512.c \ zfs_fletcher_intel.c \ zfs_fletcher_sse.c \ zfs_fletcher_superscalar.c \ zfs_fletcher_superscalar4.c \ zfs_namecheck.c \ zfs_prop.c \ zfs_uio.c \ zpool_prop.c \ zprop_common.c \ abd.c \ abd_os.c \ aggsum.c \ arc.c \ arc_os.c \ blkptr.c \ bplist.c \ bpobj.c \ bptree.c \ btree.c \ bqueue.c \ cityhash.c \ dbuf.c \ dbuf_stats.c \ ddt.c \ ddt_zap.c \ dmu.c \ dmu_diff.c \ dmu_object.c \ dmu_objset.c \ dmu_recv.c \ dmu_redact.c \ dmu_send.c \ dmu_traverse.c \ dmu_tx.c \ dmu_zfetch.c \ dnode.c \ dnode_sync.c \ dsl_bookmark.c \ dsl_dataset.c \ dsl_deadlist.c \ dsl_deleg.c \ dsl_dir.c \ dsl_crypt.c \ dsl_pool.c \ dsl_prop.c \ dsl_scan.c \ dsl_synctask.c \ dsl_destroy.c \ dsl_userhold.c \ edonr_zfs.c \ hkdf.c \ fm.c \ gzip.c \ lzjb.c \ lz4.c \ metaslab.c \ mmp.c \ multilist.c \ objlist.c \ pathname.c \ range_tree.c \ refcount.c \ rrwlock.c \ sa.c \ sha256.c \ skein_zfs.c \ spa.c \ spa_boot.c \ spa_checkpoint.c \ spa_config.c \ spa_errlog.c \ spa_history.c \ spa_log_spacemap.c \ spa_misc.c \ spa_stats.c \ space_map.c \ space_reftree.c \ txg.c \ trace.c \ uberblock.c \ unique.c \ vdev.c \ vdev_cache.c \ vdev_file.c \ vdev_indirect_births.c \ vdev_indirect.c \ vdev_indirect_mapping.c \ vdev_initialize.c \ vdev_label.c \ vdev_mirror.c \ vdev_missing.c \ vdev_queue.c \ vdev_raidz.c \ vdev_raidz_math_aarch64_neon.c \ vdev_raidz_math_aarch64_neonx2.c \ vdev_raidz_math_avx2.c \ vdev_raidz_math_avx512bw.c \ vdev_raidz_math_avx512f.c \ vdev_raidz_math.c \ vdev_raidz_math_scalar.c \ vdev_raidz_math_sse2.c \ vdev_raidz_math_ssse3.c \ vdev_raidz_math_powerpc_altivec.c \ vdev_rebuild.c \ vdev_removal.c \ vdev_root.c \ vdev_trim.c \ zap.c \ zap_leaf.c \ zap_micro.c \ zcp.c \ zcp_get.c \ zcp_global.c \ zcp_iter.c \ zcp_set.c \ zcp_synctask.c \ zfeature.c \ zfs_byteswap.c \ zfs_debug.c \ zfs_fm.c \ zfs_fuid.c \ zfs_sa.c \ zfs_znode.c \ zfs_ratelimit.c \ zfs_rlock.c \ zil.c \ zio.c \ zio_checksum.c \ zio_compress.c \ zio_crypt.c \ zio_inject.c \ zle.c \ zrlock.c \ zthr.c LUA_C = \ lapi.c \ lauxlib.c \ lbaselib.c \ lcode.c \ lcompat.c \ lcorolib.c \ lctype.c \ ldebug.c \ ldo.c \ lfunc.c \ lgc.c \ llex.c \ lmem.c \ lobject.c \ lopcodes.c \ lparser.c \ lstate.c \ lstring.c \ lstrlib.c \ ltable.c \ ltablib.c \ ltm.c \ lvm.c \ lzio.c dist_libzpool_la_SOURCES = \ $(USER_C) nodist_libzpool_la_SOURCES = \ $(KERNEL_C) \ $(LUA_C) libzpool_la_LIBADD = \ $(top_builddir)/lib/libicp/libicp.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ $(top_builddir)/lib/libunicode/libunicode.la \ - $(top_builddir)/lib/libzutil/libzutil.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la + +libzpool_la_LIBADD += $(LIBCLOCK_GETTIME) $(ZLIB_LIBS) -ldl + +libzpool_la_LDFLAGS = -pthread if BUILD_FREEBSD -libzpool_la_LIBADD += $(ZLIB) -ldl -lgeom -libzpool_la_LDFLAGS = -pthread -version-info 4:0:0 +libzpool_la_LIBADD += -lgeom +libzpool_la_LDFLAGS += -version-info 4:0:0 else -libzpool_la_LIBADD += $(ZLIB) -ldl -libzpool_la_LDFLAGS = -pthread -version-info 2:0:0 +libzpool_la_LDFLAGS += -version-info 2:0:0 endif if TARGET_CPU_POWERPC vdev_raidz_math_powerpc_altivec.$(OBJEXT): CFLAGS += -maltivec vdev_raidz_math_powerpc_altivec.l$(OBJEXT): CFLAGS += -maltivec endif diff --git a/lib/libzutil/Makefile.am b/lib/libzutil/Makefile.am index c11da9e9d296..af1911760add 100644 --- a/lib/libzutil/Makefile.am +++ b/lib/libzutil/Makefile.am @@ -1,42 +1,44 @@ include $(top_srcdir)/config/Rules.am # Suppress unused but set variable warnings often due to ASSERTs AM_CFLAGS += $(NO_UNUSED_BUT_SET_VARIABLE) +AM_CFLAGS += $(LIBBLKID_CFLAGS) $(LIBUDEV_CFLAGS) DEFAULT_INCLUDES += -I$(srcdir) noinst_LTLIBRARIES = libzutil.la USER_C = \ zutil_device_path.c \ zutil_import.c \ zutil_import.h \ zutil_nicenum.c \ zutil_pool.c if BUILD_LINUX USER_C += \ os/linux/zutil_device_path_os.c \ os/linux/zutil_import_os.c \ os/linux/zutil_compat.c endif if BUILD_FREEBSD USER_C += \ os/freebsd/zutil_device_path_os.c \ os/freebsd/zutil_import_os.c \ os/freebsd/zutil_compat.c endif libzutil_la_SOURCES = $(USER_C) libzutil_la_LIBADD = \ $(top_builddir)/lib/libavl/libavl.la \ - $(top_builddir)/lib/libtpool/libtpool.la + $(top_builddir)/lib/libtpool/libtpool.la \ + $(top_builddir)/lib/libspl/libspl.la if BUILD_LINUX libzutil_la_LIBADD += \ $(top_builddir)/lib/libefi/libefi.la endif -libzutil_la_LIBADD += -lm $(LIBBLKID) $(LIBUDEV) +libzutil_la_LIBADD += -lm $(LIBBLKID_LIBS) $(LIBUDEV_LIBS) diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index e972a10eee88..e0bed4cc4874 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -1,516 +1,521 @@ %global _sbindir /sbin %global _libdir /%{_lib} # Set the default udev directory based on distribution. %if %{undefined _udevdir} %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 %global _udevdir %{_prefix}/lib/udev %else %global _udevdir /lib/udev %endif %endif # Set the default udevrule directory based on distribution. %if %{undefined _udevruledir} %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 %global _udevruledir %{_prefix}/lib/udev/rules.d %else %global _udevruledir /lib/udev/rules.d %endif %endif # Set the default dracut directory based on distribution. %if %{undefined _dracutdir} %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7 %global _dracutdir %{_prefix}/lib/dracut %else %global _dracutdir %{_prefix}/share/dracut %endif %endif %if %{undefined _initconfdir} %global _initconfdir /etc/sysconfig %endif %if %{undefined _unitdir} %global _unitdir %{_prefix}/lib/systemd/system %endif %if %{undefined _presetdir} %global _presetdir %{_prefix}/lib/systemd/system-preset %endif %if %{undefined _modulesloaddir} %global _modulesloaddir %{_prefix}/lib/modules-load.d %endif %if %{undefined _systemdgeneratordir} %global _systemdgeneratordir %{_prefix}/lib/systemd/system-generators %endif +%if %{undefined _pkgconfigdir} +%global _pkgconfigdir %{_prefix}/%{_lib}/pkgconfig +%endif + %bcond_with debug %bcond_with debuginfo %bcond_with asan %bcond_with systemd %bcond_with pam # Generic enable switch for systemd %if %{with systemd} %define _systemd 1 %endif # RHEL >= 7 comes with systemd %if 0%{?rhel} >= 7 %define _systemd 1 %endif # Fedora >= 15 comes with systemd, but only >= 18 has # the proper macros %if 0%{?fedora} >= 18 %define _systemd 1 %endif # opensuse >= 12.1 comes with systemd, but only >= 13.1 # has the proper macros %if 0%{?suse_version} >= 1310 %define _systemd 1 %endif # When not specified default to distribution provided version. This # is normally Python 3, but for RHEL <= 7 only Python 2 is provided. %if %{undefined __use_python} %if 0%{?rhel} && 0%{?rhel} <= 7 %define __python /usr/bin/python2 %define __python_pkg_version 2 %define __python_cffi_pkg python-cffi %define __python_setuptools_pkg python-setuptools %else %define __python /usr/bin/python3 %define __python_pkg_version 3 %define __python_cffi_pkg python3-cffi %define __python_setuptools_pkg python3-setuptools %endif %else %define __python %{__use_python} %define __python_pkg_version %{__use_python_pkg_version} %define __python_cffi_pkg python%{__python_pkg_version}-cffi %define __python_setuptools_pkg python%{__python_pkg_version}-setuptools %endif %define __python_sitelib %(%{__python} -Esc "from distutils.sysconfig import get_python_lib; print(get_python_lib())") # By default python-pyzfs is enabled, with the exception of # RHEL 6 which by default uses Python 2.6 which is too old. %if 0%{?rhel} == 6 %bcond_with pyzfs %else %bcond_without pyzfs %endif Name: @PACKAGE@ Version: @VERSION@ Release: @RELEASE@%{?dist} Summary: Commands to control the kernel modules and libraries Group: System Environment/Kernel License: @ZFS_META_LICENSE@ URL: https://zfsonlinux.org/ Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: libzpool2 = %{version} Requires: libnvpair1 = %{version} Requires: libuutil1 = %{version} Requires: libzfs2 = %{version} Requires: %{name}-kmod = %{version} Provides: %{name}-kmod-common = %{version} Obsoletes: spl # zfs-fuse provides the same commands and man pages that ZoL does. Renaming # those on either side would conflict with all available documentation. Conflicts: zfs-fuse %if 0%{?rhel}%{?fedora}%{?suse_version} BuildRequires: gcc, make BuildRequires: zlib-devel BuildRequires: libuuid-devel BuildRequires: libblkid-devel BuildRequires: libudev-devel BuildRequires: libattr-devel BuildRequires: openssl-devel %if 0%{?fedora} >= 28 || 0%{?rhel} >= 8 || 0%{?centos} >= 8 BuildRequires: libtirpc-devel %endif Requires: openssl %if 0%{?_systemd} BuildRequires: systemd %endif %endif %if 0%{?_systemd} Requires(post): systemd Requires(preun): systemd Requires(postun): systemd %endif # The zpool iostat/status -c scripts call some utilities like lsblk and iostat Requires: util-linux Requires: sysstat %description This package contains the core ZFS command line utilities. %package -n libzpool2 Summary: Native ZFS pool library for Linux Group: System Environment/Kernel %description -n libzpool2 This package contains the zpool library, which provides support for managing zpools %post -n libzpool2 -p /sbin/ldconfig %postun -n libzpool2 -p /sbin/ldconfig %package -n libnvpair1 Summary: Solaris name-value library for Linux Group: System Environment/Kernel %description -n libnvpair1 This package contains routines for packing and unpacking name-value pairs. This functionality is used to portably transport data across process boundaries, between kernel and user space, and can be used to write self describing data structures on disk. %post -n libnvpair1 -p /sbin/ldconfig %postun -n libnvpair1 -p /sbin/ldconfig %package -n libuutil1 Summary: Solaris userland utility library for Linux Group: System Environment/Kernel %description -n libuutil1 This library provides a variety of compatibility functions for ZFS on Linux: * libspl: The Solaris Porting Layer userland library, which provides APIs that make it possible to run Solaris user code in a Linux environment with relatively minimal modification. * libavl: The Adelson-Velskii Landis balanced binary tree manipulation library. * libefi: The Extensible Firmware Interface library for GUID disk partitioning. * libshare: NFS, SMB, and iSCSI service integration for ZFS. %post -n libuutil1 -p /sbin/ldconfig %postun -n libuutil1 -p /sbin/ldconfig %package -n libzfs2 Summary: Native ZFS filesystem library for Linux Group: System Environment/Kernel %description -n libzfs2 This package provides support for managing ZFS filesystems %post -n libzfs2 -p /sbin/ldconfig %postun -n libzfs2 -p /sbin/ldconfig %package -n libzfs2-devel Summary: Development headers Group: System Environment/Kernel Requires: libzfs2 = %{version} Requires: libzpool2 = %{version} Requires: libnvpair1 = %{version} Requires: libuutil1 = %{version} Provides: libzpool2-devel Provides: libnvpair1-devel Provides: libuutil1-devel Obsoletes: zfs-devel %description -n libzfs2-devel This package contains the header files needed for building additional applications against the ZFS libraries. %package test Summary: Test infrastructure Group: System Environment/Kernel Requires: %{name}%{?_isa} = %{version}-%{release} Requires: parted Requires: lsscsi Requires: mdadm Requires: bc Requires: ksh Requires: fio Requires: acl Requires: sudo Requires: sysstat Requires: libaio Requires: python%{__python_pkg_version} %if 0%{?rhel}%{?fedora}%{?suse_version} BuildRequires: libaio-devel %endif AutoReqProv: no %description test This package contains test infrastructure and support scripts for validating the file system. %package dracut Summary: Dracut module Group: System Environment/Kernel BuildArch: noarch Requires: %{name} >= %{version} Requires: dracut Requires: /usr/bin/awk Requires: grep %description dracut This package contains a dracut module used to construct an initramfs image which is ZFS aware. %if %{with pyzfs} %package -n python%{__python_pkg_version}-pyzfs Summary: Python %{python_version} wrapper for libzfs_core Group: Development/Languages/Python License: Apache-2.0 BuildArch: noarch Requires: libzfs2 = %{version} Requires: libnvpair1 = %{version} Requires: libffi Requires: python%{__python_pkg_version} Requires: %{__python_cffi_pkg} %if 0%{?rhel}%{?fedora}%{?suse_version} BuildRequires: python%{__python_pkg_version}-devel BuildRequires: %{__python_cffi_pkg} BuildRequires: %{__python_setuptools_pkg} BuildRequires: libffi-devel %endif %description -n python%{__python_pkg_version}-pyzfs This package provides a python wrapper for the libzfs_core C library. %endif %if 0%{?_initramfs} %package initramfs Summary: Initramfs module Group: System Environment/Kernel Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name} = %{version}-%{release} Requires: initramfs-tools %description initramfs This package contains a initramfs module used to construct an initramfs image which is ZFS aware. %endif %prep %if %{with debug} %define debug --enable-debug %else %define debug --disable-debug %endif %if %{with debuginfo} %define debuginfo --enable-debuginfo %else %define debuginfo --disable-debuginfo %endif %if %{with asan} %define asan --enable-asan %else %define asan --disable-asan %endif %if 0%{?_systemd} %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --with-systemdmodulesloaddir=%{_modulesloaddir} --with-systemdgeneratordir=%{_systemdgeneratordir} --disable-sysvinit %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target zfs-import.target zfs-volume-wait.service zfs-volumes.target %else %define systemd --enable-sysvinit --disable-systemd %endif %if %{with pyzfs} %define pyzfs --enable-pyzfs %else %define pyzfs --disable-pyzfs %endif %if %{with pam} %define pam --enable-pam %else %define pam --disable-pam %endif %setup -q %build %configure \ --with-config=user \ --with-udevdir=%{_udevdir} \ --with-udevruledir=%{_udevruledir} \ --with-dracutdir=%{_dracutdir} \ --with-python=%{__python} \ + --with-pkgconfigdir=%{_pkgconfigdir} \ --disable-static \ %{debug} \ %{debuginfo} \ %{asan} \ %{systemd} \ --with-pammoduledir=%{_libdir}/security %{pam} \ %{pyzfs} make %{?_smp_mflags} %install %{__rm} -rf $RPM_BUILD_ROOT make install DESTDIR=%{?buildroot} find %{?buildroot}%{_libdir} -name '*.la' -exec rm -f {} \; %if 0%{!?__brp_mangle_shebangs:1} find %{?buildroot}%{_bindir} \ \( -name arc_summary -or -name arcstat -or -name dbufstat \) \ -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \; find %{?buildroot}%{_datadir} \ \( -name test-runner.py -or -name zts-report.py \) \ -exec %{__sed} -i 's|^#!.*|#!%{__python}|' {} \; %endif %post %if 0%{?_systemd} %if 0%{?systemd_post:1} %systemd_post %{systemd_svcs} %else if [ "$1" = "1" -o "$1" = "install" ] ; then # Initial installation systemctl preset %{systemd_svcs} >/dev/null || true fi %endif %else if [ -x /sbin/chkconfig ]; then /sbin/chkconfig --add zfs-import /sbin/chkconfig --add zfs-mount /sbin/chkconfig --add zfs-share /sbin/chkconfig --add zfs-zed fi %endif exit 0 # On RHEL/CentOS 7 the static nodes aren't refreshed by default after # installing a package. This is the default behavior for Fedora. %posttrans %if 0%{?rhel} == 7 || 0%{?centos} == 7 systemctl restart kmod-static-nodes systemctl restart systemd-tmpfiles-setup-dev udevadm trigger %endif %preun %if 0%{?_systemd} %if 0%{?systemd_preun:1} %systemd_preun %{systemd_svcs} %else if [ "$1" = "0" -o "$1" = "remove" ] ; then # Package removal, not upgrade systemctl --no-reload disable %{systemd_svcs} >/dev/null || true systemctl stop %{systemd_svcs} >/dev/null || true fi %endif %else if [ "$1" = "0" -o "$1" = "remove" ] && [ -x /sbin/chkconfig ]; then /sbin/chkconfig --del zfs-import /sbin/chkconfig --del zfs-mount /sbin/chkconfig --del zfs-share /sbin/chkconfig --del zfs-zed fi %endif exit 0 %postun %if 0%{?_systemd} %if 0%{?systemd_postun:1} %systemd_postun %{systemd_svcs} %else systemctl --system daemon-reload >/dev/null || true %endif %endif %files # Core utilities %{_sbindir}/* %{_bindir}/raidz_test %{_bindir}/zgenhostid %{_bindir}/zvol_wait # Optional Python 2/3 scripts %{_bindir}/arc_summary %{_bindir}/arcstat %{_bindir}/dbufstat # Man pages %{_mandir}/man1/* %{_mandir}/man5/* %{_mandir}/man8/* # Configuration files and scripts %{_libexecdir}/%{name} %{_udevdir}/vdev_id %{_udevdir}/zvol_id %{_udevdir}/rules.d/* %if ! 0%{?_systemd} || 0%{?_initramfs} # Files needed for sysvinit and initramfs-tools %{_sysconfdir}/%{name}/zfs-functions %config(noreplace) %{_initconfdir}/zfs %else %exclude %{_sysconfdir}/%{name}/zfs-functions %exclude %{_initconfdir}/zfs %endif %if 0%{?_systemd} %{_unitdir}/* %{_presetdir}/* %{_modulesloaddir}/* %{_systemdgeneratordir}/* %else %config(noreplace) %{_sysconfdir}/init.d/* %endif %config(noreplace) %{_sysconfdir}/%{name}/zed.d/* %config(noreplace) %{_sysconfdir}/%{name}/zpool.d/* %config(noreplace) %{_sysconfdir}/%{name}/vdev_id.conf.*.example %attr(440, root, root) %config(noreplace) %{_sysconfdir}/sudoers.d/* %if %{with pam} %{_libdir}/security/* %{_pamconfigsdir}/* %endif %files -n libzpool2 %{_libdir}/libzpool.so.* %files -n libnvpair1 %{_libdir}/libnvpair.so.* %files -n libuutil1 %{_libdir}/libuutil.so.* %files -n libzfs2 %{_libdir}/libzfs*.so.* %files -n libzfs2-devel -%{_datarootdir}/pkgconfig/libzfs.pc -%{_datarootdir}/pkgconfig/libzfs_core.pc +%{_pkgconfigdir}/libzfs.pc +%{_pkgconfigdir}/libzfs_core.pc %{_libdir}/*.so %{_includedir}/* %doc AUTHORS COPYRIGHT LICENSE NOTICE README.md %files test %{_datadir}/%{name} %files dracut %doc contrib/dracut/README.dracut.markdown %{_dracutdir}/modules.d/* %if %{with pyzfs} %files -n python%{__python_pkg_version}-pyzfs %doc contrib/pyzfs/README %doc contrib/pyzfs/LICENSE %defattr(-,root,root,-) %{__python_sitelib}/libzfs_core/* %{__python_sitelib}/pyzfs* %endif %if 0%{?_initramfs} %files initramfs %doc contrib/initramfs/README.initramfs.markdown /usr/share/initramfs-tools/* %else # Since we're not building the initramfs package, # ignore those files. %exclude /usr/share/initramfs-tools %endif diff --git a/tests/zfs-tests/cmd/btree_test/Makefile.am b/tests/zfs-tests/cmd/btree_test/Makefile.am index bf09cdb82da4..55c40e3f5c8f 100644 --- a/tests/zfs-tests/cmd/btree_test/Makefile.am +++ b/tests/zfs-tests/cmd/btree_test/Makefile.am @@ -1,33 +1,32 @@ # # This file and its contents are supplied under the terms of the # Common Development and Distribution License ("CDDL"), version 1.0. # You may only use this file in accordance with the terms of version # 1.0 of the CDDL. # # A full copy of the text of the CDDL should have accompanied this # source. A copy of the CDDL is also available via the Internet at # http://www.illumos.org/license/CDDL. # # # Copyright (c) 2019 by Delphix. All rights reserved. # include $(top_srcdir)/config/Rules.am pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin DEFAULT_INCLUDES += \ -I$(top_srcdir)/include \ -I$(top_srcdir)/lib/libspl/include # Unconditionally enable ASSERTs AM_CPPFLAGS += -DDEBUG -UNDEBUG pkgexec_PROGRAMS = btree_test btree_test_SOURCES = btree_test.c btree_test_LDADD = \ - $(top_builddir)/lib/libavl/libavl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la + $(top_builddir)/lib/libzpool/libzpool.la \ + $(top_builddir)/lib/libzfs_core/libzfs_core.la diff --git a/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am b/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am index 32cc46561ff6..67fa98886a3f 100644 --- a/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am +++ b/tests/zfs-tests/cmd/libzfs_input_check/Makefile.am @@ -1,11 +1,10 @@ include $(top_srcdir)/config/Rules.am pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin pkgexec_PROGRAMS = libzfs_input_check libzfs_input_check_SOURCES = libzfs_input_check.c libzfs_input_check_LDADD = \ - $(top_builddir)/lib/libspl/libspl.la \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/tests/zfs-tests/cmd/mmap_libaio/Makefile.am b/tests/zfs-tests/cmd/mmap_libaio/Makefile.am index 67d0f0ecedb9..25f9dda2b623 100644 --- a/tests/zfs-tests/cmd/mmap_libaio/Makefile.am +++ b/tests/zfs-tests/cmd/mmap_libaio/Makefile.am @@ -1,9 +1,10 @@ include $(top_srcdir)/config/Rules.am pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin if WANT_MMAP_LIBAIO pkgexec_PROGRAMS = mmap_libaio mmap_libaio_SOURCES = mmap_libaio.c -mmap_libaio_LDADD = $(LIBAIO) +mmap_libaio_CFLAGS = $(AM_CFLAGS) $(LIBAIO_CFLAGS) +mmap_libaio_LDADD = $(LIBAIO_LIBS) endif diff --git a/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am b/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am index 7d60c24821b5..c98e032e1a5c 100644 --- a/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am +++ b/tests/zfs-tests/cmd/nvlist_to_lua/Makefile.am @@ -1,10 +1,10 @@ include $(top_srcdir)/config/Rules.am pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/bin pkgexec_PROGRAMS = nvlist_to_lua nvlist_to_lua_SOURCES = nvlist_to_lua.c nvlist_to_lua_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la + $(top_builddir)/lib/libzfs_core/libzfs_core.la \ + $(top_builddir)/lib/libnvpair/libnvpair.la diff --git a/tests/zfs-tests/tests/functional/checksum/Makefile.am b/tests/zfs-tests/tests/functional/checksum/Makefile.am index 7cd15324e2fd..265a4b16e7d6 100644 --- a/tests/zfs-tests/tests/functional/checksum/Makefile.am +++ b/tests/zfs-tests/tests/functional/checksum/Makefile.am @@ -1,35 +1,32 @@ include $(top_srcdir)/config/Rules.am -AM_CPPFLAGS += -I$(top_srcdir)/include LDADD = \ $(top_builddir)/lib/libicp/libicp.la \ $(top_builddir)/lib/libspl/libspl_assert.la -AUTOMAKE_OPTIONS = subdir-objects - pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ run_edonr_test.ksh \ run_sha2_test.ksh \ run_skein_test.ksh \ filetest_001_pos.ksh dist_pkgdata_DATA = \ default.cfg pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/checksum pkgexec_PROGRAMS = \ skein_test \ sha2_test skein_test_SOURCES = skein_test.c sha2_test_SOURCES = sha2_test.c if BUILD_LINUX pkgexec_PROGRAMS += edonr_test edonr_test_SOURCES = edonr_test.c endif diff --git a/tests/zfs-tests/tests/functional/hkdf/Makefile.am b/tests/zfs-tests/tests/functional/hkdf/Makefile.am index 378bcf531d84..be65f8c0e2f0 100644 --- a/tests/zfs-tests/tests/functional/hkdf/Makefile.am +++ b/tests/zfs-tests/tests/functional/hkdf/Makefile.am @@ -1,21 +1,17 @@ include $(top_srcdir)/config/Rules.am -LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzpool/libzpool.la - -AUTOMAKE_OPTIONS = subdir-objects - pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ run_hkdf_test.ksh pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/hkdf pkgexec_PROGRAMS = \ hkdf_test hkdf_test_SOURCES = hkdf_test.c +hkdf_test_LDADD = \ + $(top_builddir)/lib/libzpool/libzpool.la diff --git a/tests/zfs-tests/tests/functional/libzfs/Makefile.am b/tests/zfs-tests/tests/functional/libzfs/Makefile.am index 545af77e7d12..e9a703f4902d 100644 --- a/tests/zfs-tests/tests/functional/libzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/libzfs/Makefile.am @@ -1,19 +1,17 @@ include $(top_srcdir)/config/Rules.am pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/libzfs dist_pkgdata_SCRIPTS = \ cleanup.ksh \ setup.ksh \ libzfs_input.ksh many_fds_LDADD = \ - $(top_builddir)/lib/libnvpair/libnvpair.la \ - $(top_builddir)/lib/libzfs_core/libzfs_core.la \ $(top_builddir)/lib/libzfs/libzfs.la pkgexec_PROGRAMS = many_fds many_fds_SOURCES = many_fds.c