+dnl Check for basic C environment.
+AC_PROG_CC_STDC
+AC_PROG_INSTALL
+AC_PROG_CPP
+
+AC_C_PROTOTYPES
+test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
+
+AM_PROG_CC_C_O
+
+AC_CHECK_HEADERS([sys/reboot.h])
+
+dnl Allow the package to override the default list of qemu binary
+dnl names which are tried, since this heavily depends on how qemu
+dnl has been packaged in the downstream distro.
+dnl
+dnl Note that "$canonical_arch" and "$arch" are variables in the
+dnl qemu-sanity-check shell script. Absolute paths could be used
+dnl here as well.
+AC_ARG_WITH([qemu-list],
+ [AS_HELP_STRING([--with-qemu-list],
+ [list of qemu binaries to try @<:@default=qemu-kvm qemu-system-\$canonical_arch qemu kvm@:>@])],
+ [QEMU_LIST="$withval"],
+ [QEMU_LIST="qemu-kvm qemu-system-\$canonical_arch qemu kvm"])
+AC_SUBST([QEMU_LIST])
+
+AC_PROG_SED
+
+AC_MSG_CHECKING([that a static binary can be built])
+old_CFLAGS="$CFLAGS"
+old_LDFLAGS="$LDFLAGS"
+CFLAGS="$CFLAGS -static"
+LDFLAGS="$LDFLAGS -static"
+AC_LINK_IFELSE([
+ #include <stdio.h>
+ #include <stdlib.h>
+ int main () { exit (0); }
+],[
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Building a static binary failed. Make sure you have static libc installed.])
+])
+