Statistics
| Branch: | Tag: | Revision:

root / configure.ac @ 1551758e

History | View | Annotate | Download (24.1 kB)

1
# Configure script for Ganeti
2
m4_define([gnt_version_major], [2])
3
m4_define([gnt_version_minor], [11])
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
AC_SUBST([BINDIR], $bindir)
24
AC_SUBST([SBINDIR], $sbindir)
25
AC_SUBST([MANDIR], $mandir)
26

    
27
# --enable-versionfull
28
AC_ARG_ENABLE([versionfull],
29
  [AS_HELP_STRING([--enable-versionfull],
30
                  m4_normalize([use the full version string rather
31
                  than major.minor for version directories]))],
32
  [[if test "$enableval" != no; then
33
      USE_VERSION_FULL=yes
34
    else
35
      USER_VERSION_FULL=no
36
    fi
37
  ]],
38
  [USE_VERSION_FULL=no
39
  ])
40
AC_SUBST(USE_VERSION_FULL, $USE_VERSION_FULL)
41
AM_CONDITIONAL([USE_VERSION_FULL], [test "$USE_VERSION_FULL" = yes])
42

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

    
59
# --enable-haskell-profiling
60
AC_ARG_ENABLE([haskell-profiling],
61
  [AS_HELP_STRING([--enable-haskell-profiling],
62
                  m4_normalize([enable profiling for Haskell binaries
63
                  (default: disabled)]))],
64
  [[if test "$enableval" != yes; then
65
      HPROFILE=no
66
    else
67
      HPROFILE=yes
68
    fi
69
  ]],
70
  [HPROFILE=no
71
  ])
72
AC_SUBST(HPROFILE, $HPROFILE)
73
AM_CONDITIONAL([HPROFILE], [test "$HPROFILE" = yes])
74

    
75
# --enable-haskell-coverage
76
AC_ARG_ENABLE([haskell-coverage],
77
  [AS_HELP_STRING([--enable-haskell-coverage],
78
                  m4_normalize([enable coverage for Haskell binaries
79
                  (default: disabled)]))],
80
  [[if test "$enableval" != yes; then
81
      HCOVERAGE=no
82
    else
83
      HCOVERAGE=yes
84
    fi
85
  ]],
86
  [HCOVERAGE=no
87
  ])
88
AC_SUBST(HCOVERAGE, $HCOVERAGE)
89
AM_CONDITIONAL([HCOVERAGE], [test "$HCOVERAGE" = yes])
90

    
91
# --enable-haskell-tests
92
AC_ARG_ENABLE([haskell-tests],
93
  [AS_HELP_STRING([--enable-haskell-tests],
94
                  m4_normalize([enable additinal Haskell development test code
95
                  (default: disabled)]))],
96
  [[if test "$enableval" != yes; then
97
      HTEST=no
98
    else
99
      HTEST=yes
100
    fi
101
  ]],
102
  [HTEST=no
103
  ])
104
AC_SUBST(HTEST, $HTEST)
105
AM_CONDITIONAL([HTEST], [test "$HTEST" = yes])
106

    
107
# --with-ssh-initscript=...
108
AC_ARG_WITH([ssh-initscript],
109
  [AS_HELP_STRING([--with-ssh-initscript=SCRIPT],
110
    [SSH init script to use (default is /etc/init.d/ssh)]
111
  )],
112
  [ssh_initd_script="$withval"],
113
  [ssh_initd_script="/etc/init.d/ssh"])
114
AC_SUBST(SSH_INITD_SCRIPT, $ssh_initd_script)
115

    
116
# --with-export-dir=...
117
AC_ARG_WITH([export-dir],
118
  [AS_HELP_STRING([--with-export-dir=DIR],
119
    [directory to use by default for instance image]
120
    [ exports (default is /srv/ganeti/export)]
121
  )],
122
  [export_dir="$withval"],
123
  [export_dir="/srv/ganeti/export"])
