+AC_CHECK_HEADERS([\
+ attr/xattr.h \
+ byteswap.h \
+ endian.h \
+ errno.h \
+ printf.h \
+ sys/inotify.h \
+ sys/socket.h \
+ sys/statvfs.h \
+ sys/types.h \
+ sys/un.h \
+ sys/wait.h \
+ windows.h \
+ sys/xattr.h])
+
+dnl Functions.
+AC_CHECK_FUNCS([\
+ futimens \
+ getxattr \
+ htonl \
+ htons \
+ inotify_init1 \
+ lgetxattr \
+ listxattr \
+ llistxattr \
+ lsetxattr \
+ lremovexattr \
+ mknod \
+ ntohl \
+ ntohs \
+ posix_fallocate \
+ realpath \
+ removexattr \
+ setitimer \
+ setxattr \
+ sigaction \
+ statvfs \
+ sync])
+
+dnl For modified printf in the daemon, we need glibc either (old-style)
+dnl register_printf_function or (new-style) register_printf_specifier.
+AC_CHECK_FUNC([register_printf_specifier],[
+ AC_DEFINE([HAVE_REGISTER_PRINTF_SPECIFIER],[1],
+ [Define to 1 if you have new-style register_printf_specifier])
+ ],[
+ AC_CHECK_FUNC([register_printf_function],[
+ AC_DEFINE([HAVE_REGISTER_PRINTF_FUNCTION],[1],
+ [Define to 1 if you have old-style register_printf_function])
+ ],[
+ AC_MSG_FAILURE(
+[No support for glibc-style extended printf formatters.
+
+This means you either have a very old glibc (pre-2.0) or you
+are using some other libc where this is not supported.])])])
+
+dnl Build the daemon?
+AC_MSG_CHECKING([if we should build the daemon])
+AC_ARG_ENABLE([daemon],
+ [AS_HELP_STRING([--enable-daemon],
+ [enable building the daemon @<:@default=yes@:>@])],
+ [],
+ [enable_daemon=yes])
+AM_CONDITIONAL([ENABLE_DAEMON],[test "x$enable_daemon" = "xyes"])
+AC_MSG_RESULT([$enable_daemon])
+
+if test "x$enable_daemon" = "xyes"; then
+ dnl Install the daemon (for libguestfs live service)
+ AC_MSG_CHECKING([if we should install the daemon])
+ AC_ARG_ENABLE([install-daemon],
+ [AS_HELP_STRING([--enable-install-daemon],
+ [enable installing the daemon under $sbindir @<:@default=no@:>@])],
+ [],
+ [enable_install_daemon=no])
+ AM_CONDITIONAL([INSTALL_DAEMON],[test "x$enable_install_daemon" = "xyes"])
+ AC_MSG_RESULT([$enable_install_daemon])
+fi
+
+dnl Build the appliance?
+AC_MSG_CHECKING([if we should build the appliance])
+AC_ARG_ENABLE([appliance],
+ [AS_HELP_STRING([--enable-appliance],
+ [enable building the appliance @<:@default=yes@:>@])],
+ [],
+ [enable_appliance=yes])
+AM_CONDITIONAL([ENABLE_APPLIANCE],[test "x$enable_appliance" = "xyes"])
+AC_MSG_RESULT([$enable_appliance])
+
+if test "x$enable_appliance" = "xyes"; then
+ dnl Check for febootstrap >= 3.0
+ AC_CHECK_PROG([FEBOOTSTRAP],
+ [febootstrap],[febootstrap],[no])
+ test "x$FEBOOTSTRAP" = "xno" &&
+ AC_MSG_ERROR([febootstrap must be installed])
+ dnl febootstrap 2.x did not support the --version parameter
+ $FEBOOTSTRAP --version >&AS_MESSAGE_LOG_FD 2>&1 ||
+ AC_MSG_ERROR([febootstrap >= 3.0 must be installed, your version is too old])
+
+ dnl Pass a febootstrap --yum-config option.
+ AC_MSG_CHECKING([if user requested febootstrap --yum-config option])
+ AC_ARG_WITH([febootstrap-yum-config],
+ [AS_HELP_STRING([--with-febootstrap-yum-config=FILE],
+ [pass febootstrap --yum-config option @<:@default=no@:>@])],
+ [FEBOOTSTRAP_YUM_CONFIG="$withval"],
+ [FEBOOTSTRAP_YUM_CONFIG=no])
+ AC_MSG_RESULT([$FEBOOTSTRAP_YUM_CONFIG])
+ AC_SUBST([FEBOOTSTRAP_YUM_CONFIG])
+
+ dnl Which distro?
+ dnl
+ dnl This used to be Very Important but is now just used to select
+ dnl which packages to install in the appliance, since the package
+ dnl names vary slightly across distros. (See
+ dnl appliance/packagelist.in and appliance/excludelist.in)
+ AC_MSG_CHECKING([which Linux distro for package names])
+ DISTRO=REDHAT
+ if test -f /etc/debian_version; then
+ DISTRO=DEBIAN
+ if grep -q 'DISTRIB_ID=Ubuntu' /etc/lsb-release 2>&AS_MESSAGE_LOG_FD; then
+ DISTRO=UBUNTU
+ fi
+ fi
+ if test -f /etc/arch-release; then
+ DISTRO=ARCHLINUX
+ fi
+ AC_MSG_RESULT([$DISTRO])
+ AC_SUBST([DISTRO])
+fi