Merge branch 'stable-2.8' into stable-2.9
[ganeti-local] / configure.ac
1 # Configure script for Ganeti
2 m4_define([gnt_version_major], [2])
3 m4_define([gnt_version_minor], [9])
4 m4_define([gnt_version_revision], [0])
5 m4_define([gnt_version_suffix], [~alpha1])
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-xen-config-dir=...
53 AC_ARG_WITH([xen-config-dir],
54   [AS_HELP_STRING([--with-xen-config-dir=DIR],
55                   m4_normalize([Xen configuration directory
56                                 (default: /etc/xen)]))],
57   [xen_config_dir="$withval"],
58   [xen_config_dir=/etc/xen])
59 AC_SUBST(XEN_CONFIG_DIR, $xen_config_dir)
60
61 # --with-os-search-path=...
62 # do a bit of black sed magic to for quoting of the strings in the list
63 AC_ARG_WITH([os-search-path],
64   [AS_HELP_STRING([--with-os-search-path=LIST],
65     [comma separated list of directories to]
66     [ search for OS images (default is /srv/ganeti/os)]
67   )],
68   [os_search_path=`echo -n "$withval" | sed -e "s/\([[^,]]*\)/'\1'/g"`],
69   [os_search_path="'/srv/ganeti/os'"])
70 AC_SUBST(OS_SEARCH_PATH, $os_search_path)
71
72 # --with-extstorage-search-path=...
73 # same black sed magic for quoting of the strings in the list
74 AC_ARG_WITH([extstorage-search-path],
75   [AS_HELP_STRING([--with-extstorage-search-path=LIST],
76     [comma separated list of directories to]
77     [ search for External Storage Providers]
78     [ (default is /srv/ganeti/extstorage)]
79   )],
80   [es_search_path=`echo -n "$withval" | sed -e "s/\([[^,]]*\)/'\1'/g"`],
81   [es_search_path="'/srv/ganeti/extstorage'"])
82 AC_SUBST(ES_SEARCH_PATH, $es_search_path)
83
84 # --with-iallocator-search-path=...
85 # do a bit of black sed magic to for quoting of the strings in the list
86 AC_ARG_WITH([iallocator-search-path],
87   [AS_HELP_STRING([--with-iallocator-search-path=LIST],
88     [comma separated list of directories to]
89     [ search for instance allocators (default is $libdir/ganeti/iallocators)]
90   )],
91   [iallocator_search_path=`echo -n "$withval" | sed -e "s/\([[^,]]*\)/'\1'/g"`],
92   [iallocator_search_path="'$libdir/$PACKAGE_NAME/iallocators'"])
93 AC_SUBST(IALLOCATOR_SEARCH_PATH, $iallocator_search_path)
94
95 # --with-xen-bootloader=...
96 AC_ARG_WITH([xen-bootloader],
97   [AS_HELP_STRING([--with-xen-bootloader=PATH],
98     [bootloader for Xen hypervisor (default is empty)]
99   )],
100   [xen_bootloader="$withval"],
101   [xen_bootloader=])
102 AC_SUBST(XEN_BOOTLOADER, $xen_bootloader)
103
104 # --with-xen-kernel=...
105 AC_ARG_WITH([xen-kernel],
106   [AS_HELP_STRING([--with-xen-kernel=PATH],
107     [DomU kernel image for Xen hypervisor (default is /boot/vmlinuz-3-xenU)]
108   )],
109   [xen_kernel="$withval"],
110   [xen_kernel="/boot/vmlinuz-3-xenU"])
111 AC_SUBST(XEN_KERNEL, $xen_kernel)
112
113 # --with-xen-initrd=...
114 AC_ARG_WITH([xen-initrd],
115   [AS_HELP_STRING([--with-xen-initrd=PATH],
116     [DomU initrd image for Xen hypervisor (default is /boot/initrd-3-xenU)]
117   )],
118   [xen_initrd="$withval"],
119   [xen_initrd="/boot/initrd-3-xenU"])
120 AC_SUBST(XEN_INITRD, $xen_initrd)
121
122 # --with-kvm-kernel=...
123 AC_ARG_WITH([kvm-kernel],
124   [AS_HELP_STRING([--with-kvm-kernel=PATH],
125     [Guest kernel image for KVM hypervisor (default is /boot/vmlinuz-3-kvmU)]
126   )],
127   [kvm_kernel="$withval"],
128   [kvm_kernel="/boot/vmlinuz-3-kvmU"])
129 AC_SUBST(KVM_KERNEL, $kvm_kernel)
130
131 # --with-shared-file-storage-dir=...
132 AC_ARG_WITH([shared-file-storage-dir],
133   [AS_HELP_STRING([--with-shared-file-storage-dir=PATH],
134     [directory to store files for shared file-based backend]
135     [ (default is /srv/ganeti/shared-file-storage)]
136   )],
137   [[shared_file_storage_dir="/srv/ganeti/shared-file-storage"]])
138 AC_SUBST(SHARED_FILE_STORAGE_DIR, $shared_file_storage_dir)
139
140 # --with-kvm-path=...
141 AC_ARG_WITH([kvm-path],
142   [AS_HELP_STRING([--with-kvm-path=PATH],
143     [absolute path to the kvm binary]
144     [ (default is /usr/bin/kvm)]
145   )],
146   [kvm_path="$withval"],
147   [kvm_path="/usr/bin/kvm"])
148 AC_SUBST(KVM_PATH, $kvm_path)
149
150 # --with-lvm-stripecount=...
151 AC_ARG_WITH([lvm-stripecount],
152   [AS_HELP_STRING([--with-lvm-stripecount=NUM],
153     [the default number of stripes to use for LVM volumes]
154     [ (default is 1)]
155   )],
156   [lvm_stripecount="$withval"],
157   [lvm_stripecount=1])
158 AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount)
159
160 # --with-ssh-login-user=...
161 AC_ARG_WITH([ssh-login-user],
162   [AS_HELP_STRING([--with-ssh-login-user=USERNAME],
163     [user to use for SSH logins within the cluster (default is root)]
164   )],
165   [ssh_login_user="$withval"],
166   [ssh_login_user=root])
167 AC_SUBST(SSH_LOGIN_USER, $ssh_login_user)
168
169 # --with-ssh-console-user=...
170 AC_ARG_WITH([ssh-console-user],
171   [AS_HELP_STRING([--with-ssh-console-user=USERNAME],
172     [user to use for SSH logins to access instance consoles (default is root)]
173   )],
174   [ssh_console_user="$withval"],
175   [ssh_console_user=root])
176 AC_SUBST(SSH_CONSOLE_USER, $ssh_console_user)
177
178 # --with-default-user=...
179 AC_ARG_WITH([default-user],
180   [AS_HELP_STRING([--with-default-user=USERNAME],
181     [default user for daemons]
182     [ (default is to run all daemons as root)]
183   )],
184   [user_default="$withval"],
185   [user_default=root])
186
187 # --with-default-group=...
188 AC_ARG_WITH([default-group],
189   [AS_HELP_STRING([--with-default-group=GROUPNAME],
190     [default group for daemons]
191     [ (default is to run all daemons under group root)]
192   )],
193   [group_default="$withval"],
194   [group_default=root])
195
196 # --with-user-prefix=...
197 AC_ARG_WITH([user-prefix],
198   [AS_HELP_STRING([--with-user-prefix=PREFIX],
199     [prefix for daemon users]
200     [ (default is to run all daemons as root; use --with-default-user]
201     [ to change the default)]
202   )],
203   [user_masterd="${withval}masterd";
204    user_rapi="${withval}rapi";
205    user_confd="${withval}confd";
206    user_luxid="${withval}luxid";
207    user_noded="$user_default";
208    user_mond="$user_default"],
209   [user_masterd="$user_default";
210    user_rapi="$user_default";
211    user_confd="$user_default";
212    user_luxid="$user_default";
213    user_noded="$user_default";
214    user_mond="$user_default"])
215 AC_SUBST(MASTERD_USER, $user_masterd)
216 AC_SUBST(RAPI_USER, $user_rapi)
217 AC_SUBST(CONFD_USER, $user_confd)
218 AC_SUBST(LUXID_USER, $user_luxid)
219 AC_SUBST(NODED_USER, $user_noded)
220 AC_SUBST(MOND_USER, $user_mond)
221
222 # --with-group-prefix=...
223 AC_ARG_WITH([group-prefix],
224   [AS_HELP_STRING([--with-group-prefix=PREFIX],
225     [prefix for daemon POSIX groups]
226     [ (default is to run all daemons under group root; use]
227     [ --with-default-group to change the default)]
228   )],
229   [group_rapi="${withval}rapi";
230    group_admin="${withval}admin";
231    group_confd="${withval}confd";
232    group_luxid="${withval}luxid";
233    group_masterd="${withval}masterd";
234    group_noded="$group_default";
235    group_daemons="${withval}daemons";
236    group_mond="$group_default"],
237   [group_rapi="$group_default";
238    group_admin="$group_default";
239    group_confd="$group_default";
240    group_luxid="$group_default";
241    group_masterd="$group_default";
242    group_noded="$group_default";
243    group_daemons="$group_default";
244    group_mond="$group_default"])
245 AC_SUBST(RAPI_GROUP, $group_rapi)
246 AC_SUBST(ADMIN_GROUP, $group_admin)
247 AC_SUBST(CONFD_GROUP, $group_confd)
248 AC_SUBST(LUXID_GROUP, $group_luxid)
249 AC_SUBST(MASTERD_GROUP, $group_masterd)
250 AC_SUBST(NODED_GROUP, $group_noded)
251 AC_SUBST(DAEMONS_GROUP, $group_daemons)
252 AC_SUBST(MOND_GROUP, $group_mond)
253
254 # Print the config to the user
255 AC_MSG_NOTICE([Running ganeti-masterd as $group_masterd:$group_masterd])
256 AC_MSG_NOTICE([Running ganeti-rapi as $user_rapi:$group_rapi])
257 AC_MSG_NOTICE([Running ganeti-confd as $user_confd:$group_confd])
258 AC_MSG_NOTICE([Running ganeti-luxid as $user_luxid:$group_luxid])
259 AC_MSG_NOTICE([Group for daemons is $group_daemons])
260 AC_MSG_NOTICE([Group for clients is $group_admin])
261
262 # --enable-drbd-barriers
263 AC_ARG_ENABLE([drbd-barriers],
264   [AS_HELP_STRING([--enable-drbd-barriers],
265                   m4_normalize([enable the DRBD barriers functionality by
266                                 default (>= 8.0.12) (default: enabled)]))],
267   [[if test "$enableval" != no; then
268       DRBD_BARRIERS=n
269       DRBD_NO_META_FLUSH=False
270     else
271       DRBD_BARRIERS=bf
272       DRBD_NO_META_FLUSH=True
273     fi
274   ]],
275   [DRBD_BARRIERS=n
276    DRBD_NO_META_FLUSH=False
277   ])
278 AC_SUBST(DRBD_BARRIERS, $DRBD_BARRIERS)
279 AC_SUBST(DRBD_NO_META_FLUSH, $DRBD_NO_META_FLUSH)
280
281 # --enable-syslog[=no/yes/only]
282 AC_ARG_ENABLE([syslog],
283   [AS_HELP_STRING([--enable-syslog],
284     [enable use of syslog (default: disabled), one of no/yes/only])],
285   [[case "$enableval" in
286       no)
287         SYSLOG=no
288         ;;
289       yes)
290         SYSLOG=yes
291         ;;
292       only)
293         SYSLOG=only
294         ;;
295       *)
296         SYSLOG=
297         ;;
298     esac
299   ]],
300   [SYSLOG=no])
301
302 if test -z "$SYSLOG"
303 then
304   AC_MSG_ERROR([invalid value for syslog, choose one of no/yes/only])
305 fi
306 AC_SUBST(SYSLOG_USAGE, $SYSLOG)
307
308 AC_ARG_ENABLE([restricted-commands],
309   [AS_HELP_STRING([--enable-restricted-commands],
310                   m4_normalize([enable restricted commands in the node daemon
311                                 (default: disabled)]))],
312   [[if test "$enableval" = no; then
313       enable_restricted_commands=False
314     else
315       enable_restricted_commands=True
316     fi
317   ]],
318   [enable_restricted_commands=False])
319 AC_SUBST(ENABLE_RESTRICTED_COMMANDS, $enable_restricted_commands)
320
321 # --with-disk-separator=...
322 AC_ARG_WITH([disk-separator],
323   [AS_HELP_STRING([--with-disk-separator=STRING],
324     [Disk index separator, useful if the default of ':' is handled]
325     [ specially by the hypervisor]
326   )],
327   [disk_separator="$withval"],
328   [disk_separator=":"])
329 AC_SUBST(DISK_SEPARATOR, $disk_separator)
330
331 # Check common programs
332 AC_PROG_INSTALL
333 AC_PROG_LN_S
334
335 # Check for the ip command
336 AC_ARG_VAR(IP_PATH, [ip path])
337 AC_PATH_PROG(IP_PATH, [ip], [])
338 if test -z "$IP_PATH"
339 then
340   AC_MSG_ERROR([ip command not found])
341 fi
342
343 # Check for pandoc
344 AC_ARG_VAR(PANDOC, [pandoc path])
345 AC_PATH_PROG(PANDOC, [pandoc], [])
346 if test -z "$PANDOC"
347 then
348   AC_MSG_WARN([pandoc not found, man pages rebuild will not be possible])
349 fi
350
351 # Check for python-sphinx
352 AC_ARG_VAR(SPHINX, [sphinx-build path])
353 AC_PATH_PROG(SPHINX, [sphinx-build], [])
354 if test -z "$SPHINX"
355 then
356   AC_MSG_WARN(m4_normalize([sphinx-build not found, documentation rebuild will
357                             not be possible]))
358 else
359   # Sphinx exits with code 1 when it prints its usage
360   sphinxver=`{ $SPHINX --version 2>&1 || :; } | head -n 3`
361
362   if ! echo "$sphinxver" | grep -q -w -e '^Sphinx' -e '^Usage:'; then
363     AC_MSG_ERROR([Unable to determine Sphinx version])
364
365   # Note: Character classes ([...]) need to be double quoted due to autoconf
366   # using m4
367   elif ! echo "$sphinxver" | grep -q -E '^Sphinx[[[:space:]]]+v[[1-9]]\>'; then
368     AC_MSG_ERROR([Sphinx 1.0 or higher is required])
369   fi
370 fi
371 AM_CONDITIONAL([HAS_SPHINX], [test -n "$SPHINX"])
372
373 AC_ARG_ENABLE([manpages-in-doc],
374   [AS_HELP_STRING([--enable-manpages-in-doc],
375                   m4_normalize([include man pages in HTML documentation
376                                 (requires sphinx; default disabled)]))],
377   [case "$enableval" in
378       yes) manpages_in_doc=yes ;;
379       no) manpages_in_doc= ;;
380       *)
381         AC_MSG_ERROR([Bad value $enableval for --enable-manpages-in-doc])
382         ;;
383     esac
384   ],
385   [manpages_in_doc=])
386 AM_CONDITIONAL([MANPAGES_IN_DOC], [test -n "$manpages_in_doc"])
387 AC_SUBST(MANPAGES_IN_DOC, $manpages_in_doc)
388
389 if test -z "$SPHINX" -a -n "$manpages_in_doc"; then
390   AC_MSG_ERROR([Including man pages in HTML documentation requires sphinx])
391 fi
392
393 # Check for graphviz (dot)
394 AC_ARG_VAR(DOT, [dot path])
395 AC_PATH_PROG(DOT, [dot], [])
396 if test -z "$DOT"
397 then
398   AC_MSG_WARN(m4_normalize([dot (from the graphviz suite) not found,
399                             documentation rebuild not possible]))
400 fi
401
402 # Check for pylint
403 AC_ARG_VAR(PYLINT, [pylint path])
404 AC_PATH_PROG(PYLINT, [pylint], [])
405 if test -z "$PYLINT"
406 then
407   AC_MSG_WARN([pylint not found, checking code will not be possible])
408 fi
409
410 # Check for pep8
411 AC_ARG_VAR(PEP8, [pep8 path])
412 AC_PATH_PROG(PEP8, [pep8], [])
413 if test -z "$PEP8"
414 then
415   AC_MSG_WARN([pep8 not found, checking code will not be complete])
416 fi
417 AM_CONDITIONAL([HAS_PEP8], [test -n "$PEP8"])
418
419 # Check for python-coverage
420 AC_ARG_VAR(PYCOVERAGE, [python-coverage path])
421 AC_PATH_PROGS(PYCOVERAGE, [python-coverage coverage], [])
422 if test -z "$PYCOVERAGE"
423 then
424   AC_MSG_WARN(m4_normalize([python-coverage or coverage not found, evaluating
425                             Python test coverage will not be possible]))
426 fi
427
428 # Check for socat
429 AC_ARG_VAR(SOCAT, [socat path])
430 AC_PATH_PROG(SOCAT, [socat], [])
431 if test -z "$SOCAT"
432 then
433   AC_MSG_ERROR([socat not found])
434 fi
435
436 # Check for qemu-img
437 AC_ARG_VAR(QEMUIMG_PATH, [qemu-img path])
438 AC_PATH_PROG(QEMUIMG_PATH, [qemu-img], [])
439 if test -z "$QEMUIMG_PATH"
440 then
441   AC_MSG_WARN([qemu-img not found, using ovfconverter will not be possible])
442 fi
443
444 # --enable-confd
445 ENABLE_CONFD=
446 AC_ARG_ENABLE([confd],
447   [AS_HELP_STRING([--enable-confd],
448   [enable the ganeti-confd daemon (default: check)])],
449   [],
450   [enable_confd=check])
451
452 ENABLE_MOND=
453 AC_ARG_ENABLE([monitoring],
454   [AS_HELP_STRING([--enable-monitoring],
455   [enable the ganeti monitoring daemon (default: check)])],
456   [],
457   [enable_monitoring=check])
458
459 # Check for ghc
460 AC_ARG_VAR(GHC, [ghc path])
461 AC_PATH_PROG(GHC, [ghc], [])
462 if test -z "$GHC"; then
463   AC_MSG_FAILURE([ghc not found, compilation will not possible])
464 fi
465
466 AC_MSG_CHECKING([checking for extra GHC flags])
467 GHC_BYVERSION_FLAGS=
468 # check for GHC supported flags that vary accross versions
469 for flag in -fwarn-incomplete-uni-patterns; do
470   if $GHC -e '0' $flag >/dev/null 2>/dev/null; then
471    GHC_BYVERSION_FLAGS="$GHC_BYVERSION_FLAGS $flag"
472   fi
473 done
474 AC_MSG_RESULT($GHC_BYVERSION_FLAGS)
475 AC_SUBST(GHC_BYVERSION_FLAGS)
476
477 # Check for ghc-pkg
478 AC_ARG_VAR(GHC_PKG, [ghc-pkg path])
479 AC_PATH_PROG(GHC_PKG, [ghc-pkg], [])
480 if test -z "$GHC_PKG"; then
481   AC_MSG_FAILURE([ghc-pkg not found, compilation will not be possible])
482 fi
483
484 # check for modules, first custom/special checks
485 AC_MSG_NOTICE([checking for required haskell modules])
486 HS_PARALLEL3=
487 AC_GHC_PKG_CHECK([parallel-3.*], [HS_PARALLEL3=-DPARALLEL3],
488                  [AC_GHC_PKG_REQUIRE(parallel)], t)
489 AC_SUBST(HS_PARALLEL3)
490
491 # and now standard modules
492 AC_GHC_PKG_REQUIRE(curl)
493 AC_GHC_PKG_REQUIRE(json)
494 AC_GHC_PKG_REQUIRE(network)
495 AC_GHC_PKG_REQUIRE(mtl)
496 AC_GHC_PKG_REQUIRE(bytestring)
497 AC_GHC_PKG_REQUIRE(utf8-string)
498
499 # extra modules for confd functionality
500 HS_REGEX_PCRE=-DNO_REGEX_PCRE
501 has_confd=False
502 if test "$enable_confd" != no; then
503   CONFD_PKG=
504   AC_GHC_PKG_CHECK([regex-pcre], [HS_REGEX_PCRE=],
505                    [CONFD_PKG="$CONFD_PKG regex-pcre"])
506   AC_GHC_PKG_CHECK([hslogger], [], [CONFD_PKG="$CONFD_PKG hslogger"])
507   AC_GHC_PKG_CHECK([Crypto], [], [CONFD_PKG="$CONFD_PKG Crypto"])
508   AC_GHC_PKG_CHECK([text], [], [CONFD_PKG="$CONFD_PKG text"])
509   AC_GHC_PKG_CHECK([hinotify], [], [CONFD_PKG="$CONFD_PKG hinotify"])
510   AC_GHC_PKG_CHECK([vector], [], [CONFD_PKG="$CONFD_PKG vector"])
511   if test -z "$CONFD_PKG"; then
512     has_confd=True
513   elif test "$enable_confd" = check; then
514     AC_MSG_WARN(m4_normalize([The required extra libraries for confd were
515                               not found ($CONFD_PKG), confd disabled]))
516   else
517     AC_MSG_FAILURE(m4_normalize([The confd functionality was requested, but
518                                  required libraries were not found:
519                                  $CONFD_PKG]))
520   fi
521 fi
522 AC_SUBST(HS_REGEX_PCRE)
523 if test "$has_confd" = True; then
524   AC_MSG_NOTICE([Enabling confd usage])
525 fi
526 AC_SUBST(ENABLE_CONFD, $has_confd)
527 AM_CONDITIONAL([ENABLE_CONFD], [test x$has_confd = xTrue])
528
529 #extra modules for monitoring daemon functionality
530 has_monitoring=False
531 if test "$enable_monitoring" != no; then
532   MONITORING_PKG=
533   AC_GHC_PKG_CHECK([attoparsec], [],
534                    [MONITORING_PKG="$MONITORING_PKG attoparsec"])
535   AC_GHC_PKG_CHECK([snap-server], [],
536                    [MONITORING_PKG="$MONITORING_PKG snap-server"])
537   AC_GHC_PKG_CHECK([process], [],
538                    [MONITORING_PKG="$MONITORING_PKG process"])
539   MONITORING_DEP=
540   if test "$has_confd" = False; then
541     MONITORING_DEP="$MONITORING_DEP confd"
542   fi
543   has_monitoring_pkg=False
544   if test -z "$MONITORING_PKG"; then
545     has_monitoring_pkg=True
546   elif test "$enable_monitoring" = check; then
547     AC_MSG_WARN(m4_normalize([The required extra libraries for the monitoring
548                               daemon were not found ($MONITORING_PKG),
549                               monitoring disabled]))
550   else
551     AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
552                                  required libraries were not found:
553                                  $MONITORING_PKG]))
554   fi
555   has_monitoring_dep=False
556   if test -z "$MONITORING_DEP"; then
557     has_monitoring_dep=True
558   elif test "$enable_monitoring" = check; then
559     AC_MSG_WARN(m4_normalize([The optional Ganeti components required for the
560                               monitoring agent were not enabled
561                               ($MONITORING_DEP), monitoring disabled]))
562   else
563     AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
564                                  required optional Ganeti components were not
565                                  found: $MONITORING_DEP]))
566   fi
567
568 fi
569 if test "$has_monitoring_pkg" = True -a "$has_monitoring_dep" = True; then
570   has_monitoring=True
571   AC_MSG_NOTICE([Enabling the monitoring agent usage])
572 fi
573 AC_SUBST(ENABLE_MOND, $has_monitoring)
574 AM_CONDITIONAL([ENABLE_MOND], [test "$has_monitoring" = True])
575
576 # development modules
577 HS_NODEV=
578 AC_GHC_PKG_CHECK([QuickCheck-2.*], [], [HS_NODEV=1], t)
579 AC_GHC_PKG_CHECK([test-framework-0.6*], [], [HS_NODEV=1], t)
580 AC_GHC_PKG_CHECK([test-framework-hunit], [], [HS_NODEV=1])
581 AC_GHC_PKG_CHECK([test-framework-quickcheck2], [], [HS_NODEV=1])
582 AC_GHC_PKG_CHECK([temporary], [], [HS_NODEV=1])
583 # FIXME: unify checks for non-test libraries (attoparsec, hinotify, ...)
584 #        that are needed to execute the tests, avoiding the duplication
585 #        of the checks.
586 AC_GHC_PKG_CHECK([attoparsec], [], [HS_NODEV=1])
587 AC_GHC_PKG_CHECK([vector], [], [HS_NODEV=1])
588 AC_GHC_PKG_CHECK([process], [],
589                  [MONITORING_PKG="$MONITORING_PKG process"])
590 if test -n "$HS_NODEV"; then
591    AC_MSG_WARN(m4_normalize([Required development modules were not found,
592                              you won't be able to run Haskell unittests]))
593 else
594    AC_MSG_NOTICE([Haskell development modules found, unittests enabled])
595 fi
596 AC_SUBST(HS_NODEV)
597
598 HTOOLS=yes
599 AC_SUBST(HTOOLS)
600
601 # --enable-split-query
602 ENABLE_SPLIT_QUERY=
603 AC_ARG_ENABLE([split-query],
604   [AS_HELP_STRING([--enable-split-query],
605   [enable use of custom query daemon via confd])],
606   [[case "$enableval" in
607       no)
608         enable_split_query=False
609         ;;
610       yes)
611         enable_split_query=True
612         ;;
613       *)
614         echo "Invalid value for enable-confd '$enableval'"
615         exit 1
616         ;;
617     esac
618   ]],
619   [[case "x${has_confd}x" in
620      xTruex)
621        enable_split_query=True
622        ;;
623      *)
624        enable_split_query=False
625        ;;
626    esac]])
627 AC_SUBST(ENABLE_SPLIT_QUERY, $enable_split_query)
628
629 if test x$enable_split_query = xTrue -a x$has_confd != xTrue; then
630   AC_MSG_ERROR([Split queries require the confd daemon])
631 fi
632
633 if test x$enable_split_query = xTrue; then
634   AC_MSG_NOTICE([Split query functionality enabled])
635 fi
636
637 # Check for HsColour
638 HS_APIDOC=no
639 AC_ARG_VAR(HSCOLOUR, [HsColour path])
640 AC_PATH_PROG(HSCOLOUR, [HsColour], [])
641 if test -z "$HSCOLOUR"; then
642   AC_MSG_WARN(m4_normalize([HsColour not found, htools API documentation will
643                             not be generated]))
644 fi
645
646 # Check for haddock
647 AC_ARG_VAR(HADDOCK, [haddock path])
648 AC_PATH_PROG(HADDOCK, [haddock], [])
649 if test -z "$HADDOCK"; then
650   AC_MSG_WARN(m4_normalize([haddock not found, htools API documentation will
651                             not be generated]))
652 fi
653 if test -n "$HADDOCK" && test -n "$HSCOLOUR"; then
654   HS_APIDOC=yes
655 fi
656 AC_SUBST(HS_APIDOC)
657
658 # Check for hlint
659 AC_ARG_VAR(HLINT, [hlint path])
660 AC_PATH_PROG(HLINT, [hlint], [])
661 if test -z "$HLINT"; then
662   AC_MSG_WARN([hlint not found, checking code will not be possible])
663 fi
664
665 if test "$HTOOLS" != yes && test "$ENABLE_CONFD" = True; then
666   AC_MSG_ERROR(m4_normalize([cannot enable ganeti-confd if
667                              htools support is not enabled]))
668 fi
669
670 AM_CONDITIONAL([WANT_HTOOLS], [test "$HTOOLS" = yes])
671 AM_CONDITIONAL([WANT_HSTESTS], [test "x$HS_NODEV" = x])
672 AM_CONDITIONAL([WANT_HSAPIDOC], [test "$HS_APIDOC" = yes])
673 AM_CONDITIONAL([HAS_HLINT], [test "$HLINT"])
674
675 # Check for fakeroot
676 AC_ARG_VAR(FAKEROOT_PATH, [fakeroot path])
677 AC_PATH_PROG(FAKEROOT_PATH, [fakeroot], [])
678 if test -z "$FAKEROOT_PATH"; then
679   AC_MSG_WARN(m4_normalize([fakeroot not found, tests that must run as root
680                             will not be executed]))
681 fi
682 AM_CONDITIONAL([HAS_FAKEROOT], [test "x$FAKEROOT_PATH" != x])
683
684 SOCAT_USE_ESCAPE=
685 AC_ARG_ENABLE([socat-escape],
686   [AS_HELP_STRING([--enable-socat-escape],
687     [use escape functionality available in socat >= 1.7 (default: detect
688      automatically)])],
689   [[if test "$enableval" = yes; then
690       SOCAT_USE_ESCAPE=True
691     else
692       SOCAT_USE_ESCAPE=False
693     fi
694   ]])
695
696 if test -z "$SOCAT_USE_ESCAPE"
697 then
698   if $SOCAT -hh | grep -w -q escape; then
699     SOCAT_USE_ESCAPE=True
700   else
701     SOCAT_USE_ESCAPE=False
702   fi
703 fi
704
705 AC_SUBST(SOCAT_USE_ESCAPE)
706
707 SOCAT_USE_COMPRESS=
708 AC_ARG_ENABLE([socat-compress],
709   [AS_HELP_STRING([--enable-socat-compress],
710     [use OpenSSL compression option available in patched socat builds
711      (see INSTALL for details; default: detect automatically)])],
712   [[if test "$enableval" = yes; then
713       SOCAT_USE_COMPRESS=True
714     else
715       SOCAT_USE_COMPRESS=False
716     fi
717   ]])
718
719 if test -z "$SOCAT_USE_COMPRESS"
720 then
721   if $SOCAT -hhh | grep -w -q openssl-compress; then
722     SOCAT_USE_COMPRESS=True
723   else
724     SOCAT_USE_COMPRESS=False
725   fi
726 fi
727
728 AC_SUBST(SOCAT_USE_COMPRESS)
729
730 if man --help | grep -q -e --warnings
731 then
732   MAN_HAS_WARNINGS=1
733 else
734   MAN_HAS_WARNINGS=
735   AC_MSG_WARN(m4_normalize([man does not support --warnings, man page checks
736                             will not be possible]))
737 fi
738
739 AC_SUBST(MAN_HAS_WARNINGS)
740
741 # Check for Python
742 AM_PATH_PYTHON(2.6)
743
744 AC_PYTHON_MODULE(OpenSSL, t)
745 AC_PYTHON_MODULE(simplejson, t)
746 AC_PYTHON_MODULE(pyparsing, t)
747 AC_PYTHON_MODULE(pyinotify, t)
748 AC_PYTHON_MODULE(pycurl, t)
749 AC_PYTHON_MODULE(bitarray, t)
750 AC_PYTHON_MODULE(ipaddr, t)
751 AC_PYTHON_MODULE(mock)
752 AC_PYTHON_MODULE(affinity)
753 AC_PYTHON_MODULE(paramiko)
754
755 # Development-only Python modules
756 PY_NODEV=
757 AC_PYTHON_MODULE(yaml)
758 if test $HAVE_PYMOD_YAML == "no"; then
759   PY_NODEV="$PY_NODEV yaml"
760 fi
761
762 if test -n "$PY_NODEV"; then
763   AC_MSG_WARN(m4_normalize([Required development modules ($PY_NODEV) were not
764                             found, you won't be able to run Python unittests]))
765 else
766   AC_MSG_NOTICE([Python development modules found, unittests enabled])
767 fi
768 AC_SUBST(PY_NODEV)
769 AM_CONDITIONAL([PY_UNIT], [test -n $PY_NODEV])
770
771 AC_CONFIG_FILES([ Makefile ])
772
773 AC_OUTPUT