124
AC_SUBST(EXPORT_DIR, $export_dir)
125

    
126
# --with-ssh-config-dir=...
127
AC_ARG_WITH([ssh-config-dir],
128
  [AS_HELP_STRING([--with-ssh-config-dir=DIR],
129
    [ directory with ssh host keys ]
130
    [ (default is /etc/ssh)]
131
  )],
132
  [ssh_config_dir="$withval"],
133
  [ssh_config_dir="/etc/ssh"])
134
AC_SUBST(SSH_CONFIG_DIR, $ssh_config_dir)
135

    
136
# --with-xen-config-dir=...
137
AC_ARG_WITH([xen-config-dir],
138
  [AS_HELP_STRING([--with-xen-config-dir=DIR],
139
                  m4_normalize([Xen configuration directory
140
                                (default: /etc/xen)]))],
141
  [xen_config_dir="$withval"],
142
  [xen_config_dir=/etc/xen])
143
AC_SUBST(XEN_CONFIG_DIR, $xen_config_dir)
144

    
145
# --with-os-search-path=...
146
AC_ARG_WITH([os-search-path],
147
  [AS_HELP_STRING([--with-os-search-path=LIST],
148
    [comma separated list of directories to]
149
    [ search for OS images (default is /srv/ganeti/os)]
150
  )],
151
  [os_search_path="$withval"],
152
  [os_search_path="/srv/ganeti/os"])
153
AC_SUBST(OS_SEARCH_PATH, $os_search_path)
154

    
155
# --with-extstorage-search-path=...
156
AC_ARG_WITH([extstorage-search-path],
157
  [AS_HELP_STRING([--with-extstorage-search-path=LIST],
158
    [comma separated list of directories to]
159
    [ search for External Storage Providers]
160
    [ (default is /srv/ganeti/extstorage)]
161
  )],
162
  [es_search_path="$withval"],
163
  [es_search_path="/srv/ganeti/extstorage"])
164
AC_SUBST(ES_SEARCH_PATH, $es_search_path)
165

    
166
# --with-iallocator-search-path=...
167
AC_ARG_WITH([iallocator-search-path],
168
  [AS_HELP_STRING([--with-iallocator-search-path=LIST],
169
    [comma separated list of directories to]
170
    [ search for instance allocators (default is $libdir/ganeti/iallocators)]
171
  )],
172
  [iallocator_search_path="$withval"],
173
  [iallocator_search_path="$libdir/$PACKAGE_NAME/iallocators"])
174
AC_SUBST(IALLOCATOR_SEARCH_PATH, $iallocator_search_path)
175

    
176
# --with-xen-bootloader=...
177
AC_ARG_WITH([xen-bootloader],
178
  [AS_HELP_STRING([--with-xen-bootloader=PATH],
179
    [bootloader for Xen hypervisor (default is empty)]
180
  )],
181
  [xen_bootloader="$withval"],
182
  [xen_bootloader=])
183
AC_SUBST(XEN_BOOTLOADER, $xen_bootloader)
184

    
185
# --with-xen-kernel=...
186
AC_ARG_WITH([xen-kernel],
187
  [AS_HELP_STRING([--with-xen-kernel=PATH],
188
    [DomU kernel image for Xen hypervisor (default is /boot/vmlinuz-3-xenU)]
189
  )],
190
  [xen_kernel="$withval"],
191
  [xen_kernel="/boot/vmlinuz-3-xenU"])
192
AC_SUBST(XEN_KERNEL, $xen_kernel)
193

    
194
# --with-xen-initrd=...
195
AC_ARG_WITH([xen-initrd],
196
  [AS_HELP_STRING([--with-xen-initrd=PATH],
197
    [DomU initrd image for Xen hypervisor (default is /boot/initrd-3-xenU)]
198
  )],
199
  [xen_initrd="$withval"],
200
  [xen_initrd="/boot/initrd-3-xenU"])
201
AC_SUBST(XEN_INITRD, $xen_initrd)
202

    
203
# --with-kvm-kernel=...
204
AC_ARG_WITH([kvm-kernel],
205
  [AS_HELP_STRING([--with-kvm-kernel=PATH],
206
    [Guest kernel image for KVM hypervisor (default is /boot/vmlinuz-3-kvmU)]
207
  )],
208
  [kvm_kernel="$withval"],
209
  [kvm_kernel="/boot/vmlinuz-3-kvmU"])
