Build system.
[virt-tools.git] / configure.ac
1 # virt-tools
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.1.0)
19 AM_INIT_AUTOMAKE([foreign])
20
21 AC_CONFIG_MACRO_DIR([m4])
22
23 AC_CHECK_PROG([PERL],[perl],[perl],[no])
24 if test "x$PERL" = "xno"; then
25     AC_MSG_FAILURE([Perl must be installed])
26 fi
27
28 dnl Check for Perl modules that must be present to compile and
29 dnl test the Perl bindings.
30 missing_perl_modules=no
31 required_perl_modules="Test::More Test::Pod Test::Pod::Coverage ExtUtils::MakeMaker Sys::Virt"
32 optional_perl_modules="Sys::Guestfs"
33
34 for pm in $required_perl_modules; do
35     AC_MSG_CHECKING([for $pm])
36     if ! $PERL -M$pm -e1 >/dev/null 2>&1; then
37         AC_MSG_RESULT([no])
38         missing_perl_modules=yes
39     else
40         AC_MSG_RESULT([yes])
41     fi
42 done
43 if test "x$missing_perl_modules" = "xyes"; then
44     AC_MSG_FAILURE([some Perl modules are missing])
45 fi
46 for pm in $optional_perl_modules; do
47     AC_MSG_CHECKING([for $pm])
48     if ! $PERL -M$pm -e1 >/dev/null 2>&1; then
49         AC_MSG_RESULT([no])
50     else
51         AC_MSG_RESULT([yes])
52     fi
53 done
54
55 dnl Check for pod2man and pod2text.
56 AC_CHECK_PROG([POD2MAN],[pod2man],[pod2man],[no])
57 test "x$POD2MAN" = "xno" &&
58      AC_MSG_ERROR([pod2man must be installed])
59 AC_CHECK_PROG([POD2TEXT],[pod2text],[pod2text],[no])
60 test "x$POD2TEXT" = "xno" &&
61      AC_MSG_ERROR([pod2text must be installed])
62
63 AC_CONFIG_FILES([tools/virt-tools-get-key:tools/virt-tools-get-key.pl],
64                 [chmod +x tools/virt-tools-get-key])
65 AC_CONFIG_FILES([tools/virt-tools-get-transport:tools/virt-tools-get-transport.pl],
66                 [chmod +x tools/virt-tools-get-transport])
67 AC_CONFIG_FILES([tools/virt-uname:tools/virt-uname.pl],
68                 [chmod +x tools/virt-uname])
69 AC_CONFIG_FILES([tools/virt-ifconfig:tools/virt-ifconfig.pl],
70                 [chmod +x tools/virt-ifconfig])
71 AC_CONFIG_FILES([Makefile
72                  daemon/Makefile docs/Makefile linux/Makefile tools/Makefile])
73 AC_OUTPUT