+ ], -lncurses)
+ old_LIBS="$LIBS"
+ LIBS="$LIBS $LIBREADLINE"
+ AC_CHECK_FUNCS([append_history completion_matches rl_completion_matches])
+ LIBS="$old_LIBS"
+ ])
+
+dnl For i18n.
+AM_GNU_GETTEXT([external])
+
+dnl libmagic (highly recommended)
+AC_CHECK_LIB([magic],[magic_file],
+ [AC_CHECK_HEADER([magic.h],
+ [AC_SUBST([MAGIC_LIBS], ["-lmagic"])
+ AC_DEFINE([HAVE_LIBMAGIC],[1],[libmagic found at compile time.])
+ ], [])
+ ],
+ [AC_MSG_WARN([libmagic not found, some core features will be disabled])])
+
+dnl Check for PCRE (highly recommended)
+PKG_CHECK_MODULES([PCRE], [libpcre],
+ [AC_SUBST([PCRE_CFLAGS])
+ AC_SUBST([PCRE_LIBS])
+ AC_DEFINE([HAVE_PCRE],[1],[PCRE found at compile time.])
+ ],
+ [AC_MSG_WARN([PCRE not found, some core features will be disabled])])
+
+dnl libvirt (highly recommended)
+PKG_CHECK_MODULES([LIBVIRT], [libvirt],
+ [AC_SUBST([LIBVIRT_CFLAGS])
+ AC_SUBST([LIBVIRT_LIBS])
+ AC_DEFINE([HAVE_LIBVIRT],[1],[libvirt found at compile time.])
+ ],
+ [AC_MSG_WARN([libvirt not found, some core features will be disabled])])
+AM_CONDITIONAL([HAVE_LIBVIRT],[test "x$LIBVIRT_LIBS" != "x"])
+
+dnl libxml2 (highly recommended)
+PKG_CHECK_MODULES([LIBXML2], [libxml-2.0],
+ [AC_SUBST([LIBXML2_CFLAGS])
+ AC_SUBST([LIBXML2_LIBS])
+ AC_DEFINE([HAVE_LIBXML2],[1],[libxml2 found at compile time.])
+ ],
+ [AC_MSG_WARN([libxml2 not found, some core features will be disabled])])
+AM_CONDITIONAL([HAVE_LIBXML2],[test "x$LIBXML2_LIBS" != "x"])
+
+dnl libconfig (highly recommended)
+PKG_CHECK_MODULES([LIBCONFIG], [libconfig],
+ [AC_SUBST([LIBCONFIG_CFLAGS])
+ AC_SUBST([LIBCONFIG_LIBS])
+ AC_DEFINE([HAVE_LIBCONFIG],[1],[libconfig found at compile time.])
+ ],
+ [AC_MSG_WARN([libconfig not found, some features will be disabled])])
+AM_CONDITIONAL([HAVE_LIBCONFIG],[test "x$LIBCONFIG_LIBS" != "x"])
+
+dnl hivex library (highly recommended)
+dnl This used to be a part of libguestfs, but was spun off into its
+dnl own separate upstream project in libguestfs 1.0.85.
+PKG_CHECK_MODULES([HIVEX], [hivex],
+ [AC_SUBST([HIVEX_CFLAGS])
+ AC_SUBST([HIVEX_LIBS])
+ AC_DEFINE([HAVE_HIVEX],[1],[hivex library found at compile time.])
+ ],
+ [AC_MSG_WARN([hivex not found, some core features will be disabled])])
+AM_CONDITIONAL([HAVE_HIVEX],[test "x$HIVEX_LIBS" != "x"])
+
+dnl FUSE is optional to build the FUSE module.
+AC_ARG_ENABLE([fuse],
+ AS_HELP_STRING([--disable-fuse], [Disable FUSE (guestmount) support]),
+ [],
+ [enable_fuse=yes])
+AS_IF([test "x$enable_fuse" != "xno"],
+ [PKG_CHECK_MODULES([FUSE],[fuse],,[
+ enable_fuse=no
+ AC_MSG_WARN([FUSE library and headers are missing, so optional FUSE module won't be built])])])
+AM_CONDITIONAL([HAVE_FUSE],[test "x$enable_fuse" != "xno"])