210
AC_SUBST(KVM_KERNEL, $kvm_kernel)
211

    
212
# --with-kvm-path=...
213
AC_ARG_WITH([kvm-path],
214
  [AS_HELP_STRING([--with-kvm-path=PATH],
215
    [absolute path to the kvm binary]
216
    [ (default is /usr/bin/kvm)]
217
  )],
218
  [kvm_path="$withval"],
219
  [kvm_path="/usr/bin/kvm"])
220
AC_SUBST(KVM_PATH, $kvm_path)
221

    
222
# --with-lvm-stripecount=...
223
AC_ARG_WITH([lvm-stripecount],
224
  [AS_HELP_STRING([--with-lvm-stripecount=NUM],
225
    [the default number of stripes to use for LVM volumes]
226
    [ (default is 1)]
227
  )],
228
  [lvm_stripecount="$withval"],
229
  [lvm_stripecount=1])
230
AC_SUBST(LVM_STRIPECOUNT, $lvm_stripecount)
231

    
232
# --with-ssh-login-user=...
233
AC_ARG_WITH([ssh-login-user],
234
  [AS_HELP_STRING([--with-ssh-login-user=USERNAME],
235
    [user to use for SSH logins within the cluster (default is root)]
236
  )],
237
  [ssh_login_user="$withval"],
238
  [ssh_login_user=root])
239
AC_SUBST(SSH_LOGIN_USER, $ssh_login_user)
240

    
241
# --with-ssh-console-user=...
242
AC_ARG_WITH([ssh-console-user],
243
  [AS_HELP_STRING([--with-ssh-console-user=USERNAME],
244
    [user to use for SSH logins to access instance consoles (default is root)]
245
  )],
246
  [ssh_console_user="$withval"],
247
  [ssh_console_user=root])
248
AC_SUBST(SSH_CONSOLE_USER, $ssh_console_user)
249

    
250
# --with-default-user=...
251
AC_ARG_WITH([default-user],
252
  [AS_HELP_STRING([--with-default-user=USERNAME],
253
    [default user for daemons]
254
    [ (default is to run all daemons as root)]
255
  )],
256
  [user_default="$withval"],
257
  [user_default=root])
258

    
259
# --with-default-group=...
260
AC_ARG_WITH([default-group],
261
  [AS_HELP_STRING([--with-default-group=GROUPNAME],
262
    [default group for daemons]
263
    [ (default is to run all daemons under group root)]
264
  )],
265
  [group_default="$withval"],
266
  [group_default=root])
267

    
268
# --with-user-prefix=...
269
AC_ARG_WITH([user-prefix],
270
  [AS_HELP_STRING([--with-user-prefix=PREFIX],
271
    [prefix for daemon users]
272
    [ (default is to run all daemons as root; use --with-default-user]
273
    [ to change the default)]
274
  )],
275
  [user_masterd="${withval}masterd";
276
   user_rapi="${withval}rapi";
277
   user_confd="${withval}confd";
278
   user_kvmd="$user_default";
279
   user_luxid="${withval}masterd";
280
   user_noded="$user_default";
281
   user_mond="$user_default"],
282
  [user_masterd="$user_default";
283
   user_rapi="$user_default";
284
   user_confd="$user_default";
285
   user_kvmd="$user_default";
286
   user_luxid="$user_default";
287
   user_noded="$user_default";
288
   user_mond="$user_default"])
