Bump version suffix to 2.16.0 beta2
[ganeti-github.git] / configure.ac
1 # Configure script for Ganeti
2 m4_define([gnt_version_major], [2])
3 m4_define([gnt_version_minor], [16])
4 m4_define([gnt_version_revision], [0])
5 m4_define([gnt_version_suffix], [~beta2])
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-default-vg=...
223 AC_ARG_WITH([default-vg],
224   [AS_HELP_STRING([--with-default-vg=VOLUMEGROUP],
225     [default volume group (default is xenvg)]
226   )],
227   [default_vg="$withval"],
228   [default_vg="xenvg"])
229 AC_SUBST(DEFAULT_VG, $default_vg)
230
231 # --with-default-bridge=...
232 AC_ARG_WITH([default-bridge],
233   [AS_HELP_STRING([--with-default-bridge=BRIDGE],
234     [default bridge (default is xen-br0)]
235   )],
236   [default_bridge="$withval"],
237   [default_bridge="xen-br0"])
238 AC_SUBST(DEFAULT_BRIDGE, $default_bridge)
239
240 # --with-xen-bootloader=...
241 AC_ARG_WITH([xen-bootloader],
242   [AS_HELP_STRING([--with-xen-bootloader=PATH],
243     [bootloader for Xen hypervisor (default is empty)]
244   )],
245   [xen_bootloader="$withval"],
246   [xen_bootloader=])
247 AC_SUBST(XEN_BOOTLOADER, $xen_bootloader)
248
249 # --with-xen-kernel=...
250 AC_ARG_WITH([xen-kernel],
251   [AS_HELP_STRING([--with-xen-kernel=PATH],
252     [DomU kernel image for Xen hypervisor (default is /boot/vmlinuz-3-xenU)]
253   )],
254   [xen_kernel="$withval"],
255   [xen_kernel="/boot/vmlinuz-3-xenU"])
256 AC_SUBST(XEN_KERNEL, $xen_kernel)
257
258 # --with-xen-initrd=...
259 AC_ARG_WITH([xen-initrd],
260   [AS_HELP_STRING([--with-xen-initrd=PATH],
261     [DomU initrd image for Xen hypervisor (default is /boot/initrd-3-xenU)]
262   )],
263   [xen_initrd="$withval"],
264   [xen_initrd="/boot/initrd-3-xenU"])
265 AC_SUBST(XEN_INITRD, $xen_initrd)
266
267 # --with-kvm-kernel=...
268 AC_ARG_WITH([kvm-kernel],
269   [AS_HELP_STRING([--with-kvm-kernel=PATH],
270     [Guest kernel image for KVM hypervisor (default is /boot/vmlinuz-3-kvmU)]
271   )],
272   [kvm_kernel="$withval"],
273   [kvm_kernel="/boot/vmlinuz-3-kvmU"])
274 AC_SUBST(KVM_KERNEL, $kvm_kernel)
275
276 # --with-kvm-path=...
277 AC_ARG_WITH([kvm-path],
278   [AS_HELP_STRING([--with-kvm-path=PATH],
279     [absolute path to the kvm binary]
280     [ (default is /usr/bin/kvm)]
281   )],
282   [kvm_path="$withval"],
283   [kvm_path="/usr/bin/kvm"])
284 AC_SUBST(KVM_PATH, $kvm_path)
285
286 # --with-lvm-stripecount=...
287 AC_ARG_WITH([lvm-stripecount],
288   [AS_HELP_STRING([--with-lvm-stripecount=NUM],
289     [the default number of stripes to use for LVM volumes]
290     [ (default is 1)]
291   )],
292   [lvm_stripecount="$withval"],
293   [lvm_stripecount=1])
294 AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount)
295
296 # --with-ssh-login-user=...
297 AC_ARG_WITH([ssh-login-user],
298   [AS_HELP_STRING([--with-ssh-login-user=USERNAME],
299     [user to use for SSH logins within the cluster (default is root)]
300   )],
301   [ssh_login_user="$withval"],
302   [ssh_login_user=root])
303 AC_SUBST(SSH_LOGIN_USER, $ssh_login_user)
304
305 # --with-ssh-console-user=...
306 AC_ARG_WITH([ssh-console-user],
307   [AS_HELP_STRING([--with-ssh-console-user=USERNAME],
308     [user to use for SSH logins to access instance consoles (default is root)]
309   )],
310   [ssh_console_user="$withval"],
311   [ssh_console_user=root])
312 AC_SUBST(SSH_CONSOLE_USER, $ssh_console_user)
313
314 # --with-default-user=...
315 AC_ARG_WITH([default-user],
316   [AS_HELP_STRING([--with-default-user=USERNAME],
317     [default user for daemons]
318     [ (default is to run all daemons as root)]
319   )],
320   [user_default="$withval"],
321   [user_default=root])
322
323 # --with-default-group=...
324 AC_ARG_WITH([default-group],
325   [AS_HELP_STRING([--with-default-group=GROUPNAME],
326     [default group for daemons]
327     [ (default is to run all daemons under group root)]
328   )],
329   [group_default="$withval"],
330   [group_default=root])
331
332 # --with-user-prefix=...
333 AC_ARG_WITH([user-prefix],
334   [AS_HELP_STRING([--with-user-prefix=PREFIX],
335     [prefix for daemon users]
336     [ (default is to run all daemons as root; use --with-default-user]
337     [ to change the default)]
338   )],
339   [user_masterd="${withval}masterd";
340    user_metad="${withval}metad";
341    user_rapi="${withval}rapi";
342    user_confd="${withval}confd";
343    user_wconfd="${withval}masterd";
344    user_kvmd="$user_default";
345    user_luxid="${withval}masterd";
346    user_noded="$user_default";
347    user_mond="$user_default"],
348   [user_masterd="$user_default";
349    user_metad="$user_default";
350    user_rapi="$user_default";
351    user_confd="$user_default";
352    user_wconfd="$user_default";
353    user_kvmd="$user_default";
354    user_luxid="$user_default";
355    user_noded="$user_default";
356    user_mond="$user_default"])
357 AC_SUBST(MASTERD_USER, $user_masterd)
358 AC_SUBST(METAD_USER, $user_metad)
359 AC_SUBST(RAPI_USER, $user_rapi)
360 AC_SUBST(CONFD_USER, $user_confd)
361 AC_SUBST(WCONFD_USER, $user_wconfd)
362 AC_SUBST(KVMD_USER, $user_kvmd)
363 AC_SUBST(LUXID_USER, $user_luxid)
364 AC_SUBST(NODED_USER, $user_noded)
365 AC_SUBST(MOND_USER, $user_mond)
366 AC_SUBST(METAD_USER, $user_metad)
367
368 # --with-group-prefix=...
369 AC_ARG_WITH([group-prefix],
370   [AS_HELP_STRING([--with-group-prefix=PREFIX],
371     [prefix for daemon POSIX groups]
372     [ (default is to run all daemons under group root; use]
373     [ --with-default-group to change the default)]
374   )],
375   [group_rapi="${withval}rapi";
376    group_admin="${withval}admin";
377    group_confd="${withval}confd";
378    group_wconfd="${withval}masterd";
379    group_kvmd="$group_default";
380    group_luxid="${withval}luxid";
381    group_masterd="${withval}masterd";
382    group_metad="${withval}metad";
383    group_noded="$group_default";
384    group_daemons="${withval}daemons";
385    group_mond="$group_default"],
386   [group_rapi="$group_default";
387    group_admin="$group_default";
388    group_confd="$group_default";
389    group_wconfd="$group_default";
390    group_kvmd="$group_default";
391    group_luxid="$group_default";
392    group_masterd="$group_default";
393    group_metad="$group_default";
394    group_noded="$group_default";
395    group_daemons="$group_default";
396    group_mond="$group_default"])
397 AC_SUBST(RAPI_GROUP, $group_rapi)
398 AC_SUBST(ADMIN_GROUP, $group_admin)
399 AC_SUBST(CONFD_GROUP, $group_confd)
400 AC_SUBST(WCONFD_GROUP, $group_wconfd)
401 AC_SUBST(KVMD_GROUP, $group_kvmd)
402 AC_SUBST(LUXID_GROUP, $group_luxid)
403 AC_SUBST(MASTERD_GROUP, $group_masterd)
404 AC_SUBST(METAD_GROUP, $group_metad)
405 AC_SUBST(NODED_GROUP, $group_noded)
406 AC_SUBST(DAEMONS_GROUP, $group_daemons)
407 AC_SUBST(MOND_GROUP, $group_mond)
408 AC_SUBST(METAD_GROUP, $group_metad)
409
410 # Print the config to the user
411 AC_MSG_NOTICE([Running ganeti-masterd as $group_masterd:$group_masterd])
412 AC_MSG_NOTICE([Running ganeti-metad as $group_metad:$group_metad])
413 AC_MSG_NOTICE([Running ganeti-rapi as $user_rapi:$group_rapi])
414 AC_MSG_NOTICE([Running ganeti-confd as $user_confd:$group_confd])
415 AC_MSG_NOTICE([Running ganeti-wconfd as $user_wconfd:$group_wconfd])
416 AC_MSG_NOTICE([Running ganeti-luxid as $user_luxid:$group_luxid])
417 AC_MSG_NOTICE([Group for daemons is $group_daemons])
418 AC_MSG_NOTICE([Group for clients is $group_admin])
419
420 # --enable-drbd-barriers
421 AC_ARG_ENABLE([drbd-barriers],
422   [AS_HELP_STRING([--enable-drbd-barriers],
423                   m4_normalize([enable the DRBD barriers functionality by
424                                 default (>= 8.0.12) (default: enabled)]))],
425   [[if test "$enableval" != no; then
426       DRBD_BARRIERS=n
427       DRBD_NO_META_FLUSH=False
428     else
429       DRBD_BARRIERS=bf
430       DRBD_NO_META_FLUSH=True
431     fi
432   ]],
433   [DRBD_BARRIERS=n
434    DRBD_NO_META_FLUSH=False
435   ])
436 AC_SUBST(DRBD_BARRIERS, $DRBD_BARRIERS)
437 AC_SUBST(DRBD_NO_META_FLUSH, $DRBD_NO_META_FLUSH)
438
439 # --enable-syslog[=no/yes/only]
440 AC_ARG_ENABLE([syslog],
441   [AS_HELP_STRING([--enable-syslog],
442     [enable use of syslog (default: disabled), one of no/yes/only])],
443   [[case "$enableval" in
444       no)
445         SYSLOG=no
446         ;;
447       yes)
448         SYSLOG=yes
449         ;;
450       only)
451         SYSLOG=only
452         ;;
453       *)
454         SYSLOG=
455         ;;
456     esac
457   ]],
458   [SYSLOG=no])
459
460 if test -z "$SYSLOG"
461 then
462   AC_MSG_ERROR([invalid value for syslog, choose one of no/yes/only])
463 fi
464 AC_SUBST(SYSLOG_USAGE, $SYSLOG)
465
466 # --enable-restricted-commands[=no/yes]
467 AC_ARG_ENABLE([restricted-commands],
468   [AS_HELP_STRING([--enable-restricted-commands],
469                   m4_normalize([enable restricted commands in the node daemon
470                                 (default: disabled)]))],
471   [[if test "$enableval" = no; then
472       enable_restricted_commands=False
473     else
474       enable_restricted_commands=True
475     fi
476   ]],
477   [enable_restricted_commands=False])
478 AC_SUBST(ENABLE_RESTRICTED_COMMANDS, $enable_restricted_commands)
479
480 # --with-disk-separator=...
481 AC_ARG_WITH([disk-separator],
482   [AS_HELP_STRING([--with-disk-separator=STRING],
483     [Disk index separator, useful if the default of ':' is handled]
484     [ specially by the hypervisor]
485   )],
486   [disk_separator="$withval"],
487   [disk_separator=":"])
488 AC_SUBST(DISK_SEPARATOR, $disk_separator)
489
490 # Check common programs
491 AC_PROG_INSTALL
492 AC_PROG_LN_S
493
494 # check if ln is the GNU version of ln (and hence supports -T)
495 if ln --version 2> /dev/null | head -1 | grep -q GNU
496 then
497   AC_SUBST(HAS_GNU_LN, True)
498 else
499   AC_SUBST(HAS_GNU_LN, False)
500 fi
501
502 # Check for the ip command
503 AC_ARG_VAR(IP_PATH, [ip path])
504 AC_PATH_PROG(IP_PATH, [ip], [])
505 if test -z "$IP_PATH"
506 then
507   AC_MSG_ERROR([ip command not found])
508 fi
509
510 # Check for pandoc
511 AC_ARG_VAR(PANDOC, [pandoc path])
512 AC_PATH_PROG(PANDOC, [pandoc], [])
513 if test -z "$PANDOC"
514 then
515   AC_MSG_WARN([pandoc not found, man pages rebuild will not be possible])
516 fi
517
518 # Check for python-sphinx
519 AC_ARG_VAR(SPHINX, [sphinx-build path])
520 AC_PATH_PROG(SPHINX, [sphinx-build], [])
521 if test -z "$SPHINX"
522 then
523   AC_MSG_WARN(m4_normalize([sphinx-build not found, documentation rebuild will
524                             not be possible]))
525 else
526   # Sphinx exits with code 1 when it prints its usage
527   sphinxver=`{ $SPHINX --version 2>&1 || :; } | head -n 3`
528
529   if ! echo "$sphinxver" | grep -q -w -e '^Sphinx' -e '^Usage:'; then
530     AC_MSG_ERROR([Unable to determine Sphinx version])
531
532   # Note: Character classes ([...]) need to be double quoted due to autoconf
533   # using m4
534   elif ! echo "$sphinxver" | grep -q -E \
535        '^Sphinx([[[:space:]]]+|\(sphinx-build[[1-9]]?\)|v)*[[1-9]]\>'; then
536     AC_MSG_ERROR([Sphinx 1.0 or higher is required])
537   fi
538 fi
539 AM_CONDITIONAL([HAS_SPHINX], [test -n "$SPHINX"])
540 AM_CONDITIONAL([HAS_SPHINX_PRE13],
541  [test -n "$SPHINX" && echo "$sphinxver" | grep -q -E \
542   '^Sphinx([[[:space:]]]+|\(sphinx-build[[1-9]]?\)|v)*[[1-9]]\.[[0-2]]\.'])
543
544 AC_ARG_ENABLE([manpages-in-doc],
545   [AS_HELP_STRING([--enable-manpages-in-doc],
546                   m4_normalize([include man pages in HTML documentation
547                                 (requires sphinx; default disabled)]))],
548   [case "$enableval" in
549       yes) manpages_in_doc=yes ;;
550       no) manpages_in_doc= ;;
551       *)
552         AC_MSG_ERROR([Bad value $enableval for --enable-manpages-in-doc])
553         ;;
554     esac
555   ],
556   [manpages_in_doc=])
557 AM_CONDITIONAL([MANPAGES_IN_DOC], [test -n "$manpages_in_doc"])
558 AC_SUBST(MANPAGES_IN_DOC, $manpages_in_doc)
559
560 if test -z "$SPHINX" -a -n "$manpages_in_doc"; then
561   AC_MSG_ERROR([Including man pages in HTML documentation requires sphinx])
562 fi
563
564 # Check for graphviz (dot)
565 AC_ARG_VAR(DOT, [dot path])
566 AC_PATH_PROG(DOT, [dot], [])
567 if test -z "$DOT"
568 then
569   AC_MSG_WARN(m4_normalize([dot (from the graphviz suite) not found,
570                             documentation rebuild not possible]))
571 fi
572
573 # Check for pylint
574 AC_ARG_VAR(PYLINT, [pylint path])
575 AC_PATH_PROG(PYLINT, [pylint], [])
576 if test -z "$PYLINT"
577 then
578   AC_MSG_WARN([pylint not found, checking code will not be possible])
579 fi
580
581 # Check for pep8
582 AC_ARG_VAR(PEP8, [pep8 path])
583 AC_PATH_PROG(PEP8, [pep8], [])
584 if test -z "$PEP8"
585 then
586   AC_MSG_WARN([pep8 not found, checking code will not be complete])
587 fi
588 AM_CONDITIONAL([HAS_PEP8], [test -n "$PEP8"])
589
590 # Check for python-coverage
591 AC_ARG_VAR(PYCOVERAGE, [python-coverage path])
592 AC_PATH_PROGS(PYCOVERAGE, [python-coverage coverage], [])
593 if test -z "$PYCOVERAGE"
594 then
595   AC_MSG_WARN(m4_normalize([python-coverage or coverage not found, evaluating
596                             Python test coverage will not be possible]))
597 fi
598
599 # Check for socat
600 AC_ARG_VAR(SOCAT, [socat path])
601 AC_PATH_PROG(SOCAT, [socat], [])
602 if test -z "$SOCAT"
603 then
604   AC_MSG_ERROR([socat not found])
605 fi
606
607 # Check for qemu-img
608 AC_ARG_VAR(QEMUIMG_PATH, [qemu-img path])
609 AC_PATH_PROG(QEMUIMG_PATH, [qemu-img], [])
610 if test -z "$QEMUIMG_PATH"
611 then
612   AC_MSG_WARN([qemu-img not found, using ovfconverter will not be possible])
613 fi
614
615 ENABLE_MOND=
616 AC_ARG_ENABLE([monitoring],
617   [AS_HELP_STRING([--enable-monitoring],
618   [enable the ganeti monitoring daemon (default: check)])],
619   [],
620   [enable_monitoring=check])
621
622 # --enable-metadata
623 ENABLE_METADATA=
624 AC_ARG_ENABLE([metadata],
625   [AS_HELP_STRING([--enable-metadata],
626   [enable the ganeti metadata daemon (default: check)])],
627   [],
628   [enable_metadata=check])
629
630 # Check for ghc
631 AC_ARG_VAR(GHC, [ghc path])
632 AC_PATH_PROG(GHC, [ghc], [])
633 if test -z "$GHC"; then
634   AC_MSG_FAILURE([ghc not found, compilation will not possible])
635 fi
636
637 # Note: Character classes ([...]) need to be double quoted due to autoconf
638 # using m4
639 AM_CONDITIONAL([GHC_LE_76], [$GHC --numeric-version | grep -q '^7\.[[0-6]]\.'])
640
641 AC_MSG_CHECKING([checking for extra GHC flags])
642 GHC_BYVERSION_FLAGS=
643 # check for GHC supported flags that vary accross versions
644 for flag in -fwarn-incomplete-uni-patterns; do
645   if $GHC -e '0' $flag >/dev/null 2>/dev/null; then
646    GHC_BYVERSION_FLAGS="$GHC_BYVERSION_FLAGS $flag"
647   fi
648 done
649 AC_MSG_RESULT($GHC_BYVERSION_FLAGS)
650 AC_SUBST(GHC_BYVERSION_FLAGS)
651
652 # Check for ghc-pkg
653 AC_ARG_VAR(GHC_PKG, [ghc-pkg path])
654 AC_PATH_PROG(GHC_PKG, [ghc-pkg], [])
655 if test -z "$GHC_PKG"; then
656   AC_MSG_FAILURE([ghc-pkg not found, compilation will not be possible])
657 fi
658
659 # Check for cabal
660 AC_ARG_VAR(CABAL, [cabal path])
661 AC_PATH_PROG(CABAL, [cabal], [])
662 if test -z "$CABAL"; then
663   AC_MSG_FAILURE([cabal not found, compilation will not be possible])
664 fi
665
666 # check for standard modules
667 AC_GHC_PKG_REQUIRE(Cabal)
668 AC_GHC_PKG_REQUIRE(curl)
669 AC_GHC_PKG_REQUIRE(json)
670 AC_GHC_PKG_REQUIRE(network)
671 AC_GHC_PKG_REQUIRE(mtl)
672 AC_GHC_PKG_REQUIRE(bytestring)
673 AC_GHC_PKG_REQUIRE(base64-bytestring-1.*, t)
674 AC_GHC_PKG_REQUIRE(utf8-string)
675 AC_GHC_PKG_REQUIRE(zlib)
676 AC_GHC_PKG_REQUIRE(hslogger)
677 AC_GHC_PKG_REQUIRE(process)
678 AC_GHC_PKG_REQUIRE(attoparsec)
679 AC_GHC_PKG_REQUIRE(vector)
680 AC_GHC_PKG_REQUIRE(text)
681 AC_GHC_PKG_REQUIRE(hinotify)
682 AC_GHC_PKG_REQUIRE(Crypto)
683 AC_GHC_PKG_REQUIRE(lifted-base)
684 AC_GHC_PKG_REQUIRE(lens)
685 AC_GHC_PKG_REQUIRE(regex-pcre)
686
687 #extra modules for monitoring daemon functionality; also needed for tests
688 MONITORING_PKG=
689 AC_GHC_PKG_CHECK([snap-server], [],
690                  [NS_NODEV=1; MONITORING_PKG="$MONITORING_PKG snap-server"])
691 AC_GHC_PKG_CHECK([PSQueue], [],
692                  [NS_NODEV=1; MONITORING_PKG="$MONITORING_PKG PSQueue"])
693
694 has_monitoring=False
695 if test "$enable_monitoring" != no; then
696   MONITORING_DEP=
697   has_monitoring_pkg=False
698   if test -z "$MONITORING_PKG"; then
699     has_monitoring_pkg=True
700   elif test "$enable_monitoring" = check; then
701     AC_MSG_WARN(m4_normalize([The required extra libraries for the monitoring
702                               daemon were not found ($MONITORING_PKG),
703                               monitoring disabled]))
704   else
705     AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
706                                  required libraries were not found:
707                                  $MONITORING_PKG]))
708   fi
709   has_monitoring_dep=False
710   if test -z "$MONITORING_DEP"; then
711     has_monitoring_dep=True
712   elif test "$enable_monitoring" = check; then
713     AC_MSG_WARN(m4_normalize([The optional Ganeti components required for the
714                               monitoring agent were not enabled
715                               ($MONITORING_DEP), monitoring disabled]))
716   else
717     AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
718                                  required optional Ganeti components were not
719                                  found: $MONITORING_DEP]))
720   fi
721
722 fi
723 if test "$has_monitoring_pkg" = True -a "$has_monitoring_dep" = True; then
724   has_monitoring=True
725   AC_MSG_NOTICE([Enabling the monitoring agent usage])
726 fi
727 AC_SUBST(ENABLE_MOND, $has_monitoring)
728 AM_CONDITIONAL([ENABLE_MOND], [test "$has_monitoring" = True])
729
730 # extra modules for metad functionality; also needed for tests
731 METAD_PKG=
732 AC_GHC_PKG_CHECK([snap-server], [],
733                  [NS_NODEV=1; METAD_PKG="$METAD_PKG snap-server"])
734 has_metad=False
735 if test "$enable_metadata" != no; then
736   if test -z "$METAD_PKG"; then
737     has_metad=True
738   elif test "$enable_metadata" = check; then
739     AC_MSG_WARN(m4_normalize([The required extra libraries for metad were
740                               not found ($METAD_PKG), metad disabled]))
741   else
742     AC_MSG_FAILURE(m4_normalize([The metadata functionality was requested, but
743                                  required libraries were not found:
744                                  $METAD_PKG]))
745   fi
746 fi
747 if test "$has_metad" = True; then
748   AC_MSG_NOTICE([Enabling metadata usage])
749 fi
750 AC_SUBST(ENABLE_METADATA, $has_metad)
751 AM_CONDITIONAL([ENABLE_METADATA], [test x$has_metad = xTrue])
752
753
754 # development modules
755 AC_GHC_PKG_CHECK([QuickCheck-2.*], [], [HS_NODEV=1], t)
756 AC_GHC_PKG_CHECK([test-framework-0.6*], [], [
757   AC_GHC_PKG_CHECK([test-framework-0.7*], [], [
758     AC_GHC_PKG_CHECK([test-framework-0.8*], [], [HS_NODEV=1], t)
759   ], t)
760 ], t)
761 AC_GHC_PKG_CHECK([test-framework-hunit], [], [HS_NODEV=1])
762 AC_GHC_PKG_CHECK([test-framework-quickcheck2], [], [HS_NODEV=1])
763 AC_GHC_PKG_CHECK([temporary], [], [HS_NODEV=1])
764 if test -n "$HS_NODEV"; then
765    AC_MSG_WARN(m4_normalize([Required development modules were not found,
766                              you won't be able to run Haskell unittests]))
767 else
768    AC_MSG_NOTICE([Haskell development modules found, unittests enabled])
769 fi
770 AC_SUBST(HS_NODEV)
771 AM_CONDITIONAL([HS_UNIT], [test -n $HS_NODEV])
772
773 # Check for HsColour
774 HS_APIDOC=no
775 AC_ARG_VAR(HSCOLOUR, [HsColour path])
776 AC_PATH_PROG(HSCOLOUR, [HsColour], [])
777 if test -z "$HSCOLOUR"; then
778   AC_MSG_WARN(m4_normalize([HsColour not found, htools API documentation will
779                             not be generated]))
780 fi
781
782 # Check for haddock
783 AC_ARG_VAR(HADDOCK, [haddock path])
784 AC_PATH_PROG(HADDOCK, [haddock], [])
785 if test -z "$HADDOCK"; then
786   AC_MSG_WARN(m4_normalize([haddock not found, htools API documentation will
787                             not be generated]))
788 fi
789 if test -n "$HADDOCK" && test -n "$HSCOLOUR"; then
790   HS_APIDOC=yes
791 fi
792 AC_SUBST(HS_APIDOC)
793
794 # Check for hlint
795 AC_ARG_VAR(HLINT, [hlint path])
796 AC_PATH_PROG(HLINT, [hlint], [])
797 if test -z "$HLINT"; then
798   AC_MSG_WARN([hlint not found, checking code will not be possible])
799 fi
800
801 AM_CONDITIONAL([WANT_HSTESTS], [test "x$HS_NODEV" = x])
802 AM_CONDITIONAL([WANT_HSAPIDOC], [test "$HS_APIDOC" = yes])
803 AM_CONDITIONAL([HAS_HLINT], [test "$HLINT"])
804
805 # Check for fakeroot
806 AC_ARG_VAR(FAKEROOT_PATH, [fakeroot path])
807 AC_PATH_PROG(FAKEROOT_PATH, [fakeroot], [])
808 if test -z "$FAKEROOT_PATH"; then
809   AC_MSG_WARN(m4_normalize([fakeroot not found, tests that must run as root
810                             will not be executed]))
811 fi
812 AM_CONDITIONAL([HAS_FAKEROOT], [test "x$FAKEROOT_PATH" != x])
813
814 SOCAT_USE_ESCAPE=
815 AC_ARG_ENABLE([socat-escape],
816   [AS_HELP_STRING([--enable-socat-escape],
817     [use escape functionality available in socat >= 1.7 (default: detect
818      automatically)])],
819   [[if test "$enableval" = yes; then
820       SOCAT_USE_ESCAPE=True
821     else
822       SOCAT_USE_ESCAPE=False
823     fi
824   ]])
825
826 if test -z "$SOCAT_USE_ESCAPE"
827 then
828   if $SOCAT -hh | grep -w -q escape; then
829     SOCAT_USE_ESCAPE=True
830   else
831     SOCAT_USE_ESCAPE=False
832   fi
833 fi
834
835 AC_SUBST(SOCAT_USE_ESCAPE)
836
837 SOCAT_USE_COMPRESS=
838 AC_ARG_ENABLE([socat-compress],
839   [AS_HELP_STRING([--enable-socat-compress],
840     [use OpenSSL compression option available in patched socat builds
841      (see INSTALL for details; default: detect automatically)])],
842   [[if test "$enableval" = yes; then
843       SOCAT_USE_COMPRESS=True
844     else
845       SOCAT_USE_COMPRESS=False
846     fi
847   ]])
848
849 if test -z "$SOCAT_USE_COMPRESS"
850 then
851   if $SOCAT -hhh | grep -w -q openssl-compress; then
852     SOCAT_USE_COMPRESS=True
853   else
854     SOCAT_USE_COMPRESS=False
855   fi
856 fi
857
858 AC_SUBST(SOCAT_USE_COMPRESS)
859
860 if man --help | grep -q -e --warnings
861 then
862   MAN_HAS_WARNINGS=1
863 else
864   MAN_HAS_WARNINGS=
865   AC_MSG_WARN(m4_normalize([man does not support --warnings, man page checks
866                             will not be possible]))
867 fi
868
869 AC_SUBST(MAN_HAS_WARNINGS)
870
871 # Check for Python
872 # We need a Python-2 interpreter, version at least 2.6. As AM_PATH_PYTHON
873 # only supports a "minimal version" constraint, we check <3.0 afterwards.
874 # We  tune _AM_PYTHON_INTERPRETER_LIST to first check interpreters that are
875 # likely interpreters for Python 2.
876 m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
877                   [python2 python2.7 python2.6 python])
878 AM_PATH_PYTHON(2.6)
879 if $PYTHON -c "import sys
880 if (sys.hexversion >> 24) < 3:
881   sys.exit(1)
882 else:
883   sys.exit(0)
884 "; then
885   AC_MSG_FAILURE([Can only work with an interpreter for Python 2])
886 fi
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