build: Rename HAVE_LIBZFS to USE_LIBZFS

The HAVE_LIBZFS is defined by libzfs test and hence conflicts with
manual definition. On NetBSD it ends up detecting zfs but not detecting
nvpair and creates confusion. Split them.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Vladimir Serbinenko 2023-08-24 23:24:30 +02:00 committed by Daniel Kiper
parent e4dbe5cfa4
commit 3d4cb5a432
3 changed files with 7 additions and 9 deletions

View File

@ -2008,11 +2008,9 @@ fi
if test x"$libzfs_excuse" = x ; then if test x"$libzfs_excuse" = x ; then
# We need both libzfs and libnvpair for a successful build. # We need both libzfs and libnvpair for a successful build.
LIBZFS="-lzfs" LIBZFS="-lzfs"
AC_DEFINE([HAVE_LIBZFS], [1],
[Define to 1 if you have the ZFS library.])
LIBNVPAIR="-lnvpair" LIBNVPAIR="-lnvpair"
AC_DEFINE([HAVE_LIBNVPAIR], [1], AC_DEFINE([USE_LIBZFS], [1],
[Define to 1 if you have the NVPAIR library.]) [Define to 1 if ZFS library should be used.])
fi fi
AC_SUBST([LIBZFS]) AC_SUBST([LIBZFS])

View File

@ -53,7 +53,7 @@
#include <grub/osdep/major.h> #include <grub/osdep/major.h>
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) #ifdef USE_LIBZFS
# include <grub/util/libzfs.h> # include <grub/util/libzfs.h>
# include <grub/util/libnvpair.h> # include <grub/util/libnvpair.h>
#endif #endif
@ -158,7 +158,7 @@ grub_util_find_root_devices_from_poolname (char *poolname)
size_t ndevices = 0; size_t ndevices = 0;
size_t devices_allocated = 0; size_t devices_allocated = 0;
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) #ifdef USE_LIBZFS
zpool_handle_t *zpool; zpool_handle_t *zpool;
libzfs_handle_t *libzfs; libzfs_handle_t *libzfs;
nvlist_t *config, *vdev_tree; nvlist_t *config, *vdev_tree;

View File

@ -47,7 +47,7 @@
#include <sys/types.h> #include <sys/types.h>
#if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) #ifdef USE_LIBZFS
# include <grub/util/libzfs.h> # include <grub/util/libzfs.h>
# include <grub/util/libnvpair.h> # include <grub/util/libnvpair.h>
#endif #endif
@ -456,7 +456,7 @@ grub_util_biosdisk_is_present (const char *os_dev)
return ret; return ret;
} }
#ifdef HAVE_LIBZFS #ifdef USE_LIBZFS
static libzfs_handle_t *__libzfs_handle; static libzfs_handle_t *__libzfs_handle;
static void static void
@ -478,5 +478,5 @@ grub_get_libzfs_handle (void)
return __libzfs_handle; return __libzfs_handle;
} }
#endif /* HAVE_LIBZFS */ #endif /* USE_LIBZFS */