htools: add option to control the use of RAPI
[ganeti-local] / configure.ac
1 # Configure script for Ganeti
2 m4_define([gnt_version_major], [2])
3 m4_define([gnt_version_minor], [4])
4 m4_define([gnt_version_revision], [0])
5 m4_define([gnt_version_suffix], [])
6 m4_define([gnt_version_full],
7           m4_format([%d.%d.%d%s],
8                     gnt_version_major, gnt_version_minor,
9                     gnt_version_revision, gnt_version_suffix))
10
11 AC_PREREQ(2.59)
12 AC_INIT(ganeti, gnt_version_full, ganeti@googlegroups.com)
13 AC_CONFIG_AUX_DIR(autotools)
14 AC_CONFIG_SRCDIR(configure)
15 AM_INIT_AUTOMAKE([1.9 foreign tar-ustar -Wall -Wno-portability])
16
17 AC_SUBST([VERSION_MAJOR], gnt_version_major)
18 AC_SUBST([VERSION_MINOR], gnt_version_minor)
19 AC_SUBST([VERSION_REVISION], gnt_version_revision)
20 AC_SUBST([VERSION_SUFFIX], gnt_version_suffix)
21 AC_SUBST([VERSION_FULL], gnt_version_full)
22
23 # --with-ssh-initscript=...
24 AC_ARG_WITH([ssh-initscript],
25   [AS_HELP_STRING([--with-ssh-initscript=SCRIPT],
26     [SSH init script to use (default is /etc/init.d/ssh)]
27   )],
28   [ssh_initd_script="$withval"],
29   [ssh_initd_script="/etc/init.d/ssh"])
30 AC_SUBST(SSH_INITD_SCRIPT, $ssh_initd_script)
31
32 # --with-export-dir=...
33 AC_ARG_WITH([export-dir],
34   [AS_HELP_STRING([--with-export-dir=DIR],
35     [directory to use by default for instance image]
36     [ exports (default is /srv/ganeti/export)]
37   )],
38   [export_dir="$withval"],
39   [export_dir="/srv/ganeti/export"])
40 AC_SUBST(EXPORT_DIR, $export_dir)
41
42 # --with-ssh-config-dir=...
43 AC_ARG_WITH([ssh-config-dir],
44   [AS_HELP_STRING([--with-ssh-config-dir=DIR],
45     [ directory with ssh host keys ]
46     [ (default is /etc/ssh)]
47   )],
48   [ssh_config_dir="$withval"],
49   [ssh_config_dir="/etc/ssh"])
50 AC_SUBST(SSH_CONFIG_DIR, $ssh_config_dir)
51
52 # --with-os-search-path=...
53 # do a bit of black sed magic to for quoting of the strings in the list
54 AC_ARG_WITH([os-search-path],
55   [AS_HELP_STRING([--with-os-search-path=LIST],
56     [comma separated list of directories to]
57     [ search for OS images (default is /srv/ganeti/os)]
58   )],
59   [os_search_path=`echo -n "$withval" | sed -e "s/\([[^,]]*\)/'\1'/g"`],
60   [os_search_path="'/srv/ganeti/os'"])
61 AC_SUBST(OS_SEARCH_PATH, $os_search_path)
62
63 # --with-iallocator-search-path=...
64 # do a bit of black sed magic to for quoting of the strings in the list
65 AC_ARG_WITH([iallocator-search-path],
66   [AS_HELP_STRING([--with-iallocator-search-path=LIST],
67     [comma separated list of directories to]
68     [ search for instance allocators (default is $libdir/ganeti/iallocators)]
69   )],
70   [iallocator_search_path=`echo -n "$withval" | sed -e "s/\([[^,]]*\)/'\1'/g"`],
71   [iallocator_search_path="'$libdir/$PACKAGE_NAME/iallocators'"])
72 AC_SUBST(IALLOCATOR_SEARCH_PATH, $iallocator_search_path)
73
74 # --with-xen-bootloader=...
75 AC_ARG_WITH([xen-bootloader],
76   [AS_HELP_STRING([--with-xen-bootloader=PATH],
77     [bootloader for Xen hypervisor (default is empty)]
78   )],
79   [xen_bootloader="$withval"],
80   [xen_bootloader=])
81 AC_SUBST(XEN_BOOTLOADER, $xen_bootloader)
82
83 # --with-xen-kernel=...
84 AC_ARG_WITH([xen-kernel],
85   [AS_HELP_STRING([--with-xen-kernel=PATH],
86     [DomU kernel image for Xen hypervisor (default is /boot/vmlinuz-2.6-xenU)]
87   )],
88   [xen_kernel="$withval"],
89   [xen_kernel="/boot/vmlinuz-2.6-xenU"])
90 AC_SUBST(XEN_KERNEL, $xen_kernel)
91
92 # --with-xen-initrd=...
93 AC_ARG_WITH([xen-initrd],
94   [AS_HELP_STRING([--with-xen-initrd=PATH],
95     [DomU initrd image for Xen hypervisor (default is /boot/initrd-2.6-xenU)]
96   )],
97   [xen_initrd="$withval"],
98   [xen_initrd="/boot/initrd-2.6-xenU"])
99 AC_SUBST(XEN_INITRD, $xen_initrd)
100
101 # --with-file-storage-dir=...
102 AC_ARG_WITH([file-storage-dir],
103   [AS_HELP_STRING([--with-file-storage-dir=PATH],
104     [directory to store files for file-based backend]
105     [ (default is /srv/ganeti/file-storage)]
106   )],
107   [[file_storage_dir="$withval";
108     if test "$withval" != no; then
109       enable_file_storage=True
110     else
111       enable_file_storage=False
112     fi
113   ]],
114   [[file_storage_dir="/srv/ganeti/file-storage"; enable_file_storage="True"]])
115 AC_SUBST(FILE_STORAGE_DIR, $file_storage_dir)
116 AC_SUBST(ENABLE_FILE_STORAGE, $enable_file_storage)
117
118 # --with-shared-file-storage-dir=...
119 AC_ARG_WITH([shared-file-storage-dir],
120   [AS_HELP_STRING([--with-shared-file-storage-dir=PATH],
121     [directory to store files for shared file-based backend]
122     [ (default is /srv/ganeti/shared-file-storage)]
123   )],
124   [[shared_file_storage_dir="$withval";
125     if test "$withval" != no; then
126       enable_shared_file_storage=True
127     else
128       enable_shared_file_storage=False
129     fi
130   ]],
131   [[shared_file_storage_dir="/srv/ganeti/shared-file-storage"; enable_shared_file_storage="True"]])
132 AC_SUBST(SHARED_FILE_STORAGE_DIR, $shared_file_storage_dir)
133 AC_SUBST(ENABLE_SHARED_FILE_STORAGE, $enable_shared_file_storage)
134
135 # --with-kvm-path=...
136 AC_ARG_WITH([kvm-path],
137   [AS_HELP_STRING([--with-kvm-path=PATH],
138     [absolute path to the kvm binary]
139     [ (default is /usr/bin/kvm)]
140   )],
141   [kvm_path="$withval"],
142   [kvm_path="/usr/bin/kvm"])
143 AC_SUBST(KVM_PATH, $kvm_path)
144
145 # --with-lvm-stripecount=...
146 AC_ARG_WITH([lvm-stripecount],
147   [AS_HELP_STRING([--with-lvm-stripecount=NUM],
148     [the number of stripes to use for LVM volumes]
149     [ (default is 1)]
150   )],
151   [lvm_stripecount="$withval"],
152   [lvm_stripecount="1"])
153 AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount)
154
155 # --with-user-prefix=...
156 AC_ARG_WITH([user-prefix],
157   [AS_HELP_STRING([--with-user-prefix=PREFIX],
158     [prefix for daemon users]
159     [ (default is to run all daemons as root)]
160   )],
161   [user_masterd="${withval}masterd";
162    user_rapi="${withval}rapi";
163    user_confd="${withval}confd";
164    user_noded="root"],
165   [user_masterd="root";
166    user_rapi="root";
167    user_confd="root";
168    user_noded="root"])
169 AC_SUBST(MASTERD_USER, $user_masterd)
170 AC_SUBST(RAPI_USER, $user_rapi)
171 AC_SUBST(CONFD_USER, $user_confd)
172 AC_SUBST(NODED_USER, $user_noded)
173
174 # --with-group-prefix=...
175 AC_ARG_WITH([group-prefix],
176   [AS_HELP_STRING([--with-group-prefix=PREFIX],
177     [prefix for daemon POSIX groups]
178     [ (default is to run all daemons under group root)]
179   )],
180   [group_rapi="${withval}rapi";
181    group_admin="${withval}admin";
182    group_confd="${withval}confd";
183    group_masterd="${withval}masterd";
184    group_daemons="${withval}daemons";],
185   [group_rapi="root";
186    group_admin="root";
187    group_confd="root";
188    group_masterd="root";
189    group_daemons="root"])
190 AC_SUBST(RAPI_GROUP, $group_rapi)
191 AC_SUBST(ADMIN_GROUP, $group_admin)
192 AC_SUBST(CONFD_GROUP, $group_confd)
193 AC_SUBST(MASTERD_GROUP, $group_masterd)
194 AC_SUBST(DAEMONS_GROUP, $group_daemons)
195
196 # Print the config to the user
197 AC_MSG_NOTICE([Running ganeti-masterd as $group_masterd:$group_masterd])
198 AC_MSG_NOTICE([Running ganeti-rapi as $user_rapi:$group_rapi])
199 AC_MSG_NOTICE([Running ganeti-confd as $user_confd:$group_confd])
200 AC_MSG_NOTICE([Group for daemons is $group_daemons])
201 AC_MSG_NOTICE([Group for clients is $group_admin])
202
203 # --enable-drbd-barriers
204 AC_ARG_ENABLE([drbd-barriers],
205   [AS_HELP_STRING([--enable-drbd-barriers],
206     [enable the DRBD barrier functionality (>= 8.0.12) (default: enabled)])],
207   [[if test "$enableval" != no; then
208       DRBD_BARRIERS=True
209     else
210       DRBD_BARRIERS=False
211     fi
212   ]],
213   [DRBD_BARRIERS=True])
214 AC_SUBST(DRBD_BARRIERS, $DRBD_BARRIERS)
215
216 # --enable-syslog[=no/yes/only]
217 AC_ARG_ENABLE([syslog],
218   [AS_HELP_STRING([--enable-syslog],
219     [enable use of syslog (default: disabled), one of no/yes/only])],
220   [[case "$enableval" in
221       no)
222         SYSLOG=no
223         ;;
224       yes)
225         SYSLOG=yes
226         ;;
227       only)
228         SYSLOG=only
229         ;;
230       *)
231         SYSLOG=
232         ;;
233     esac
234   ]],
235   [SYSLOG=no])
236
237 if test -z "$SYSLOG"
238 then
239   AC_MSG_ERROR([invalid value for syslog, choose one of no/yes/only])
240 fi
241 AC_SUBST(SYSLOG_USAGE, $SYSLOG)
242
243 # --enable-htools
244 HTOOLS=
245 AC_ARG_ENABLE([htools],
246         [AS_HELP_STRING([--enable-htools],
247         [enable use of htools (needs GHC and libraries, default: check)])],
248         [],
249         [enable_htools=check])
250
251 # --enable-htools-rapi
252 HTOOLS_RAPI=
253 AC_ARG_ENABLE([htools-rapi],
254         [AS_HELP_STRING([--enable-htools-rapi],
255         [enable use of RAPI in htools (needs curl, default: no)])],
256         [],
257         [enable_htools_rapi=no])
258
259 # --with-disk-separator=...
260 AC_ARG_WITH([disk-separator],
261   [AS_HELP_STRING([--with-disk-separator=STRING],
262     [Disk index separator, useful if the default of ':' is handled specially by the hypervisor]
263   )],
264   [disk_separator="$withval"],
265   [disk_separator=":"])
266 AC_SUBST(DISK_SEPARATOR, $disk_separator)
267
268 # Check common programs
269 AC_PROG_INSTALL
270 AC_PROG_LN_S
271
272 # Check for pandoc
273 AC_ARG_VAR(PANDOC, [pandoc path])
274 AC_PATH_PROG(PANDOC, [pandoc], [])
275 if test -z "$PANDOC"
276 then
277   AC_MSG_WARN([pandoc not found, man pages rebuild will not be possible])
278 fi
279
280 # Check for python-sphinx
281 AC_ARG_VAR(SPHINX, [sphinx-build path])
282 AC_PATH_PROG(SPHINX, [sphinx-build], [])
283 if test -z "$SPHINX"
284 then
285   AC_MSG_WARN([sphinx-build not found, documentation rebuild will not be possible])
286 fi
287
288 # Check for graphviz (dot)
289 AC_ARG_VAR(DOT, [dot path])
290 AC_PATH_PROG(DOT, [dot], [])
291 if test -z "$DOT"
292 then
293   AC_MSG_WARN([dot (from the graphviz suite) not found, documentation rebuild not possible])
294 fi
295
296 # Check for pylint
297 AC_ARG_VAR(PYLINT, [pylint path])
298 AC_PATH_PROG(PYLINT, [pylint], [])
299 if test -z "$PYLINT"
300 then
301   AC_MSG_WARN([pylint not found, checking code will not be possible])
302 fi
303
304 # Check for socat
305 AC_ARG_VAR(SOCAT, [socat path])
306 AC_PATH_PROG(SOCAT, [socat], [])
307 if test -z "$SOCAT"
308 then
309   AC_MSG_ERROR([socat not found])
310 fi
311
312 if test "$enable_htools" != "no"; then
313
314 # Check for ghc
315 AC_ARG_VAR(GHC, [ghc path])
316 AC_PATH_PROG(GHC, [ghc], [])
317 if test -z "$GHC"; then
318   if test "$enable_htools" != "check"; then
319     AC_MSG_FAILURE([ghc not found, htools compilation will not possible])
320   fi
321 fi
322
323 # Check for ghc-pkg
324 HTOOLS_MODULES=
325 AC_ARG_VAR(GHC_PKG, [ghc-pkg path])
326 AC_PATH_PROG(GHC_PKG, [ghc-pkg], [])
327 if test -z "$GHC_PKG"; then
328   if test "$enable_htools" != "check"; then
329     AC_MSG_FAILURE([ghc-pkg not found, htools compilation will not be possible])
330   fi
331 else
332   # check for modules
333   AC_MSG_NOTICE([checking for required haskell modules])
334   HTOOLS_NOCURL=-DNO_CURL
335   if test "$enable_htools_rapi" != "no"; then
336     AC_MSG_CHECKING([curl])
337     GHC_PKG_CURL=$($GHC_PKG latest curl)
338     if test -z "$GHC_PKG_CURL"; then
339       if test "$enable_htools_rapi" = "check"; then
340         AC_MSG_WARN([The curl library not found, htools will be compiled
341                      without RAPI support])
342       else
343         AC_MSG_FAILURE([The curl library was not found, but it has
344                         been requested])
345       fi
346     else
347       HTOOLS_NOCURL=
348     fi
349     AC_MSG_RESULT($GHC_PKG_CURL)
350   fi
351   AC_SUBST(GHC_PKG_CURL)
352   AC_SUBST(HTOOLS_NOCURL)
353   AC_MSG_CHECKING([parallel])
354   GHC_PKG_PARALLEL=$($GHC_PKG --simple-output list 'parallel-2.*')
355   if test -z "$GHC_PKG_PARALLEL"
356   then
357     GHC_PKG_PARALLEL=$($GHC_PKG --simple-output list 'parallel-1.*')
358   fi
359   AC_SUBST(GHC_PKG_PARALLEL)
360   AC_MSG_RESULT($GHC_PKG_PARALLEL)
361   AC_MSG_CHECKING([json])
362   GHC_PKG_JSON=$($GHC_PKG latest json)
363   AC_MSG_RESULT($GHC_PKG_JSON)
364   AC_MSG_CHECKING([network])
365   GHC_PKG_NETWORK=$($GHC_PKG latest network)
366   AC_MSG_RESULT($GHC_PKG_NETWORK)
367   if test -z "$GHC_PKG_PARALLEL" || test -z "$GHC_PKG_JSON" || \
368      test -z "$GHC_PKG_NETWORK"; then
369     if test "$enable_htools" != "check"; then
370       AC_MSG_FAILURE([Required Haskell modules not found, htools compilation
371                       disabled])
372
373     fi
374   else
375     # we leave the other modules to be auto-selected
376     HTOOLS_MODULES="-package $GHC_PKG_PARALLEL"
377   fi
378 fi
379 AC_SUBST(HTOOLS_MODULES)
380
381 if test "$enable_htools" != "no"; then
382   if test -z "$GHC" || test -z "$HTOOLS_MODULES"; then
383     AC_MSG_WARN([Haskell compiler/required libraries not found, htools
384                  compilation disabled])
385   else
386     HTOOLS=yes
387   fi
388 fi
389 AC_SUBST(HTOOLS)
390
391 # Check for HsColour
392 HTOOLS_APIDOC=no
393 AC_ARG_VAR(HSCOLOUR, [HsColour path])
394 AC_PATH_PROG(HSCOLOUR, [HsColour], [])
395 if test -z "$HSCOLOUR"; then
396   AC_MSG_WARN([HsColour not found, htools API documentation will not be
397                generated])
398 fi
399
400 # Check for haddock
401 AC_ARG_VAR(HADDOCK, [haddock path])
402 AC_PATH_PROG(HADDOCK, [haddock], [])
403 if test -z "$HADDOCK"; then
404   AC_MSG_WARN([haddock not found, htools API documentation will not be
405                generated])
406 fi
407 if test "$HADDOCK" && test "$HSCOLOUR"; then
408   HTOOLS_APIDOC=yes
409 fi
410 AC_SUBST(HTOOLS_APIDOC)
411
412 fi # end if enable_htools, define automake conditions
413
414 AM_CONDITIONAL([WANT_HTOOLS], [test x$HTOOLS = xyes])
415 AM_CONDITIONAL([WANT_HTOOLSAPIDOC], [test x$HTOOLS_APIDOC = xyes])
416
417
418 SOCAT_USE_ESCAPE=
419 AC_ARG_ENABLE([socat-escape],
420   [AS_HELP_STRING([--enable-socat-escape],
421     [use escape functionality available in socat >= 1.7 (default: detect
422      automatically)])],
423   [[if test "$enableval" = yes; then
424       SOCAT_USE_ESCAPE=True
425     else
426       SOCAT_USE_ESCAPE=False
427     fi
428   ]])
429
430 if test -z "$SOCAT_USE_ESCAPE"
431 then
432   if $SOCAT -hh | grep -w -q escape; then
433     SOCAT_USE_ESCAPE=True
434   else
435     SOCAT_USE_ESCAPE=False
436   fi
437 fi
438
439 AC_SUBST(SOCAT_USE_ESCAPE)
440
441 SOCAT_USE_COMPRESS=
442 AC_ARG_ENABLE([socat-compress],
443   [AS_HELP_STRING([--enable-socat-compress],
444     [use OpenSSL compression option available in patched socat builds
445      (see INSTALL for details; default: detect automatically)])],
446   [[if test "$enableval" = yes; then
447       SOCAT_USE_COMPRESS=True
448     else
449       SOCAT_USE_COMPRESS=False
450     fi
451   ]])
452
453 if test -z "$SOCAT_USE_COMPRESS"
454 then
455   if $SOCAT -hhh | grep -w -q openssl-compress; then
456     SOCAT_USE_COMPRESS=True
457   else
458     SOCAT_USE_COMPRESS=False
459   fi
460 fi
461
462 AC_SUBST(SOCAT_USE_COMPRESS)
463
464 if man --help | grep -q -e --warnings
465 then
466   MAN_HAS_WARNINGS=1
467 else
468   MAN_HAS_WARNINGS=
469   AC_MSG_WARN([man doesn't support --warnings, man pages checks
470                will not be possible])
471 fi
472
473 AC_SUBST(MAN_HAS_WARNINGS)
474
475 # Check for Python
476 AM_PATH_PYTHON(2.4)
477
478 AC_PYTHON_MODULE(OpenSSL, t)
479 AC_PYTHON_MODULE(simplejson, t)
480 AC_PYTHON_MODULE(pyparsing, t)
481 AC_PYTHON_MODULE(pyinotify, t)
482 AC_PYTHON_MODULE(pycurl, t)
483
484 # This is optional but then we've limited functionality
485 AC_PYTHON_MODULE(paramiko)
486 if test "$HAVE_PYMOD_PARAMIKO" = "no"; then
487   AC_MSG_WARN([You do not have paramiko installed. While this is optional you
488                have to setup SSH and noded on the joining nodes yourself.])
489 fi
490
491 AC_CONFIG_FILES([ Makefile ])
492
493 AC_OUTPUT