Statistics
| Branch: | Tag: | Revision:

root / configure.ac @ f1b816b7

History | View | Annotate | Download (24.3 kB)

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-versionfull
24
AC_ARG_ENABLE([versionfull],
25
  [AS_HELP_STRING([--enable-versionfull],
26
                  m4_normalize([use the full version string rather
27
                  than major.minor for version directories]))],
28
  [[if test "$enableval" != no; then
29
      USE_VERSION_FULL=yes
30
    else
31
      USER_VERSION_FULL=no
32
    fi
33
  ]],
34
  [USE_VERSION_FULL=no
35
  ])
36
AC_SUBST(USE_VERSION_FULL, $USE_VERSION_FULL)
37
AM_CONDITIONAL([USE_VERSION_FULL], [test "$USE_VERSION_FULL" = yes])
38

    
39
# --enable-symlinks
40
AC_ARG_ENABLE([symlinks],
41
  [AS_HELP_STRING([--enable-symlinks],
42
                  m4_normalize([also install version-dependent symlinks under
43
                  $sysconfdir (default: enabled)]))],
44
  [[if test "$enableval" != no; then
45
      INSTALL_SYMLINKS=yes
46
    else
47
      INSTALL_SYMLINKS=no
48
    fi
49
  ]],
50
  [INSTALL_SYMLINKS=yes
51
  ])
52
AC_SUBST(INSTALL_SYMLINKS, $INSTALL_SYMLINKS)
53
AM_CONDITIONAL([INSTALL_SYMLINKS], [test "$INSTALL_SYMLINKS" = yes])
54

    
55
# --with-ssh-initscript=...
56
AC_ARG_WITH([ssh-initscript],
57
  [AS_HELP_STRING([--with-ssh-initscript=SCRIPT],
58
    [SSH init script to use (default is /etc/init.d/ssh)]
59
  )],
60
  [ssh_initd_script="$withval"],
61
  [ssh_initd_script="/etc/init.d/ssh"])
62
AC_SUBST(SSH_INITD_SCRIPT, $ssh_initd_script)
63

    
64
# --with-export-dir=...
65
AC_ARG_WITH([export-dir],
66
  [AS_HELP_STRING([--with-export-dir=DIR],
67
    [directory to use by default for instance image]
68
    [ exports (default is /srv/ganeti/export)]
69
  )],
70
  [export_dir="$withval"],
71
  [export_dir="/srv/ganeti/export"])
72
AC_SUBST(EXPORT_DIR, $export_dir)
73

    
74
# --with-ssh-config-dir=...
75
AC_ARG_WITH([ssh-config-dir],
76
  [AS_HELP_STRING([--with-ssh-config-dir=DIR],
77
    [ directory with ssh host keys ]
78
    [ (default is /etc/ssh)]
79
  )],
80
  [ssh_config_dir="$withval"],
81
  [ssh_config_dir="/etc/ssh"])
82
AC_SUBST(SSH_CONFIG_DIR, $ssh_config_dir)
83

    
84
# --with-xen-config-dir=...
85
AC_ARG_WITH([xen-config-dir],
86
  [AS_HELP_STRING([--with-xen-config-dir=DIR],
87
                  m4_normalize([Xen configuration directory
88
                                (default: /etc/xen)]))],
89
  [xen_config_dir="$withval"],
90
  [xen_config_dir=/etc/xen])
91
AC_SUBST(XEN_CONFIG_DIR, $xen_config_dir)
92

    
93
# --with-os-search-path=...
94
AC_ARG_WITH([os-search-path],
95
  [AS_HELP_STRING([--with-os-search-path=LIST],
96
    [comma separated list of directories to]
97
    [ search for OS images (default is /srv/ganeti/os)]
98
  )],
99
  [os_search_path="$withval"],
100
  [os_search_path="/srv/ganeti/os"])
101
AC_SUBST(OS_SEARCH_PATH, $os_search_path)
102

    
103
# --with-extstorage-search-path=...
104
AC_ARG_WITH([extstorage-search-path],
105
  [AS_HELP_STRING([--with-extstorage-search-path=LIST],
106
    [comma separated list of directories to]
107
    [ search for External Storage Providers]
108
    [ (default is /srv/ganeti/extstorage)]
109
  )],
110
  [es_search_path="$withval"],
111
  [es_search_path="/srv/ganeti/extstorage"])
