f4bd01133b8241a8ac7093e8b5f574f7d9a4f5ff
[qemu-sanity-check.git] / configure.ac
1 # qemu-sanity-check
2 # Copyright (C) 2013 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along
15 # with this program; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 AC_INIT([qemu-sanity-check],[1.1.2])
19 AM_INIT_AUTOMAKE([foreign])
20
21 dnl Only used temporarily while the spec file is contained in the
22 dnl tarball.  We will remove this later.
23 AC_SUBST([RPM_RELEASE],[2])
24
25 dnl Check for basic C environment.
26 AC_PROG_CC_STDC
27 AC_PROG_INSTALL
28 AC_PROG_CPP
29
30 AC_C_PROTOTYPES
31 test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
32
33 AM_PROG_CC_C_O
34
35 dnl Allow the package to override the default list of qemu binary
36 dnl names which are tried, since this heavily depends on how qemu
37 dnl has been packaged in the downstream distro.
38 dnl
39 dnl Note that "$canonical_arch" and "$arch" are variables in the
40 dnl qemu-sanity-check shell script.  Absolute paths could be used
41 dnl here as well.
42 AC_ARG_WITH([qemu-list],
43     [AS_HELP_STRING([--with-qemu-list],
44         [list of qemu binaries to try @<:@default=qemu-kvm qemu-system-\$canonical_arch qemu kvm@:>@])],
45     [QEMU_LIST="$withval"],
46     [QEMU_LIST="qemu-kvm qemu-system-\$canonical_arch qemu kvm"])
47 AC_SUBST([QEMU_LIST])
48
49 AC_PROG_SED
50
51 AC_MSG_CHECKING([that a static binary can be built])
52 old_CFLAGS="$CFLAGS"
53 old_LDFLAGS="$LDFLAGS"
54 CFLAGS="$CFLAGS -static"
55 LDFLAGS="$LDFLAGS -static"
56 AC_LINK_IFELSE([
57     #include <stdio.h>
58     #include <stdlib.h>
59     int main () { exit (0); }
60 ],[
61     AC_MSG_RESULT([yes])
62 ],[
63     AC_MSG_RESULT([no])
64     AC_MSG_ERROR([Building a static binary failed.  Make sure you have static libc installed.])
65 ])
66
67 AC_CHECK_PROG([POD2MAN], [pod2man], [pod2man], [no])
68 if test "x$POD2MAN" = "xno"; then
69     AC_MSG_WARN([pod2man was not found.  This is needed to build man pages.])
70 fi
71 AM_CONDITIONAL([HAVE_POD2MAN], [test "x$POD2MAN" != "xno"])
72
73 dnl Produce output files.
74 AC_CONFIG_HEADERS([config.h])
75 AC_CONFIG_FILES([qemu-sanity-check],[chmod 0555 qemu-sanity-check])
76 AC_CONFIG_FILES([Makefile
77                  qemu-sanity-check.spec])
78
79 AC_OUTPUT