289
AC_SUBST(MASTERD_USER, $user_masterd)
290
AC_SUBST(RAPI_USER, $user_rapi)
291
AC_SUBST(CONFD_USER, $user_confd)
292
AC_SUBST(KVMD_USER, $user_kvmd)
293
AC_SUBST(LUXID_USER, $user_luxid)
294
AC_SUBST(NODED_USER, $user_noded)
295
AC_SUBST(MOND_USER, $user_mond)
296

    
297
# --with-group-prefix=...
298
AC_ARG_WITH([group-prefix],
299
  [AS_HELP_STRING([--with-group-prefix=PREFIX],
300
    [prefix for daemon POSIX groups]
301
    [ (default is to run all daemons under group root; use]
302
    [ --with-default-group to change the default)]
303
  )],
304
  [group_rapi="${withval}rapi";
305
   group_admin="${withval}admin";
306
   group_confd="${withval}confd";
307
   group_kvmd="$group_default";
308
   group_luxid="${withval}luxid";
309
   group_masterd="${withval}masterd";
310
   group_noded="$group_default";
311
   group_daemons="${withval}daemons";
312
   group_mond="$group_default"],
313
  [group_rapi="$group_default";
314
   group_admin="$group_default";
315
   group_confd="$group_default";
316
   group_kvmd="$group_default";
317
   group_luxid="$group_default";
318
   group_masterd="$group_default";
319
   group_noded="$group_default";
320
   group_daemons="$group_default";
321
   group_mond="$group_default"])
322
AC_SUBST(RAPI_GROUP, $group_rapi)
323
AC_SUBST(ADMIN_GROUP, $group_admin)
324
AC_SUBST(CONFD_GROUP, $group_confd)
325
AC_SUBST(KVMD_GROUP, $group_kvmd)
326
AC_SUBST(LUXID_GROUP, $group_luxid)
327
AC_SUBST(MASTERD_GROUP, $group_masterd)
328
AC_SUBST(NODED_GROUP, $group_noded)
329
AC_SUBST(DAEMONS_GROUP, $group_daemons)
330
AC_SUBST(MOND_GROUP, $group_mond)
331

    
332
# Print the config to the user
333
AC_MSG_NOTICE([Running ganeti-masterd as $group_masterd:$group_masterd])
334
AC_MSG_NOTICE([Running ganeti-rapi as $user_rapi:$group_rapi])
335
AC_MSG_NOTICE([Running ganeti-confd as $user_confd:$group_confd])
336
AC_MSG_NOTICE([Running ganeti-luxid as $user_luxid:$group_luxid])
337
AC_MSG_NOTICE([Group for daemons is $group_daemons])
338
AC_MSG_NOTICE([Group for clients is $group_admin])
339

    
340
# --enable-drbd-barriers
341
AC_ARG_ENABLE([drbd-barriers],
342
  [AS_HELP_STRING([--enable-drbd-barriers],
343
                  m4_normalize([enable the DRBD barriers functionality by
344
                                default (>= 8.0.12) (default: enabled)]))],
345
  [[if test "$enableval" != no; then
346
      DRBD_BARRIERS=n
347
      DRBD_NO_META_FLUSH=False
348
    else
349
      DRBD_BARRIERS=bf
350
      DRBD_NO_META_FLUSH=True
351
    fi
352
  ]],
353
  [DRBD_BARRIERS=n
354
   DRBD_NO_META_FLUSH=False
355
  ])
356
AC_SUBST(DRBD_BARRIERS, $DRBD_BARRIERS)
357
AC_SUBST(DRBD_NO_META_FLUSH, $DRBD_NO_META_FLUSH)
358

    
359
# --enable-syslog[=no/yes/only]
360
AC_ARG_ENABLE([syslog],
361
  [AS_HELP_STRING([--enable-syslog],
362
    [enable use of syslog (default: disabled), one of no/yes/only])],
363
  [[case "$enableval" in
364
      no)
365
        SYSLOG=no
366
        ;;
367
      yes)
368
        SYSLOG=yes
369
        ;;
370
      only)
371
        SYSLOG=only
372
        ;;
373
      *)
374
        SYSLOG=
375
        ;;
376
    esac
377
  ]],
378
  [SYSLOG=no])
379

    
380
if test -z "$SYSLOG"
381
then
382
  AC_MSG_ERROR([invalid value for syslog, choose one of no/yes/only])
