Initial commit.
[virt-efivars.git] / configure.ac
1 dnl virt-efivars configure.ac
2 dnl (C) Copyright 2014-2015 Red Hat Inc.
3 dnl
4 dnl This program is free software; you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation; either version 2 of the License, or
7 dnl (at your option) any later version.
8 dnl
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program; if not, write to the Free Software
16 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 dnl
18 dnl Written by Richard W.M. Jones <rjones@redhat.com>
19
20 AC_INIT([virt-efivars],[1.0])
21 AM_INIT_AUTOMAKE(foreign)
22
23 AC_PROG_CC
24
25 AC_PROG_INSTALL
26
27 AC_CANONICAL_HOST
28
29 # Define $(SED).
30 m4_ifdef([AC_PROG_SED],[
31     AC_PROG_SED
32 ],[
33     dnl ... else hope for the best
34     AC_SUBST([SED], "sed")
35 ])
36
37 # Define $(AWK).
38 AC_PROG_AWK
39
40 dnl Check for supermin 5.
41 AC_PATH_PROG(SUPERMIN,[supermin],[no])
42
43 if test "x$SUPERMIN" = "xno" ; then
44     AC_MSG_ERROR([supermin not found])
45 fi
46
47 if ! $SUPERMIN --version | grep -q 'supermin 5'; then
48     AC_MSG_ERROR([incorrect supermin version, must be supermin 5])
49 fi
50
51 dnl Get the distro that supermin thinks it is using.
52 AC_MSG_CHECKING([for the distro])
53 DISTRO="$(
54     supermin --list-drivers |
55     $AWK '$2 == "detected" { gsub ("/", "-", $1); print $1; exit }'
56     )"
57 AC_MSG_RESULT([$DISTRO])
58 AC_SUBST([DISTRO])
59 if test -z "$DISTRO"; then
60     AC_MSG_ERROR([cannot get supermin distro from 'supermin --list-drivers' output])
61 fi
62
63 dnl Check for a usable qemu KVM binary.
64 qemu_system="$(
65     echo qemu-system-$host_cpu |
66     $SED -e 's/-i@<:@456@:>@86/-i386/g' \
67          -e 's/-arm.*/-arm/g'
68     )"
69 qemu_choices="$qemu_system qemu-kvm kvm"
70 AC_PATH_PROGS([QEMU],[$qemu_choices],[no])
71
72 if test "x$QEMU" = "xno" ; then
73     AC_MSG_ERROR([no qemu KVM binary found.  I looked for one of: $qemu_choices])
74 fi
75
76 dnl Check for libefivar.
77 PKG_CHECK_MODULES([EFIVAR], [efivar])
78
79 AC_CONFIG_HEADERS([config.h])
80 AC_CONFIG_FILES([build-appliance.sh], [chmod +x,-w build-appliance.sh])
81 AC_CONFIG_FILES([init], [chmod +x,-w init])
82 AC_CONFIG_FILES([run-test.sh], [chmod +x,-w run-test.sh])
83 AC_CONFIG_FILES([Makefile])
84 AC_OUTPUT