112
AC_SUBST(ES_SEARCH_PATH, $es_search_path)
113

    
114
# --with-iallocator-search-path=...
115
AC_ARG_WITH([iallocator-search-path],
116
  [AS_HELP_STRING([--with-iallocator-search-path=LIST],
117
    [comma separated list of directories to]
118
    [ search for instance allocators (default is $libdir/ganeti/iallocators)]
119
  )],
120
  [iallocator_search_path="$withval"],
121
  [iallocator_search_path="$libdir/$PACKAGE_NAME/iallocators"])
122
AC_SUBST(IALLOCATOR_SEARCH_PATH, $iallocator_search_path)
123

    
124
# --with-xen-bootloader=...
125
AC_ARG_WITH([xen-bootloader],
126
  [AS_HELP_STRING([--with-xen-bootloader=PATH],
127
    [bootloader for Xen hypervisor (default is empty)]
128
  )],
129
  [xen_bootloader="$withval"],
130
  [xen_bootloader=])
131
AC_SUBST(XEN_BOOTLOADER, $xen_bootloader)
132

    
133
# --with-xen-kernel=...
134
AC_ARG_WITH([xen-kernel],
135
  [AS_HELP_STRING([--with-xen-kernel=PATH],
136
    [DomU kernel image for Xen hypervisor (default is /boot/vmlinuz-3-xenU)]
137
  )],
138
  [xen_kernel="$withval"],
139
  [xen_kernel="/boot/vmlinuz-3-xenU"])
140
AC_SUBST(XEN_KERNEL, $xen_kernel)
141

    
142
# --with-xen-initrd=...
143
AC_ARG_WITH([xen-initrd],
144
  [AS_HELP_STRING([--with-xen-initrd=PATH],
145
    [DomU initrd image for Xen hypervisor (default is /boot/initrd-3-xenU)]
146
  )],
147
  [xen_initrd="$withval"],
148
  [xen_initrd="/boot/initrd-3-xenU"])
149
AC_SUBST(XEN_INITRD, $xen_initrd)
150

    
151
# --with-kvm-kernel=...
152
AC_ARG_WITH([kvm-kernel],
153
  [AS_HELP_STRING([--with-kvm-kernel=PATH],
154
    [Guest kernel image for KVM hypervisor (default is /boot/vmlinuz-3-kvmU)]
155
  )],
156
  [kvm_kernel="$withval"],
157
  [kvm_kernel="/boot/vmlinuz-3-kvmU"])
158
AC_SUBST(KVM_KERNEL, $kvm_kernel)
159

    
160
# --with-shared-file-storage-dir=...
161
AC_ARG_WITH([shared-file-storage-dir],
162
  [AS_HELP_STRING([--with-shared-file-storage-dir=PATH],
163
    [directory to store files for shared file-based backend]
164
    [ (default is /srv/ganeti/shared-file-storage)]
165
  )],
166
  [[shared_file_storage_dir="/srv/ganeti/shared-file-storage"]])
167
AC_SUBST(SHARED_FILE_STORAGE_DIR, $shared_file_storage_dir)
168

    
169
# --with-kvm-path=...
170
AC_ARG_WITH([kvm-path],
171
  [AS_HELP_STRING([--with-kvm-path=PATH],
172
    [absolute path to the kvm binary]
173
    [ (default is /usr/bin/kvm)]
174
  )],
175
  [kvm_path="$withval"],
176
  [kvm_path="/usr/bin/kvm"])
177
AC_SUBST(KVM_PATH, $kvm_path)
178

    
179
# --with-lvm-stripecount=...
180
AC_ARG_WITH([lvm-stripecount],
181
  [AS_HELP_STRING([--with-lvm-stripecount=NUM],
182
    [the default number of stripes to use for LVM volumes]
183
    [ (default is 1)]
184
  )],
185
  [lvm_stripecount="$withval"],
186
  [lvm_stripecount=1])
187
AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount)
188

    
189
# --with-ssh-login-user=...
190
AC_ARG_WITH([ssh-login-user],
191
  [AS_HELP_STRING([--with-ssh-login-user=USERNAME],
192
    [user to use for SSH logins within the cluster (default is root)]
193
  )],
194
  [ssh_login_user="$withval"],
195
  [ssh_login_user=root])
196
AC_SUBST(SSH_LOGIN_USER, $ssh_login_user)
197

    
198
# --with-ssh-console-user=...
199
AC_ARG_WITH([ssh-console-user],
200
  [AS_HELP_STRING([--with-ssh-console-user=USERNAME],
201
    [user to use for SSH logins to access instance consoles (default is root)]
202
  )],
203
  [ssh_console_user="$withval"],
204
  [ssh_console_user=root])