383
fi
384
AC_SUBST(SYSLOG_USAGE, $SYSLOG)
385

    
386
# --enable-restricted-commands[=no/yes]
387
AC_ARG_ENABLE([restricted-commands],
388
  [AS_HELP_STRING([--enable-restricted-commands],
389
                  m4_normalize([enable restricted commands in the node daemon
390
                                (default: disabled)]))],
391
  [[if test "$enableval" = no; then
392
      enable_restricted_commands=False
393
    else
394
      enable_restricted_commands=True
395
    fi
396
  ]],
397
  [enable_restricted_commands=False])
398
AC_SUBST(ENABLE_RESTRICTED_COMMANDS, $enable_restricted_commands)
399

    
400
# --with-disk-separator=...
401
AC_ARG_WITH([disk-separator],
402
  [AS_HELP_STRING([--with-disk-separator=STRING],
403
    [Disk index separator, useful if the default of ':' is handled]
404
    [ specially by the hypervisor]
405
  )],
406
  [disk_separator="$withval"],
407
  [disk_separator=":"])
408
AC_SUBST(DISK_SEPARATOR, $disk_separator)
409

    
410
# Check common programs
411
AC_PROG_INSTALL
412
AC_PROG_LN_S
413

    
414
# check if ln is the GNU version of ln (and hence supports -T)
415
if ln --version 2> /dev/null | head -1 | grep -q GNU
416
then
417
  AC_SUBST(HAS_GNU_LN, True)
418
else
419
  AC_SUBST(HAS_GNU_LN, False)
420
fi
421

    
422
# Check for the ip command
423
AC_ARG_VAR(IP_PATH, [ip path])
424
AC_PATH_PROG(IP_PATH, [ip], [])
425
if test -z "$IP_PATH"
426
then
427
  AC_MSG_ERROR([ip command not found])
428
fi
429

    
430
# Check for pandoc
431
AC_ARG_VAR(PANDOC, [pandoc path])
432
AC_PATH_PROG(PANDOC, [pandoc], [])
433
if test -z "$PANDOC"
434
then
435
  AC_MSG_WARN([pandoc not found, man pages rebuild will not be possible])
436
fi
437

    
438
# Check for python-sphinx
439
AC_ARG_VAR(SPHINX, [sphinx-build path])
440
AC_PATH_PROG(SPHINX, [sphinx-build], [])
441
if test -z "$SPHINX"
442
then
443
  AC_MSG_WARN(m4_normalize([sphinx-build not found, documentation rebuild will
444
                            not be possible]))
445
else
446
  # Sphinx exits with code 1 when it prints its usage
447
  sphinxver=`{ $SPHINX --version 2>&1 || :; } | head -n 3`
448

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

    
452
  # Note: Character classes ([...]) need to be double quoted due to autoconf
453
  # using m4
454
  elif ! echo "$sphinxver" | grep -q -E \
455
       '^Sphinx[[[:space:]]]+(\(sphinx-build\)[[[:space:]]]+|v)[[1-9]]\>'; then
456
    AC_MSG_ERROR([Sphinx 1.0 or higher is required])
457
  fi
458
fi
459
AM_CONDITIONAL([HAS_SPHINX], [test -n "$SPHINX"])
460

    
461
AC_ARG_ENABLE([manpages-in-doc],
462
  [AS_HELP_STRING([--enable-manpages-in-doc],
463
                  m4_normalize([include man pages in HTML documentation
464
                                (requires sphinx; default disabled)]))],
465
  [case "$enableval" in
466
      yes) manpages_in_doc=yes ;;
467
      no) manpages_in_doc= ;;
468
      *)
469
        AC_MSG_ERROR([Bad value $enableval for --enable-manpages-in-doc])
470
        ;;
471
    esac
472
  ],
473
  [manpages_in_doc=])
474
AM_CONDITIONAL([MANPAGES_IN_DOC], [test -n "$manpages_in_doc"])
475
AC_SUBST(MANPAGES_IN_DOC, $manpages_in_doc)
476

    
477
if test -z "$SPHINX" -a -n "$manpages_in_doc"; then
478
  AC_MSG_ERROR([Including man pages in HTML documentation requires sphinx])
