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