Check for python during ./configure
[snf-image] / snf-image-host / configure.ac
1 AC_PREREQ(2.59)
2 m4_include([../version.m4])
3 AC_INIT(snf-image, devflow_version, synnefo@googlegroups.com)
4 AC_DEFINE_UNQUOTED(VERSION, "$devflow_version")
5
6 AC_CONFIG_AUX_DIR(autotools)
7 AC_CONFIG_SRCDIR(configure)
8
9 AM_INIT_AUTOMAKE([1.9 foreign tar-ustar -Wall -Wno-portability])
10 AM_INIT_AUTOMAKE([subdir-objects])
11
12
13 # --enable-version-consistency-ckeck
14 AC_ARG_ENABLE([version_consistency_check],
15    AS_HELP_STRING([--enable-version-consistency-check],
16     [Check if the host and the helper packages have the same version]),
17     version_check="$enableval", version_check="no"
18 )
19 if test ${version_check} = yes; then
20     AC_SUBST(VERSION_CHECK, yes)
21 fi
22
23 # --with-helper-url
24 AC_ARG_WITH([helper-url],
25   [AS_HELP_STRING([--with-helper-url=URL],
26       [url to download the helper image from [http://cdn.synnefo.org/snf_image_helper_image-PROG_VERSION.tar.xz]])],
27   [helper_url="$withval"],
28   [helper_url="http://cdn.synnefo.org/snf_image_helper_image-$VERSION.tar.xz"]
29 )
30
31 AC_SUBST(HELPER_URL, $helper_url)
32
33 # --with-progress-monitor
34 AC_ARG_WITH([progress-monitor],
35   [AS_HELP_STRING([--with-progress-monitor=PRGRM],
36     [name of the progress-monitor program []])],
37     [if test "$withval" != "yes" -a "$withval" != "no"; then
38          AC_PATH_PROG(PROGRESS_MONITOR, ["$withval"], [], [$PATH:/usr/sbin:/sbin])
39          if test -z "$PROGRESS_MONITOR" ; then
40              AC_MSG_FAILURE([Could not find progress-monitor: $withval.])
41          fi
42      elif test "$withval" != "no"; then
43          AC_MSG_ERROR([you must specify a value for progress-monitor if --with-progress-monitor is specified])
44     fi]
45 )
46
47 # --with-unattend-file
48 AC_ARG_WITH([unattend-file],
49   [AS_HELP_STRING([--with-unattend-file=UNATTEND_PATH],
50     [path to unattend.xml windows setup file []])],
51     [if test "$withval" != "yes" -a "$withval" != "no"; then
52         AC_SUBST(UNATTEND, "$withval")
53         AC_MSG_NOTICE(using unattend file: $withval)
54      elif test "$withval" != "no"; then
55          AC_MSG_ERROR([you must specify an Unattend.xml file if --with-unattend-file is specified])
56     fi]
57 )
58
59 # --with-multistrap-config
60 AC_ARG_WITH([multistrap-config],
61   [AS_HELP_STRING([--with-multistrap-config=MULTISTRAP_CONFIG_PATH],
62       [path to a multistrap configuration file
63       [SYSCONFDIR/snf-image/multistrap.conf]]
64     )],
65     [if test "$withval" != "yes" -a "$withval" != "no"; then
66         multistrap_config="$withval"
67         AC_MSG_NOTICE(using multistrap configuration file: $withval)
68      elif test "$withval" != "no"; then
69          AC_MSG_ERROR([you must specify an configuration file if --with-multistrap-config is specified])
70     fi],
71     [multistrap_config="$sysconfdir/snf-image/multistrap.conf"]
72 )
73 AC_SUBST(MULTISTRAP_CONFIG, $multistrap_config)
74
75 # --with-multistrap-aptprefdir
76 AC_ARG_WITH([multistrap-aptprefdir],
77   [AS_HELP_STRING([--with-multistrap-aptprefdir=MULTISTRAP_APTPREFDIR],
78       [path to a directory where preferences files for apt are hosted. Those files will be used during multistrap
79       [SYSCONFDIR/snf-image/apt.pref.d]]
80     )],
81     [if test "$withval" != "yes" -a "$withval" != "no"; then
82         multistrap_aptprefdir="$withval"
83         AC_MSG_NOTICE(using apt preferences directory for multistrap: $withval)
84      elif test "$withval" != "no"; then
85          AC_MSG_ERROR([you must specify a directory if --with-multistrap-aptprefdir is specified])
86     fi],
87     [multistrap_aptprefdir="$sysconfdir/snf-image/apt.pref.d"]
88 )
89 AC_SUBST(MULTISTRAP_APTPREFDIR, $multistrap_aptprefdir)
90
91 # --with-helper-dir
92 AC_ARG_WITH([helper-dir],
93     [AS_HELP_STRING([--with-helper-dir=DIR],
94         [top-level directory to host the helper VM
95         [LOCALSTATEDIR/lib/snf-image/helper]]
96     )],
97     [helper_dir="$withval"],
98     [helper_dir="$localstatedir/lib/snf-image/helper"])
99 AC_SUBST(HELPER_DIR, $helper_dir)
100
101 # --with-os-dir=...
102 AC_ARG_WITH([os-dir],
103     [AS_HELP_STRING([--with-os-dir=DIR],
104         [top-level OS directory under which to install [DATADIR/ganeti/os]]
105     )],
106     [os_dir="$withval"],
107     [os_dir="$datadir/ganeti/os"])
108 AC_SUBST(OS_DIR, $os_dir)
109
110 # --with-default-dir=...
111 AC_ARG_WITH([default-dir],
112     [AS_HELP_STRING([--with-default-dir=DIR],
113         [top-level default config directory under which to install]
114         [ [SYSCONFDIR/default]]
115     )],
116     [default_dir="$withval"],
117     [default_dir="$sysconfdir/default"])
118 AC_SUBST(DEFAULT_DIR, $default_dir)
119
120 # Check common programs
121 AC_PROG_INSTALL
122 AC_PROG_LN_S
123 AC_PROG_AWK
124 AC_PROG_MKDIR_P
125
126 AC_PATH_PROG(LOSETUP, [losetup], [], [$PATH:/usr/sbin:/sbin])
127 if test -z "$LOSETUP" ; then
128   AC_MSG_ERROR([losetup not found in $PATH:/usr/sbin:/sbin])
129 fi
130
131 AC_PATH_PROG(KPARTX, [kpartx], [], [$PATH:/usr/sbin:/sbin])
132 if test -z "$KPARTX" ; then
133   AC_MSG_ERROR([kpartx not found in $PATH:/usr/sbin:/sbin])
134 fi
135
136 AC_PATH_PROG(SFDISK, [sfdisk], [], [$PATH:/usr/sbin:/sbin])
137 if test -z "$SFDISK" ; then
138   AC_MSG_ERROR([sfdisk not found in $PATH:/usr/sbin:/sbin])
139 fi
140
141 AC_PATH_PROG(QEMU_IMG, [qemu-img], [], [$PATH:/usr/sbin:/sbin])
142 if test -z "$QEMU_IMG" ; then
143   AC_MSG_ERROR([qemu-img not found in $PATH:/usr/sbin:/sbin])
144 fi
145
146 AC_PATH_PROG(INSTALL_MBR, [install-mbr], [], [$PATH:/usr/sbin:/sbin])
147 if test -z "$INSTALL_MBR" ; then
148   AC_MSG_ERROR([install-mbr not found in $PATH:/usr/sbin:/sbin])
149 fi
150
151 AC_PATH_PROG(TIMEOUT, [timeout], [], [$PATH:/usr/sbin:/sbin])
152 if test -z "$TIMEOUT" ; then
153   AC_MSG_ERROR([timeout not found in $PATH:/usr/sbin:/sbin])
154 fi
155
156 AC_PATH_PROG(CURL, [curl], [], [$PATH:/usr/sbin:/sbin])
157 if test -z "$CURL" ; then
158   AC_MSG_ERROR([curl not found in $PATH:/usr/sbin:/sbin])
159 fi
160
161 #Python Dependencies
162 AM_PATH_PYTHON(2.6)
163
164 AC_PYTHON_MODULE(prctl, t)
165 AC_PYTHON_MODULE(scapy, t)
166
167 AC_CONFIG_FILES([
168     Makefile
169 ])
170
171 AC_OUTPUT
172
173 # vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
174