479
fi
480

    
481
# Check for graphviz (dot)
482
AC_ARG_VAR(DOT, [dot path])
483
AC_PATH_PROG(DOT, [dot], [])
484
if test -z "$DOT"
485
then
486
  AC_MSG_WARN(m4_normalize([dot (from the graphviz suite) not found,
487
                            documentation rebuild not possible]))
488
fi
489

    
490
# Check for pylint
491
AC_ARG_VAR(PYLINT, [pylint path])
492
AC_PATH_PROG(PYLINT, [pylint], [])
493
if test -z "$PYLINT"
494
then
495
  AC_MSG_WARN([pylint not found, checking code will not be possible])
496
fi
497

    
498
# Check for pep8
499
AC_ARG_VAR(PEP8, [pep8 path])
500
AC_PATH_PROG(PEP8, [pep8], [])
501
if test -z "$PEP8"
502
then
503
  AC_MSG_WARN([pep8 not found, checking code will not be complete])
504
fi
505
AM_CONDITIONAL([HAS_PEP8], [test -n "$PEP8"])
506

    
507
# Check for python-coverage
508
AC_ARG_VAR(PYCOVERAGE, [python-coverage path])
509
AC_PATH_PROGS(PYCOVERAGE, [python-coverage coverage], [])
510
if test -z "$PYCOVERAGE"
511
then
512
  AC_MSG_WARN(m4_normalize([python-coverage or coverage not found, evaluating
513
                            Python test coverage will not be possible]))
514
fi
515

    
516
# Check for socat
517
AC_ARG_VAR(SOCAT, [socat path])
518
AC_PATH_PROG(SOCAT, [socat], [])
519
if test -z "$SOCAT"
520
then
521
  AC_MSG_ERROR([socat not found])
522
fi
523

    
524
# Check for qemu-img
525
AC_ARG_VAR(QEMUIMG_PATH, [qemu-img path])
526
AC_PATH_PROG(QEMUIMG_PATH, [qemu-img], [])
527
if test -z "$QEMUIMG_PATH"
528
then
529
  AC_MSG_WARN([qemu-img not found, using ovfconverter will not be possible])
530
fi
531

    
532
# --enable-confd
533
ENABLE_CONFD=
534
AC_ARG_ENABLE([confd],
535
  [AS_HELP_STRING([--enable-confd],
536
  [enable the ganeti-confd daemon (default: check)])],
537
  [],
538
  [enable_confd=check])
539

    
540
ENABLE_MOND=
541
AC_ARG_ENABLE([monitoring],
542
  [AS_HELP_STRING([--enable-monitoring],
543
  [enable the ganeti monitoring daemon (default: check)])],
544
  [],
545
  [enable_monitoring=check])
546

    
547
# Check for ghc
548
AC_ARG_VAR(GHC, [ghc path])
549
AC_PATH_PROG(GHC, [ghc], [])
550
if test -z "$GHC"; then
551
  AC_MSG_FAILURE([ghc not found, compilation will not possible])
552
fi
553

    
554
AC_MSG_CHECKING([checking for extra GHC flags])
555
GHC_BYVERSION_FLAGS=
556
# check for GHC supported flags that vary accross versions
557
for flag in -fwarn-incomplete-uni-patterns; do
558
  if $GHC -e '0' $flag >/dev/null 2>/dev/null; then
559
   GHC_BYVERSION_FLAGS="$GHC_BYVERSION_FLAGS $flag"
560
  fi
561
done
562
AC_MSG_RESULT($GHC_BYVERSION_FLAGS)
563
AC_SUBST(GHC_BYVERSION_FLAGS)
564

    
565
# Check for ghc-pkg
566
AC_ARG_VAR(GHC_PKG, [ghc-pkg path])
567
AC_PATH_PROG(GHC_PKG, [ghc-pkg], [])
568
if test -z "$GHC_PKG"; then
569
  AC_MSG_FAILURE([ghc-pkg not found, compilation will not be possible])
570
fi
571

    
572
# check for modules, first custom/special checks
573
AC_MSG_NOTICE([checking for required haskell modules])
574
HS_PARALLEL3=
575
AC_GHC_PKG_CHECK([parallel-3.*], [HS_PARALLEL3=-DPARALLEL3],
576
                 [AC_GHC_PKG_REQUIRE(parallel)], t)