205
AC_SUBST(SSH_CONSOLE_USER, $ssh_console_user)
206

    
207
# --with-default-user=...
208
AC_ARG_WITH([default-user],
209
  [AS_HELP_STRING([--with-default-user=USERNAME],
210
    [default user for daemons]
211
    [ (default is to run all daemons as root)]
212
  )],
213
  [user_default="$withval"],
214
  [user_default=root])
215

    
216
# --with-default-group=...
217
AC_ARG_WITH([default-group],
218
  [AS_HELP_STRING([--with-default-group=GROUPNAME],
219
    [default group for daemons]
220
    [ (default is to run all daemons under group root)]
221
  )],
222
  [group_default="$withval"],
223
  [group_default=root])
224

    
225
# --with-user-prefix=...
226
AC_ARG_WITH([user-prefix],
227
  [AS_HELP_STRING([--with-user-prefix=PREFIX],
228
    [prefix for daemon users]
229
    [ (default is to run all daemons as root; use --with-default-user]
230
    [ to change the default)]
231
  )],
232
  [user_masterd="${withval}masterd";
233
   user_rapi="${withval}rapi";
234
   user_confd="${withval}confd";
235
   user_luxid="${withval}luxid";
236
   user_noded="$user_default";
237
   user_mond="$user_default"],
238
  [user_masterd="$user_default";
239
   user_rapi="$user_default";
240
   user_confd="$user_default";
241
   user_luxid="$user_default";
242
   user_noded="$user_default";
243
   user_mond="$user_default"])
244
AC_SUBST(MASTERD_USER, $user_masterd)
245
AC_SUBST(RAPI_USER, $user_rapi)
246
AC_SUBST(CONFD_USER, $user_confd)
247
AC_SUBST(LUXID_USER, $user_luxid)
248
AC_SUBST(NODED_USER, $user_noded)
249
AC_SUBST(MOND_USER, $user_mond)
250

    
251
# --with-group-prefix=...
252
AC_ARG_WITH([group-prefix],
253
  [AS_HELP_STRING([--with-group-prefix=PREFIX],
254
    [prefix for daemon POSIX groups]
255
    [ (default is to run all daemons under group root; use]
256
    [ --with-default-group to change the default)]
257
  )],
258
  [group_rapi="${withval}rapi";
259
   group_admin="${withval}admin";
260
   group_confd="${withval}confd";
261
   group_luxid="${withval}luxid";
262
   group_masterd="${withval}masterd";
263
   group_noded="$group_default";
264
   group_daemons="${withval}daemons";
265
   group_mond="$group_default"],
266
  [group_rapi="$group_default";
267
   group_admin="$group_default";
268
   group_confd="$group_default";
269
   group_luxid="$group_default";
270
   group_masterd="$group_default";
271
   group_noded="$group_default";
272
   group_daemons="$group_default";
273
   group_mond="$group_default"])
274
AC_SUBST(RAPI_GROUP, $group_rapi)
275
AC_SUBST(ADMIN_GROUP, $group_admin)
276
AC_SUBST(CONFD_GROUP, $group_confd)
277
AC_SUBST(LUXID_GROUP, $group_luxid)
278
AC_SUBST(MASTERD_GROUP, $group_masterd)
279
AC_SUBST(NODED_GROUP, $group_noded)
280
AC_SUBST(DAEMONS_GROUP, $group_daemons)
281
AC_SUBST(MOND_GROUP, $group_mond)
282

    
283
# Print the config to the user
284
AC_MSG_NOTICE([Running ganeti-masterd as $group_masterd:$group_masterd])
285
AC_MSG_NOTICE([Running ganeti-rapi as $user_rapi:$group_rapi])
286
AC_MSG_NOTICE([Running ganeti-confd as $user_confd:$group_confd])
287
AC_MSG_NOTICE([Running ganeti-luxid as $user_luxid:$group_luxid])
288
AC_MSG_NOTICE([Group for daemons is $group_daemons])
289
AC_MSG_NOTICE([Group for clients is $group_admin])
290

    
291
# --enable-drbd-barriers
292
AC_ARG_ENABLE([drbd-barriers],
293
  [AS_HELP_STRING([--enable-drbd-barriers],
294
                  m4_normalize([enable the DRBD barriers functionality by
295
                                default (>= 8.0.12) (default: enabled)]))],
296
  [[if test "$enableval" != no; then
297
      DRBD_BARRIERS=n
298
      DRBD_NO_META_FLUSH=False
299
    else
300
      DRBD_BARRIERS=bf
301
      DRBD_NO_META_FLUSH=True
302
    fi
303
  ]],
304
  [DRBD_BARRIERS=n
305
   DRBD_NO_META_FLUSH=False
306
  ])
