Generated files for file(1) command.
[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.9])
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 AM_PROG_CC_C_O
34
35 dnl Check support for 64 bit file offsets.
36 AC_SYS_LARGEFILE
37
38 dnl Headers.
39 AC_CHECK_HEADERS([errno.h sys/types.h sys/un.h sys/wait.h sys/socket.h])
40
41 dnl Check for rpcgen and XDR library.  rpcgen is optional.
42 AC_CHECK_PROG([RPCGEN],[rpcgen],[rpcgen],[no])
43 AM_CONDITIONAL([HAVE_RPCGEN],[test "x$RPCGEN" != "xno"])
44 AC_CHECK_LIB([portablexdr],[xdrmem_create],[],[
45         AC_SEARCH_LIBS([xdrmem_create],[rpc xdr nsl])
46         ])
47
48 dnl Check for pod2man and pod2text.
49 AC_CHECK_PROG([POD2MAN],[pod2man],[pod2man],[no])
50 test "x$POD2MAN" = "xno" &&
51      AC_MSG_ERROR([pod2man must be installed])
52 AC_CHECK_PROG([POD2TEXT],[pod2text],[pod2text],[no])
53 test "x$POD2TEXT" = "xno" &&
54      AC_MSG_ERROR([pod2text must be installed])
55
56 dnl Check for QEMU for running binaries on this $host_cpu, fall
57 dnl back to basic 'qemu'.
58 AC_PATH_PROGS([QEMU],[qemu-system-$host_cpu qemu],[no],
59         [$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
60 test "x$QEMU" = "xno" && AC_MSG_ERROR([qemu must be installed])
61 AC_DEFINE_UNQUOTED([QEMU],["$QEMU"],[Location of qemu binary.])
62
63 dnl Check for febootstrap etc.
64 AC_CHECK_PROG([FEBOOTSTRAP],
65         [febootstrap],[febootstrap],[no])
66 test "x$FEBOOTSTRAP" = "xno" && \
67      AC_MSG_ERROR([febootstrap must be installed])
68 AC_CHECK_PROG([FEBOOTSTRAP_RUN],
69         [febootstrap-run],[febootstrap-run],[no])
70 test "x$FEBOOTSTRAP_RUN" = "xno" && \
71      AC_MSG_ERROR([febootstrap-run must be installed])
72 AC_CHECK_PROG([FEBOOTSTRAP_MINIMIZE],
73         [febootstrap-minimize],[febootstrap-minimize],[no])
74 test "x$FEBOOTSTRAP_MINIMIZE" = "xno" && \
75      AC_MSG_ERROR([febootstrap-minimize must be installed])
76 AC_CHECK_PROG([FEBOOTSTRAP_TO_INITRAMFS],
77         [febootstrap-to-initramfs],[febootstrap-to-initramfs],[no])
78 test "x$FEBOOTSTRAP_TO_INITRAMFS" = "xno" && \
79      AC_MSG_ERROR([febootstrap-to-initramfs must be installed])
80
81 dnl --with-repo to specify a Fedora repository.
82 AC_ARG_WITH([repo],
83         [AS_HELP_STRING([--with-repo],
84           [set name of Fedora repository @<:@default=fedora-10@:>@])],
85         [],
86         [with_repo=fedora-10])
87 REPO="$with_repo"
88 AC_SUBST(REPO)
89 AC_DEFINE_UNQUOTED([REPO],["$REPO"],[Name of Fedora repository.])
90
91 AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
92
93 dnl --with-updates to specify a Fedora updates repository.
94 AC_ARG_WITH([updates],
95         [AS_HELP_STRING([--with-updates],
96           [set name of Fedora updates repository @<:@default=updates-released-f10@:>@])],
97         [],
98         [with_updates=updates-released-f10])
99 UPDATES="$with_updates"
100 AC_SUBST(UPDATES)
101 AC_DEFINE_UNQUOTED([UPDATES],["$UPDATES"],[Name of Fedora updates repository.])
102
103 AC_DEFINE_UNQUOTED([host_cpu],["$host_cpu"],[Host architecture.])
104
105 dnl --with-mirror to specify a local Fedora mirror.
106 AC_ARG_WITH([mirror],
107         [AS_HELP_STRING([--with-mirror],
108           [set URI of a local Fedora mirror])],
109         [],
110         [with_mirror=])
111 MIRROR="$with_mirror"
112 AC_SUBST(MIRROR)
113
114 dnl Check for OCaml (optional, for OCaml bindings).
115 AC_PROG_OCAML
116 AC_PROG_FINDLIB
117 AM_CONDITIONAL([HAVE_OCAML],[test "x$OCAMLC" != "xno" -a "x$OCAMLFIND" != "xno"])
118
119 dnl Check for Perl (optional, for Perl bindings).
120 dnl XXX This isn't quite right, we should check for devel libraries.
121 AC_CHECK_PROG([PERL],[perl],[perl],[no])
122 AM_CONDITIONAL([HAVE_PERL],[test "x$PERL" != "xno"])
123
124 dnl Check for Python (optional, for Python bindings).
125 AC_CHECK_PROG([PYTHON],[python],[python],[no])
126
127 PYTHON_PREFIX=
128 PYTHON_VERSION=
129 PYTHON_INCLUDEDIR=
130 PYTHON_SITE_PACKAGES=
131
132 if test "x$PYTHON" != "xno"; then
133     PYTHON_PREFIX=`$PYTHON -c "import sys; print sys.prefix"`
134     PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
135     for d in \
136         $PYTHON_PREFIX/include/python$PYTHON_VERSION \
137         /usr/include/python$PYTHON_VERSION \
138         /usr/local/include/python$PYTHON_VERSION
139     do
140         AC_MSG_CHECKING([Python.h in $d])
141         if test -r "$d/Python.h"; then
142             AC_MSG_RESULT([found])
143             PYTHON_INCLUDEDIR=$d
144             break
145         fi
146         AC_MSG_RESULT([not found])
147     done
148     for d in \
149         $PYTHON_PREFIX/lib64/python$PYTHON_VERSION/site-packages \
150         $PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages \
151         /usr/lib64/python$PYTHON_VERSION/site-packages \
152         /usr/lib/python$PYTHON_VERSION/site-packages \
153         /usr/local/lib/python$PYTHON_VERSION/site-packages
154     do
155         AC_MSG_CHECKING([for $d])
156         if test -d "$d"; then
157             AC_MSG_RESULT([found])
158             PYTHON_SITE_PACKAGES=$d
159             break
160         fi
161         AC_MSG_RESULT([not found])
162     done
163 fi
164
165 AC_SUBST(PYTHON_PREFIX)
166 AC_SUBST(PYTHON_VERSION)
167 AC_SUBST(PYTHON_INCLUDEDIR)
168 AC_SUBST(PYTHON_SITE_PACKAGES)
169
170 AM_CONDITIONAL([HAVE_PYTHON],
171     [test "x$PYTHON_INCLUDEDIR" != "x" && test "x$PYTHON_SITE_PACKAGES" != "x"])
172
173 dnl Run in subdirs.
174 AC_CONFIG_SUBDIRS([daemon])
175
176 dnl Produce output files.
177 AC_CONFIG_HEADERS([config.h])
178 AC_CONFIG_FILES([Makefile src/Makefile fish/Makefile examples/Makefile
179                  images/Makefile
180                  ocaml/Makefile ocaml/examples/Makefile
181                  perl/Makefile
182                  python/Makefile
183                  make-initramfs.sh update-initramfs.sh
184                  libguestfs.spec
185                  ocaml/META perl/Makefile.PL])
186 AC_OUTPUT
187
188 dnl WTF?
189 chmod +x make-initramfs.sh update-initramfs.sh