577
AC_SUBST(HS_PARALLEL3)
578

    
579
# and now standard modules
580
AC_GHC_PKG_REQUIRE(curl)
581
AC_GHC_PKG_REQUIRE(json)
582
AC_GHC_PKG_REQUIRE(network)
583
AC_GHC_PKG_REQUIRE(mtl)
584
AC_GHC_PKG_REQUIRE(bytestring)
585
AC_GHC_PKG_REQUIRE(base64-bytestring-1.*, t)
586
AC_GHC_PKG_REQUIRE(utf8-string)
587
AC_GHC_PKG_REQUIRE(zlib)
588
AC_GHC_PKG_REQUIRE(hslogger)
589
AC_GHC_PKG_REQUIRE(process)
590
AC_GHC_PKG_REQUIRE(attoparsec)
591
AC_GHC_PKG_REQUIRE(vector)
592
AC_GHC_PKG_REQUIRE(text)
593
AC_GHC_PKG_REQUIRE(hinotify)
594
AC_GHC_PKG_REQUIRE(Crypto)
595

    
596
# extra modules for confd functionality; also needed for tests
597
HS_NODEV=
598
CONFD_PKG=
599
# if a new confd dependency is needed, add it here like:
600
# AC_GHC_PKG_CHECK([somepkg], [], [HS_NODEV=1; CONFD_PKG="$CONFD_PKG somepkg"])
601
HS_REGEX_PCRE=-DNO_REGEX_PCRE
602
AC_GHC_PKG_CHECK([regex-pcre], [HS_REGEX_PCRE=],
603
                 [HS_NODEV=1; CONFD_PKG="$CONFD_PKG regex-pcre"])
604

    
605
has_confd=False
606
if test "$enable_confd" != no; then
607
  if test -z "$CONFD_PKG"; then
608
    has_confd=True
609
  elif test "$enable_confd" = check; then
610
    AC_MSG_WARN(m4_normalize([The required extra libraries for confd were
611
                              not found ($CONFD_PKG), confd disabled]))
612
  else
613
    AC_MSG_FAILURE(m4_normalize([The confd functionality was requested, but
614
                                 required libraries were not found:
615
                                 $CONFD_PKG]))
616
  fi
617
fi
618
AC_SUBST(HS_REGEX_PCRE)
619
if test "$has_confd" = True; then
620
  AC_MSG_NOTICE([Enabling confd usage])
621
fi
622
AC_SUBST(ENABLE_CONFD, $has_confd)
623
AM_CONDITIONAL([ENABLE_CONFD], [test x$has_confd = xTrue])
624

    
625
#extra modules for monitoring daemon functionality; also needed for tests
626
MONITORING_PKG=
627
AC_GHC_PKG_CHECK([snap-server], [],
628
                 [NS_NODEV=1; MONITORING_PKG="$MONITORING_PKG snap-server"])
629

    
630
has_monitoring=False
631
if test "$enable_monitoring" != no; then
632
  MONITORING_DEP=
633
  if test "$has_confd" = False; then
634
    MONITORING_DEP="$MONITORING_DEP confd"
635
  fi
636
  has_monitoring_pkg=False
637
  if test -z "$MONITORING_PKG"; then
638
    has_monitoring_pkg=True
639
  elif test "$enable_monitoring" = check; then
640
    AC_MSG_WARN(m4_normalize([The required extra libraries for the monitoring
641
                              daemon were not found ($MONITORING_PKG),
642
                              monitoring disabled]))
643
  else
644
    AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
645
                                 required libraries were not found:
646
                                 $MONITORING_PKG]))
647
  fi
648
  has_monitoring_dep=False
649
  if test -z "$MONITORING_DEP"; then
650
    has_monitoring_dep=True
651
  elif test "$enable_monitoring" = check; then
652
    AC_MSG_WARN(m4_normalize([The optional Ganeti components required for the
653
                              monitoring agent were not enabled
654
                              ($MONITORING_DEP), monitoring disabled]))
655
  else
656
    AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
657
                                 required optional Ganeti components were not