307
AC_SUBST(DRBD_BARRIERS, $DRBD_BARRIERS)
308
AC_SUBST(DRBD_NO_META_FLUSH, $DRBD_NO_META_FLUSH)
309

    
310
# --enable-syslog[=no/yes/only]
311
AC_ARG_ENABLE([syslog],
312
  [AS_HELP_STRING([--enable-syslog],
313
    [enable use of syslog (default: disabled), one of no/yes/only])],
314
  [[case "$enableval" in
315
      no)
316
        SYSLOG=no
317
        ;;
318
      yes)
319
        SYSLOG=yes
320
        ;;
321
      only)
322
        SYSLOG=only
323
        ;;
324
      *)
325
        SYSLOG=
326
        ;;
327
    esac
328
  ]],
329
  [SYSLOG=no])
330

    
331
if test -z "$SYSLOG"
332
then
333
  AC_MSG_ERROR([invalid value for syslog, choose one of no/yes/only])
334
fi
335
AC_SUBST(SYSLOG_USAGE, $SYSLOG)
336

    
337
# --enable-restricted-commands[=no/yes]
338
AC_ARG_ENABLE([restricted-commands],
339
  [AS_HELP_STRING([--enable-restricted-commands],
340
                  m4_normalize([enable restricted commands in the node daemon
341
                                (default: disabled)]))],
342
  [[if test "$enableval" = no; then
343
      enable_restricted_commands=False
344
    else
345
      enable_restricted_commands=True
346
    fi
347
  ]],
348
  [enable_restricted_commands=False])
349
AC_SUBST(ENABLE_RESTRICTED_COMMANDS, $enable_restricted_commands)
350

    
351
# --with-disk-separator=...
352
AC_ARG_WITH([disk-separator],
353
  [AS_HELP_STRING([--with-disk-separator=STRING],
354
    [Disk index separator, useful if the default of ':' is handled]
355
    [ specially by the hypervisor]
356
  )],
357
  [disk_separator="$withval"],
358
  [disk_separator=":"])
359
AC_SUBST(DISK_SEPARATOR, $disk_separator)
360

    
361
# Check common programs
362
AC_PROG_INSTALL
363
AC_PROG_LN_S
364

    
365
# check if ln is the GNU version of ln (and hence supports -T)
366
if ln --version 2> /dev/null | head -1 | grep -q GNU
367
then
368
  AC_SUBST(HAS_GNU_LN, True)
369
else
370
  AC_SUBST(HAS_GNU_LN, False)
371
fi
372

    
373
# Check for the ip command
374
AC_ARG_VAR(IP_PATH, [ip path])
375
AC_PATH_PROG(IP_PATH, [ip], [])
376
if test -z "$IP_PATH"
377
then
378
  AC_MSG_ERROR([ip command not found])
379
fi
380

    
381
# Check for pandoc
382
AC_ARG_VAR(PANDOC, [pandoc path])
383
AC_PATH_PROG(PANDOC, [pandoc], [])
384
if test -z "$PANDOC"
385
then
386
  AC_MSG_WARN([pandoc not found, man pages rebuild will not be possible])
387
fi
388

    
389
# Check for python-sphinx
390
AC_ARG_VAR(SPHINX, [sphinx-build path])
391
AC_PATH_PROG(SPHINX, [sphinx-build], [])
392
if test -z "$SPHINX"
393
then
394
  AC_MSG_WARN(m4_normalize([sphinx-build not found, documentation rebuild will
395
                            not be possible]))
396
else
397
  # Sphinx exits with code 1 when it prints its usage
398
  sphinxver=`{ $SPHINX --version 2>&1 || :; } | head -n 3`
399

    
400
  if ! echo "$sphinxver" | grep -q -w -e '^Sphinx' -e '^Usage:'; then
401
    AC_MSG_ERROR([Unable to determine Sphinx version])
402

    
403
  # Note: Character classes ([...]) need to be double quoted due to autoconf
404
  # using m4
405
  elif ! echo "$sphinxver" | grep -q -E '^Sphinx[[[:space:]]]+v[[1-9]]\>'; then
406
    AC_MSG_ERROR([Sphinx 1.0 or higher is required])
407
  fi
408
fi
409
AM_CONDITIONAL([HAS_SPHINX], [test -n "$SPHINX"])
410

    
411
AC_ARG_ENABLE([manpages-in-doc],
412
  [AS_HELP_STRING([--enable-manpages-in-doc],
413
                  m4_normalize([include man pages in HTML documentation
414
                                (requires sphinx; default disabled)]))],
415
  [case "$enableval" in
416
      yes) manpages_in_doc=yes ;;
417
      no) manpages_in_doc= ;;
