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