658
                                 found: $MONITORING_DEP]))
659
  fi
660

    
661
fi
662
if test "$has_monitoring_pkg" = True -a "$has_monitoring_dep" = True; then
663
  has_monitoring=True
664
  AC_MSG_NOTICE([Enabling the monitoring agent usage])
665
fi
666
AC_SUBST(ENABLE_MOND, $has_monitoring)
667
AM_CONDITIONAL([ENABLE_MOND], [test "$has_monitoring" = True])
668

    
669
# development modules
670
AC_GHC_PKG_CHECK([QuickCheck-2.*], [], [HS_NODEV=1], t)
671
AC_GHC_PKG_CHECK([test-framework-0.6*], [], [HS_NODEV=1], t)
672
AC_GHC_PKG_CHECK([test-framework-hunit], [], [HS_NODEV=1])
673
AC_GHC_PKG_CHECK([test-framework-quickcheck2], [], [HS_NODEV=1])
674
AC_GHC_PKG_CHECK([temporary], [], [HS_NODEV=1])
675
if test -n "$HS_NODEV"; then
676
   AC_MSG_WARN(m4_normalize([Required development modules were not found,
677
                             you won't be able to run Haskell unittests]))
678
else
679
   AC_MSG_NOTICE([Haskell development modules found, unittests enabled])
680
fi
681
AC_SUBST(HS_NODEV)
682
AM_CONDITIONAL([HS_UNIT], [test -n $HS_NODEV])
683

    
684
# Check for HsColour
685
HS_APIDOC=no
686
AC_ARG_VAR(HSCOLOUR, [HsColour path])
687
AC_PATH_PROG(HSCOLOUR, [HsColour], [])
688
if test -z "$HSCOLOUR"; then
689
  AC_MSG_WARN(m4_normalize([HsColour not found, htools API documentation will
690
                            not be generated]))
691
fi
692

    
693
# Check for haddock
694
AC_ARG_VAR(HADDOCK, [haddock path])
695
AC_PATH_PROG(HADDOCK, [haddock], [])
696
if test -z "$HADDOCK"; then
697
  AC_MSG_WARN(m4_normalize([haddock not found, htools API documentation will
698
                            not be generated]))
699
fi
700
if test -n "$HADDOCK" && test -n "$HSCOLOUR"; then
701
  HS_APIDOC=yes
702
fi
703
AC_SUBST(HS_APIDOC)
704

    
705
# Check for hlint
706
AC_ARG_VAR(HLINT, [hlint path])
707
AC_PATH_PROG(HLINT, [hlint], [])
708
if test -z "$HLINT"; then
709
  AC_MSG_WARN([hlint not found, checking code will not be possible])
710
fi
711

    
712
AM_CONDITIONAL([WANT_HSTESTS], [test "x$HS_NODEV" = x])
713
AM_CONDITIONAL([WANT_HSAPIDOC], [test "$HS_APIDOC" = yes])
714
AM_CONDITIONAL([HAS_HLINT], [test "$HLINT"])
715

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

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

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

    
746
AC_SUBST(SOCAT_USE_ESCAPE)
747

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

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

    
769
AC_SUBST(SOCAT_USE_COMPRESS)
770

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

    
780
AC_SUBST(MAN_HAS_WARNINGS)
781

    
782
# Check for Python
783
AM_PATH_PYTHON(2.6)
784

    
785
AC_PYTHON_MODULE(OpenSSL, t)
786
AC_PYTHON_MODULE(simplejson, t)
787
AC_PYTHON_MODULE(pyparsing, t)
788
AC_PYTHON_MODULE(pyinotify, t)
789
AC_PYTHON_MODULE(pycurl, t)
790
AC_PYTHON_MODULE(bitarray, t)
791
AC_PYTHON_MODULE(ipaddr, t)
792
AC_PYTHON_MODULE(mock)
793
AC_PYTHON_MODULE(affinity)
794
AC_PYTHON_MODULE(paramiko)
795

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

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

    
812
AC_CONFIG_FILES([ Makefile ])
813

    
814
AC_OUTPUT