418
      *)
419
        AC_MSG_ERROR([Bad value $enableval for --enable-manpages-in-doc])
420
        ;;
421
    esac
422
  ],
423
  [manpages_in_doc=])
424
AM_CONDITIONAL([MANPAGES_IN_DOC], [test -n "$manpages_in_doc"])
425
AC_SUBST(MANPAGES_IN_DOC, $manpages_in_doc)
426

    
427
if test -z "$SPHINX" -a -n "$manpages_in_doc"; then
428
  AC_MSG_ERROR([Including man pages in HTML documentation requires sphinx])
429
fi
430

    
431
# Check for graphviz (dot)
432
AC_ARG_VAR(DOT, [dot path])
433
AC_PATH_PROG(DOT, [dot], [])
434
if test -z "$DOT"
435
then
436
  AC_MSG_WARN(m4_normalize([dot (from the graphviz suite) not found,
437
                            documentation rebuild not possible]))
438
fi
439

    
440
# Check for pylint
441
AC_ARG_VAR(PYLINT, [pylint path])
442
AC_PATH_PROG(PYLINT, [pylint], [])
443
if test -z "$PYLINT"
444
then
445
  AC_MSG_WARN([pylint not found, checking code will not be possible])
446
fi
447

    
448
# Check for pep8
449
AC_ARG_VAR(PEP8, [pep8 path])
450
AC_PATH_PROG(PEP8, [pep8], [])
451
if test -z "$PEP8"
452
then
453
  AC_MSG_WARN([pep8 not found, checking code will not be complete])
454
fi
455
AM_CONDITIONAL([HAS_PEP8], [test -n "$PEP8"])
456

    
457
# Check for python-coverage
458
AC_ARG_VAR(PYCOVERAGE, [python-coverage path])
459
AC_PATH_PROGS(PYCOVERAGE, [python-coverage coverage], [])
460
if test -z "$PYCOVERAGE"
461
then
462
  AC_MSG_WARN(m4_normalize([python-coverage or coverage not found, evaluating
463
                            Python test coverage will not be possible]))
464
fi
465

    
466
# Check for socat
467
AC_ARG_VAR(SOCAT, [socat path])
468
AC_PATH_PROG(SOCAT, [socat], [])
469
if test -z "$SOCAT"
470
then
471
  AC_MSG_ERROR([socat not found])
472
fi
473

    
474
# Check for qemu-img
475
AC_ARG_VAR(QEMUIMG_PATH, [qemu-img path])
476
AC_PATH_PROG(QEMUIMG_PATH, [qemu-img], [])
477
if test -z "$QEMUIMG_PATH"
478
then
479
  AC_MSG_WARN([qemu-img not found, using ovfconverter will not be possible])
480
fi
481

    
482
# --enable-confd
483
ENABLE_CONFD=
484
AC_ARG_ENABLE([confd],
485
  [AS_HELP_STRING([--enable-confd],
486
  [enable the ganeti-confd daemon (default: check)])],
487
  [],
488
  [enable_confd=check])
489

    
490
ENABLE_MOND=
491
AC_ARG_ENABLE([monitoring],
492
  [AS_HELP_STRING([--enable-monitoring],
493
  [enable the ganeti monitoring daemon (default: check)])],
494
  [],
495
  [enable_monitoring=check])
496

    
497
# Check for ghc
498
AC_ARG_VAR(GHC, [ghc path])
499
AC_PATH_PROG(GHC, [ghc], [])
500
if test -z "$GHC"; then
501
  AC_MSG_FAILURE([ghc not found, compilation will not possible])
502
fi
503

    
504
AC_MSG_CHECKING([checking for extra GHC flags])
505
GHC_BYVERSION_FLAGS=
506
# check for GHC supported flags that vary accross versions
507
for flag in -fwarn-incomplete-uni-patterns; do
508
  if $GHC -e '0' $flag >/dev/null 2>/dev/null; then
509
   GHC_BYVERSION_FLAGS="$GHC_BYVERSION_FLAGS $flag"
510
  fi
511
done
512
AC_MSG_RESULT($GHC_BYVERSION_FLAGS)
513
AC_SUBST(GHC_BYVERSION_FLAGS)
514

    
515
# Check for ghc-pkg
516
AC_ARG_VAR(GHC_PKG, [ghc-pkg path])
517
AC_PATH_PROG(GHC_PKG, [ghc-pkg], [])
518
if test -z "$GHC_PKG"; then
519
  AC_MSG_FAILURE([ghc-pkg not found, compilation will not be possible])
