mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Clean up lib dependencies
libzutil is currently statically linked into libzfs, libzfs_core and libzpool. Avoid the unnecessary duplication by removing it from libzfs and libzpool, and adding libzfs_core to libzpool. Remove a few unnecessary dependencies: - libuutil from libzfs_core - libtirpc from libspl - keep only libcrypto in libzfs, as we don't use any functions from libssl - librt is only used for clock_gettime, however on modern systems that's in libc rather than librt. Add a configure check to see if we actually need librt - libdl from raidz_test Add a few missing dependencies: - zlib to libefi and libzfs - libuuid to zpool, and libuuid and libudev to zed - libnvpair uses assertions, so add assert.c to provide aok and libspl_assertf Sort the LDADD for programs so that libraries that satisfy dependencies come at the end rather than the beginning of the linker command line. Revamp the configure tests for libaries to use FIND_SYSTEM_LIBRARY instead. This can take advantage of pkg-config, and it also avoids polluting LIBS. List all the required dependencies in the pkgconfig files, and move the one for libzfs_core into the latter's directory. Install pkgconfig files in $(libdir)/pkgconfig on linux and $(prefix)/libdata/pkgconfig on FreeBSD, instead of /usr/share/pkgconfig, as the more correct location for library .pc files. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Closes #10538
This commit is contained in:
committed by
Brian Behlendorf
parent
b6437ea41c
commit
4d61ade1a3
@@ -11,7 +11,9 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
|
||||
|
||||
_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]]")
|
||||
@@ -21,6 +23,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
|
||||
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]], [
|
||||
@@ -37,7 +40,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
|
||||
])])
|
||||
|
||||
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])
|
||||
])
|
||||
])
|
||||
|
||||
@@ -51,7 +54,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
|
||||
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=
|
||||
])
|
||||
|
||||
@@ -66,6 +69,7 @@ AC_DEFUN([FIND_SYSTEM_LIBRARY], [
|
||||
])
|
||||
|
||||
AS_IF([test -n "$_library_found"], [
|
||||
AC_DEFINE([HAVE_][$1], [1], [Define if you have [$5]])
|
||||
:;$7
|
||||
],[dnl ELSE
|
||||
:;$8
|
||||
|
||||
@@ -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])
|
||||
])
|
||||
])
|
||||
])
|
||||
@@ -2,13 +2,5 @@ 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])
|
||||
])
|
||||
|
||||
@@ -3,11 +3,7 @@ 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])])
|
||||
])
|
||||
|
||||
@@ -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])])
|
||||
])
|
||||
@@ -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])
|
||||
])
|
||||
+12
-12
@@ -2,18 +2,18 @@ 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_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
|
||||
])
|
||||
|
||||
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])], [])
|
||||
|
||||
])
|
||||
|
||||
+3
-13
@@ -2,17 +2,7 @@ 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])
|
||||
])
|
||||
])
|
||||
|
||||
+3
-16
@@ -2,20 +2,7 @@ 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])
|
||||
])
|
||||
])
|
||||
|
||||
+6
-1
@@ -6,6 +6,10 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
|
||||
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
|
||||
@@ -15,8 +19,9 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
|
||||
])
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user