0f7b4c39bdf97a326439141f82a80b08ab3ceac6
[libguestfs.git] / configure.ac
1 # libguestfs
2 # Copyright (C) 2009 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
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 AC_INIT([libguestfs],[0.2])
19 AM_INIT_AUTOMAKE
20
21 AC_CONFIG_MACRO_DIR([m4])
22
23 AC_PROG_LIBTOOL
24
25 dnl Check for basic C environment.
26 AC_PROG_CC
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 AC_PROG_CC_C_O
34
35 dnl Headers.
36 AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h])
37
38 dnl Check for rpcgen and XDR library.  rpcgen is optional.
39 AC_CHECK_PROG([RPCGEN],[rpcgen],[rpcgen],[no])
40 AM_CONDITIONAL([RPCGEN],[test "x$RPCGEN" != "xno"])
41 AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
42         AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl])
43         ])
44
45 dnl Check for pod2man and pod2text.
46 AC_CHECK_PROG([POD2MAN],[pod2man],[pod2man],[no])
47 test "x$POD2MAN" = "xno" &&
48      AC_MSG_ERROR([pod2man must be installed])
49 AC_CHECK_PROG([POD2TEXT],[pod2text],[pod2text],[no])
50 test "x$POD2TEXT" = "xno" &&
51      AC_MSG_ERROR([pod2text must be installed])
52
53 dnl Check for QEMU.  We only check for the basic 'qemu' program here
54 dnl (ie. the i386 full system qemu).  But at runtime we might choose
55 dnl a different qemu to run, eg. qemu-system-ppc.
56 AC_PATH_PROG([QEMU],[qemu],[no],
57         [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
58 test "x$QEMU" = "xno" && AC_MSG_ERROR([qemu must be installed])
59 AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.])
60
61 dnl Check for febootstrap etc.
62 AC_CHECK_PROG([FEBOOTSTRAP],
63         [febootstrap],[febootstrap],[no])
64 test "x$FEBOOTSTRAP" = "xno" && \
65      AC_MSG_ERROR([febootstrap must be installed])
66 AC_CHECK_PROG([FEBOOTSTRAP_RUN],
67         [febootstrap-run],[febootstrap-run],[no])
68 test "x$FEBOOTSTRAP_RUN" = "xno" && \
69      AC_MSG_ERROR([febootstrap-run must be installed])
70 AC_CHECK_PROG([FEBOOTSTRAP_MINIMIZE],
71         [febootstrap-minimize],[febootstrap-minimize],[no])
72 test "x$FEBOOTSTRAP_MINIMIZE" = "xno" && \
73      AC_MSG_ERROR([febootstrap-minimize must be installed])
74 AC_CHECK_PROG([FEBOOTSTRAP_TO_INITRAMFS],
75         [febootstrap-to-initramfs],[febootstrap-to-initramfs],[no])
76 test "x$FEBOOTSTRAP_TO_INITRAMFS" = "xno" && \
77      AC_MSG_ERROR([febootstrap-to-initramfs must be installed])
78
79 dnl --with-repo to specify a Fedora repository.
80 AC_ARG_WITH([repo],
81         [AS_HELP_STRING([--with-repo],
82           [set name of Fedora repository @<:@default=fedora-10@:>@])],
83         [],
84         [with_repo=fedora-10])
85 REPO="$with_repo"
86 AC_SUBST(REPO)
87
88 dnl --with-mirror to specify a local Fedora mirror.
89 AC_ARG_WITH([mirror],
90         [AS_HELP_STRING([--with-mirror],
91           [set URI of a local Fedora mirror])],
92         [],
93         [with_mirror=])
94 MIRROR="$with_mirror"
95 AC_SUBST(MIRROR)
96
97 dnl Run in subdirs.
98 AC_CONFIG_SUBDIRS([daemon])
99
100 dnl Produce output files.
101 AC_CONFIG_HEADERS([config.h])
102 AC_CONFIG_FILES([Makefile src/Makefile fish/Makefile examples/Makefile
103                  make-initramfs.sh update-initramfs.sh])
104 AC_OUTPUT
105
106 dnl WTF?
107 chmod +x make-initramfs.sh update-initramfs.sh