520
fi
521

    
522
# check for modules, first custom/special checks
523
AC_MSG_NOTICE([checking for required haskell modules])
524
HS_PARALLEL3=
525
AC_GHC_PKG_CHECK([parallel-3.*], [HS_PARALLEL3=-DPARALLEL3],
526
                 [AC_GHC_PKG_REQUIRE(parallel)], t)
527
AC_SUBST(HS_PARALLEL3)
528

    
529
# and now standard modules
530
AC_GHC_PKG_REQUIRE(curl)
531
AC_GHC_PKG_REQUIRE(json)
532
AC_GHC_PKG_REQUIRE(network)
533
AC_GHC_PKG_REQUIRE(mtl)
534
AC_GHC_PKG_REQUIRE(bytestring)
535
AC_GHC_PKG_REQUIRE(utf8-string)
536
AC_GHC_PKG_REQUIRE(hslogger)
537

    
538
# extra modules for confd functionality
539
HS_REGEX_PCRE=-DNO_REGEX_PCRE
540
has_confd=False
541
if test "$enable_confd" != no; then
542
  CONFD_PKG=
543
  AC_GHC_PKG_CHECK([regex-pcre], [HS_REGEX_PCRE=],
544
                   [CONFD_PKG="$CONFD_PKG regex-pcre"])
545
  AC_GHC_PKG_CHECK([Crypto], [], [CONFD_PKG="$CONFD_PKG Crypto"])
546
  AC_GHC_PKG_CHECK([text], [], [CONFD_PKG="$CONFD_PKG text"])
547
  AC_GHC_PKG_CHECK([hinotify], [], [CONFD_PKG="$CONFD_PKG hinotify"])
548
  AC_GHC_PKG_CHECK([vector], [], [CONFD_PKG="$CONFD_PKG vector"])
549
  if test -z "$CONFD_PKG"; then
550
    has_confd=True
551
  elif test "$enable_confd" = check; then
552
    AC_MSG_WARN(m4_normalize([The required extra libraries for confd were
553
                              not found ($CONFD_PKG), confd disabled]))
554
  else
555
    AC_MSG_FAILURE(m4_normalize([The confd functionality was requested, but
556
                                 required libraries were not found:
557
                                 $CONFD_PKG]))
558
  fi
559
fi
560
AC_SUBST(HS_REGEX_PCRE)
561
if test "$has_confd" = True; then
562
  AC_MSG_NOTICE([Enabling confd usage])
563
fi
564
AC_SUBST(ENABLE_CONFD, $has_confd)
565
AM_CONDITIONAL([ENABLE_CONFD], [test x$has_confd = xTrue])
566

    
567
#extra modules for monitoring daemon functionality
568
has_monitoring=False
569
if test "$enable_monitoring" != no; then
570
  MONITORING_PKG=
571
  AC_GHC_PKG_CHECK([attoparsec], [],
572
                   [MONITORING_PKG="$MONITORING_PKG attoparsec"])
573
  AC_GHC_PKG_CHECK([snap-server], [],
574
                   [MONITORING_PKG="$MONITORING_PKG snap-server"])
575
  AC_GHC_PKG_CHECK([process], [],
576
                   [MONITORING_PKG="$MONITORING_PKG process"])
577
  MONITORING_DEP=
578
  if test "$has_confd" = False; then
579
    MONITORING_DEP="$MONITORING_DEP confd"
580
  fi
581
  has_monitoring_pkg=False
582
  if test -z "$MONITORING_PKG"; then
583
    has_monitoring_pkg=True
584
  elif test "$enable_monitoring" = check; then
585
    AC_MSG_WARN(m4_normalize([The required extra libraries for the monitoring
586
                              daemon were not found ($MONITORING_PKG),
587
                              monitoring disabled]))
588
  else
589
    AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
590
                                 required libraries were not found:
591
                                 $MONITORING_PKG]))
592
  fi
593
  has_monitoring_dep=False
594
  if test -z "$MONITORING_DEP"; then
595
    has_monitoring_dep=True
596
  elif test "$enable_monitoring" = check; then
597
    AC_MSG_WARN(m4_normalize([The optional Ganeti components required for the
598
                              monitoring agent were not enabled
599
                              ($MONITORING_DEP), monitoring disabled]))
600
  else
601
    AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
602
                                 required optional Ganeti components were not
603
                                 found: $MONITORING_DEP]))
