Add configure flag to control libzfs integration.

* configure.ac: Add AC_ARG_ENABLE(libzfs ...) and associated logic.
This commit is contained in:
Mike Gilbert 2012-02-27 00:57:48 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent 1e9a9a3faf
commit e4c498a106
2 changed files with 50 additions and 10 deletions

View file

@ -1,3 +1,9 @@
2012-02-27 Mike Gilbert <floppym@gentoo.org>
Add configure flag to control libzfs integration.
* configure.ac: Add AC_ARG_ENABLE(libzfs ...) and associated logic.
2012-02-26 Vladimir Serbinenko <phcoder@gmail.com> 2012-02-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/diskfilter.c (insert_array): Choose the smallest * grub-core/disk/diskfilter.c (insert_array): Choose the smallest

View file

@ -302,7 +302,7 @@ fi
# Check for functions and headers. # Check for functions and headers.
AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent) AC_CHECK_FUNCS(posix_memalign memalign asprintf vasprintf getextmntent)
AC_CHECK_HEADERS(libzfs.h libnvpair.h sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h) AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
#include <sys/param.h> #include <sys/param.h>
@ -1006,16 +1006,45 @@ AC_CHECK_LIB([lzma], [lzma_code],
[Define to 1 if you have the LZMA library.])],) [Define to 1 if you have the LZMA library.])],)
AC_SUBST([LIBLZMA]) AC_SUBST([LIBLZMA])
AC_CHECK_LIB([zfs], [libzfs_init], AC_ARG_ENABLE([libzfs],
[LIBZFS="-lzfs" [AS_HELP_STRING([--enable-libzfs],
AC_DEFINE([HAVE_LIBZFS], [1], [enable libzfs integration (default=guessed)])])
[Define to 1 if you have the ZFS library.])],) if test x"$enable_libzfs" = xno ; then
AC_SUBST([LIBZFS]) libzfs_excuse="explicitly disabled"
fi
AC_CHECK_LIB([nvpair], [nvlist_print], if test x"$libzfs_excuse" = x ; then
[LIBNVPAIR="-lnvpair" # Only check for system headers if libzfs support has not been disabled.
AC_DEFINE([HAVE_LIBNVPAIR], [1], AC_CHECK_HEADERS(libzfs.h libnvpair.h)
[Define to 1 if you have the NVPAIR library.])],) fi
if test x"$libzfs_excuse" = x ; then
AC_CHECK_LIB([zfs], [libzfs_init],
[],
[libzfs_excuse="need zfs library"])
fi
if test x"$libzfs_excuse" = x ; then
AC_CHECK_LIB([nvpair], [nvlist_print],
[],
[libzfs_excuse="need nvpair library"])
fi
if test x"$enable_libzfs" = xyes && test x"$libzfs_excuse" != x ; then
AC_MSG_ERROR([libzfs support was explicitly requested but requirements are not satisfied])
fi
if test x"$libzfs_excuse" = x ; then
# We need both libzfs and libnvpair for a successful build.
LIBZFS="-lzfs"
AC_DEFINE([HAVE_LIBZFS], [1],
[Define to 1 if you have the ZFS library.])
LIBNVPAIR="-lnvpair"
AC_DEFINE([HAVE_LIBNVPAIR], [1],
[Define to 1 if you have the NVPAIR library.])
fi
AC_SUBST([LIBZFS])
AC_SUBST([LIBNVPAIR]) AC_SUBST([LIBNVPAIR])
LIBS="" LIBS=""
@ -1169,5 +1198,10 @@ echo starfield theme: Yes
else else
echo starfield theme: No "($starfield_excuse)" echo starfield theme: No "($starfield_excuse)"
fi fi
if [ x"$libzfs_excuse" = x ]; then
echo With libzfs support: Yes
else
echo With libzfs support: No "($libzfs_excuse)"
fi
echo "*******************************************************" echo "*******************************************************"
] ]