]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Add configure flag to control libzfs integration.
authorMike Gilbert <floppym@gentoo.org>
Sun, 26 Feb 2012 23:57:48 +0000 (00:57 +0100)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Sun, 26 Feb 2012 23:57:48 +0000 (00:57 +0100)
* configure.ac: Add AC_ARG_ENABLE(libzfs ...) and associated logic.

ChangeLog
configure.ac

index 37e4fc1614c8f5f20268e08587817ebde2bfbdc9..82e7c013f641f14ba05db98251433b54a70c68ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * grub-core/disk/diskfilter.c (insert_array): Choose the smallest
index e2060cd9a325db45933acc6069f6468c300ce9a6..d271955874083add1453e400ef156149020c85e5 100644 (file)
@@ -302,7 +302,7 @@ fi
 
 # Check for functions and headers.
 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
 #include <sys/param.h>
@@ -1006,16 +1006,45 @@ AC_CHECK_LIB([lzma], [lzma_code],
                         [Define to 1 if you have the LZMA library.])],)
 AC_SUBST([LIBLZMA])
 
-AC_CHECK_LIB([zfs], [libzfs_init],
-             [LIBZFS="-lzfs"
-              AC_DEFINE([HAVE_LIBZFS], [1],
-                        [Define to 1 if you have the ZFS library.])],)
-AC_SUBST([LIBZFS])
+AC_ARG_ENABLE([libzfs],
+              [AS_HELP_STRING([--enable-libzfs],
+                              [enable libzfs integration (default=guessed)])])
+if test x"$enable_libzfs" = xno ; then
+  libzfs_excuse="explicitly disabled"
+fi
 
-AC_CHECK_LIB([nvpair], [nvlist_print],
-             [LIBNVPAIR="-lnvpair"
-              AC_DEFINE([HAVE_LIBNVPAIR], [1],
-                        [Define to 1 if you have the NVPAIR library.])],)
+if test x"$libzfs_excuse" = x ; then
+  # Only check for system headers if libzfs support has not been disabled.
+  AC_CHECK_HEADERS(libzfs.h libnvpair.h)
+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])
 
 LIBS=""
@@ -1169,5 +1198,10 @@ echo starfield theme: Yes
 else
 echo starfield theme: No "($starfield_excuse)"
 fi
+if [ x"$libzfs_excuse" = x ]; then
+echo With libzfs support: Yes
+else
+echo With libzfs support: No "($libzfs_excuse)"
+fi
 echo "*******************************************************"
 ]