604
  fi
605

    
606
fi
607
if test "$has_monitoring_pkg" = True -a "$has_monitoring_dep" = True; then
608
  has_monitoring=True
609
  AC_MSG_NOTICE([Enabling the monitoring agent usage])
610
fi
611
AC_SUBST(ENABLE_MOND, $has_monitoring)
612
AM_CONDITIONAL([ENABLE_MOND], [test "$has_monitoring" = True])
613

    
614
# development modules
615
HS_NODEV=
616
AC_GHC_PKG_CHECK([QuickCheck-2.*], [], [HS_NODEV=1], t)
617
AC_GHC_PKG_CHECK([test-framework-0.6*], [], [HS_NODEV=1], t)
618
AC_GHC_PKG_CHECK([test-framework-hunit], [], [HS_NODEV=1])
619
AC_GHC_PKG_CHECK([test-framework-quickcheck2], [], [HS_NODEV=1])
620
AC_GHC_PKG_CHECK([temporary], [], [HS_NODEV=1])
621
# FIXME: unify checks for non-test libraries (attoparsec, hinotify, ...)
622
#        that are needed to execute the tests, avoiding the duplication
623
#        of the checks.
624
AC_GHC_PKG_CHECK([attoparsec], [], [HS_NODEV=1])
625
AC_GHC_PKG_CHECK([vector], [], [HS_NODEV=1])
626
AC_GHC_PKG_CHECK([process], [],
627
                 [MONITORING_PKG="$MONITORING_PKG process"])
628
if test -n "$HS_NODEV"; then
629
   AC_MSG_WARN(m4_normalize([Required development modules were not found,
630
                             you won't be able to run Haskell unittests]))
631
else
632
   AC_MSG_NOTICE([Haskell development modules found, unittests enabled])
633
fi
634
AC_SUBST(HS_NODEV)
635

    
636
HTOOLS=yes
637
AC_SUBST(HTOOLS)
638

    
639
# --enable-split-query
640
ENABLE_SPLIT_QUERY=
641
AC_ARG_ENABLE([split-query],
642
  [AS_HELP_STRING([--enable-split-query],
643
  [enable use of custom query daemon via confd])],
644
  [[case "$enableval" in
645
      no)
646
        enable_split_query=False
647
        ;;
648
      yes)
649
        enable_split_query=True
650
        ;;
651
      *)
652
        echo "Invalid value for enable-confd '$enableval'"
653
        exit 1
654
        ;;
655
    esac
656
  ]],
657
  [[case "x${has_confd}x" in
658
     xTruex)
659
       enable_split_query=True
660
       ;;
661
     *)
662
       enable_split_query=False
663
       ;;
664
   esac]])
665
AC_SUBST(ENABLE_SPLIT_QUERY, $enable_split_query)
666

    
667
if test x$enable_split_query = xTrue -a x$has_confd != xTrue; then
668
  AC_MSG_ERROR([Split queries require the confd daemon])
669
fi
670

    
671
if test x$enable_split_query = xTrue; then
672
  AC_MSG_NOTICE([Split query functionality enabled])
673
fi
674

    
675
# Check for HsColour
676
HS_APIDOC=no
677
AC_ARG_VAR(HSCOLOUR, [HsColour path])
678
AC_PATH_PROG(HSCOLOUR, [HsColour], [])
679
if test -z "$HSCOLOUR"; then
680
  AC_MSG_WARN(m4_normalize([HsColour not found, htools API documentation will
681
                            not be generated]))
682
fi
683

    
684
# Check for haddock
685
AC_ARG_VAR(HADDOCK, [haddock path])
686
AC_PATH_PROG(HADDOCK, [haddock], [])
687
if test -z "$HADDOCK"; then
688
  AC_MSG_WARN(m4_normalize([haddock not found, htools API documentation will
689
                            not be generated]))
690
fi
691
if test -n "$HADDOCK" && test -n "$HSCOLOUR"; then
692
  HS_APIDOC=yes
693
fi
694
AC_SUBST(HS_APIDOC)
695

    
696
# Check for hlint
697
AC_ARG_VAR(HLINT, [hlint path])
698
AC_PATH_PROG(HLINT, [hlint], [])
699
if test -z "$HLINT"; then
700
  AC_MSG_WARN([hlint not found, checking code will not be possible])
701
fi
702

    
703
if test "$HTOOLS" != yes && test "$ENABLE_CONFD" = True; then
704
  AC_MSG_ERROR(m4_normalize([cannot enable ganeti-confd if
705
                             htools support is not enabled]))
706
fi
707

    
708
AM_CONDITIONAL([WANT_HTOOLS], [test "$HTOOLS" = yes])
709
AM_CONDITIONAL([WANT_HSTESTS], [test "x$HS_NODEV" = x])
710
AM_CONDITIONAL([WANT_HSAPIDOC], [test "$HS_APIDOC" = yes])
711
AM_CONDITIONAL([HAS_HLINT], [test "$HLINT"])
712

    
713
# Check for fakeroot
714
AC_ARG_VAR(FAKEROOT_PATH, [fakeroot path])
715
AC_PATH_PROG(FAKEROOT_PATH, [fakeroot], [])
716
if test -z "$FAKEROOT_PATH"; then
717
  AC_MSG_WARN(m4_normalize([fakeroot not found, tests that must run as root
718
                            will not be executed]))
719
fi
720
AM_CONDITIONAL([HAS_FAKEROOT], [test "x$FAKEROOT_PATH" != x])
721

    
722
SOCAT_USE_ESCAPE=
723
AC_ARG_ENABLE([socat-escape],
724
  [AS_HELP_STRING([--enable-socat-escape],
725
    [use escape functionality available in socat >= 1.7 (default: detect
726
     automatically)])],
727
  [[if test "$enableval" = yes; then
728
      SOCAT_USE_ESCAPE=True
729
    else
730
      SOCAT_USE_ESCAPE=False
731
    fi
732
  ]])
733

    
734
if test -z "$SOCAT_USE_ESCAPE"
735
then
736
  if $SOCAT -hh | grep -w -q escape; then
737
    SOCAT_USE_ESCAPE=True
738
  else
739
    SOCAT_USE_ESCAPE=False
740
  fi
741
fi
742

    
743
AC_SUBST(SOCAT_USE_ESCAPE)
744

    
745
SOCAT_USE_COMPRESS=
746
AC_ARG_ENABLE([socat-compress],
747
  [AS_HELP_STRING([--enable-socat-compress],
748
    [use OpenSSL compression option available in patched socat builds
749
     (see INSTALL for details; default: detect automatically)])],
750
  [[if test "$enableval" = yes; then
751
      SOCAT_USE_COMPRESS=True
752
    else
753
      SOCAT_USE_COMPRESS=False
754
    fi
755
  ]])
756

    
757
if test -z "$SOCAT_USE_COMPRESS"
758
then
759
  if $SOCAT -hhh | grep -w -q openssl-compress; then
760
    SOCAT_USE_COMPRESS=True
761
  else
762
    SOCAT_USE_COMPRESS=False
763
  fi
764
fi
765

    
766
AC_SUBST(SOCAT_USE_COMPRESS)
767

    
768
if man --help | grep -q -e --warnings
769
then
770
  MAN_HAS_WARNINGS=1
771
else
772
  MAN_HAS_WARNINGS=
773
  AC_MSG_WARN(m4_normalize([man does not support --warnings, man page checks
774
                            will not be possible]))
775
fi
776

    
777
AC_SUBST(MAN_HAS_WARNINGS)
778

    
779
# Check for Python
780
AM_PATH_PYTHON(2.6)
781

    
782
AC_PYTHON_MODULE(OpenSSL, t)
783
AC_PYTHON_MODULE(simplejson, t)
784
AC_PYTHON_MODULE(pyparsing, t)
785
AC_PYTHON_MODULE(pyinotify, t)
786
AC_PYTHON_MODULE(pycurl, t)
787
AC_PYTHON_MODULE(bitarray, t)
788
AC_PYTHON_MODULE(ipaddr, t)
789
AC_PYTHON_MODULE(mock)
790
AC_PYTHON_MODULE(affinity)
791
AC_PYTHON_MODULE(paramiko)
792

    
793
# Development-only Python modules
794
PY_NODEV=
795
AC_PYTHON_MODULE(yaml)
796
if test $HAVE_PYMOD_YAML == "no"; then
797
  PY_NODEV="$PY_NODEV yaml"
798
fi
799

    
800
if test -n "$PY_NODEV"; then
801
  AC_MSG_WARN(m4_normalize([Required development modules ($PY_NODEV) were not
802
                            found, you won't be able to run Python unittests]))
803
else
804
  AC_MSG_NOTICE([Python development modules found, unittests enabled])
805
fi
806
AC_SUBST(PY_NODEV)
807
AM_CONDITIONAL([PY_UNIT], [test -n $PY_NODEV])
808

    
809
AC_CONFIG_FILES([ Makefile ])
810

    
811
AC_OUTPUT