Revision 21a5e56c configure.ac

b/configure.ac
310 310
fi
311 311
AC_SUBST(SYSLOG_USAGE, $SYSLOG)
312 312

  
313
# --enable-htools
314
HTOOLS=
315
AC_ARG_ENABLE([htools],
316
        [AS_HELP_STRING([--enable-htools],
317
        [enable use of htools (needs GHC and libraries, default: check)])],
318
        [],
319
        [enable_htools=check])
320

  
321
# --enable-htools-rapi
322
HTOOLS_RAPI=
323
AC_ARG_ENABLE([htools-rapi],
324
        [AS_HELP_STRING([--enable-htools-rapi],
325
        [enable use of RAPI in htools (needs curl, default: no)])],
326
        [],
327
        [enable_htools_rapi=check])
328

  
329
# --enable-confd
330
ENABLE_CONFD=
331
AC_ARG_ENABLE([confd],
332
  [AS_HELP_STRING([--enable-confd],
333
  [enable the ganeti-confd daemon (default: yes)])],
334
  [[case "$enableval" in
335
      no)
336
        enable_confd=False
337
        ;;
338
      yes|haskell)
339
        enable_confd=True
340
        ;;
341
      *)
342
        echo "Invalid value for enable-confd '$enableval'"
343
        exit 1
344
        ;;
345
    esac
346
  ]],
347
  [enable_confd=True])
348
AC_SUBST(ENABLE_CONFD, $enable_confd)
349

  
350
AM_CONDITIONAL([ENABLE_CONFD], [test x$enable_confd = xTrue])
351

  
352 313
# --with-disk-separator=...
353 314
AC_ARG_WITH([disk-separator],
354 315
  [AS_HELP_STRING([--with-disk-separator=STRING],
......
430 391
  AC_MSG_WARN([qemu-img not found, using ovfconverter will not be possible])
431 392
fi
432 393

  
433
if test "$enable_htools" != "no"; then
394
# --enable-htools-rapi
395
HTOOLS_RAPI=
396
AC_ARG_ENABLE([htools-rapi],
397
        [AS_HELP_STRING([--enable-htools-rapi],
398
        [enable use of curl in the Haskell code (default: check)])],
399
        [],
400
        [enable_htools_rapi=check])
401

  
402
# --enable-confd
403
ENABLE_CONFD=
404
AC_ARG_ENABLE([confd],
405
  [AS_HELP_STRING([--enable-confd],
406
  [enable the ganeti-confd daemon (default: check)])],
407
  [],
408
  [enable_confd=check])
434 409

  
435 410
# Check for ghc
436 411
AC_ARG_VAR(GHC, [ghc path])
437 412
AC_PATH_PROG(GHC, [ghc], [])
438 413
if test -z "$GHC"; then
439
  if test "$enable_htools" != "check"; then
440
    AC_MSG_FAILURE([ghc not found, htools compilation will not possible])
441
  fi
414
  AC_MSG_FAILURE([ghc not found, compilation will not possible])
442 415
fi
443 416

  
444 417
# Check for ghc-pkg
445
HTOOLS_MODULES=
446 418
AC_ARG_VAR(GHC_PKG, [ghc-pkg path])
447 419
AC_PATH_PROG(GHC_PKG, [ghc-pkg], [])
448 420
if test -z "$GHC_PKG"; then
449
  if test "$enable_htools" != "check"; then
450
    AC_MSG_FAILURE([ghc-pkg not found, htools compilation will not be possible])
451
  fi
452
else
453
  # check for modules
454
  AC_MSG_NOTICE([checking for required haskell modules])
455
  HTOOLS_NOCURL=-DNO_CURL
456
  if test "$enable_htools_rapi" != "no"; then
457
    AC_MSG_CHECKING([curl])
458
    GHC_PKG_CURL=$($GHC_PKG latest curl)
459
    if test -z "$GHC_PKG_CURL"; then
460
      if test "$enable_htools_rapi" = "check"; then
461
        AC_MSG_WARN(m4_normalize([The curl library not found, htools will be
462
                                  compiled without RAPI support]))
463
      else
464
        AC_MSG_FAILURE(m4_normalize([The curl library was not found, but it has
465
                                     been requested]))
466
      fi
421
  AC_MSG_FAILURE([ghc-pkg not found, compilation will not be possible])
422
fi
423

  
424
# check for modules, first custom/special checks
425
AC_MSG_NOTICE([checking for required haskell modules])
426
HTOOLS_NOCURL=-DNO_CURL
427
if test "$enable_htools_rapi" != "no"; then
428
  AC_GHC_PKG_CHECK([curl], [HTOOLS_NOCURL=], [])
429
  if test -n "$HTOOLS_NOCURL"; then
430
    if test "$enable_htools_rapi" = "check"; then
431
      AC_MSG_WARN(m4_normalize([The curl library was not found, Haskell
432
                                code will be compiled without RAPI support]))
467 433
    else
468
      HTOOLS_NOCURL=
434
      AC_MSG_FAILURE(m4_normalize([The curl library was not found, but it has
435
                                   been requested]))
469 436
    fi
470
    AC_MSG_RESULT($GHC_PKG_CURL)
471
  fi
472
  AC_SUBST(GHC_PKG_CURL)
473
  AC_SUBST(HTOOLS_NOCURL)
474
  AC_MSG_CHECKING([parallel])
475
  GHC_PKG_PARALLEL=$($GHC_PKG --simple-output list 'parallel-3.*')
476
  if test -n "$GHC_PKG_PARALLEL"
477
  then
478
    HTOOLS_PARALLEL3=-DPARALLEL3
479 437
  else
480
    GHC_PKG_PARALLEL=$($GHC_PKG --simple-output list 'parallel-2.*')
481
  fi
482
  if test -z "$GHC_PKG_PARALLEL"
483
  then
484
    GHC_PKG_PARALLEL=$($GHC_PKG --simple-output list 'parallel-1.*')
485
  fi
486
  AC_SUBST(GHC_PKG_PARALLEL)
487
  AC_SUBST(HTOOLS_PARALLEL3)
488
  AC_MSG_RESULT($GHC_PKG_PARALLEL)
489
  AC_MSG_CHECKING([json])
490
  GHC_PKG_JSON=$($GHC_PKG latest json)
491
  AC_MSG_RESULT($GHC_PKG_JSON)
492
  AC_MSG_CHECKING([network])
493
  GHC_PKG_NETWORK=$($GHC_PKG latest network)
494
  AC_MSG_RESULT($GHC_PKG_NETWORK)
495
  AC_MSG_CHECKING([QuickCheck 2.x])
496
  GHC_PKG_QUICKCHECK=$($GHC_PKG --simple-output list 'QuickCheck-2.*')
497
  AC_MSG_RESULT($GHC_PKG_QUICKCHECK)
498
  if test -z "$GHC_PKG_PARALLEL" || test -z "$GHC_PKG_JSON" || \
499
     test -z "$GHC_PKG_NETWORK"; then
500
    if test "$enable_htools" != "check"; then
501
      AC_MSG_FAILURE(m4_normalize([Required Haskell modules not found, htools
502
                                   compilation disabled]))
503
    fi
504
  else
505
    # we leave the other modules to be auto-selected
506
    HTOOLS_MODULES="-package $GHC_PKG_PARALLEL"
507
  fi
508
  if test -z "$GHC_PKG_QUICKCHECK"; then
509
     AC_MSG_WARN(m4_normalize([The QuickCheck 2.x module was not found,
510
                               you won't be able to run Haskell unittests]))
438
    AC_MSG_NOTICE([Enabling curl/RAPI/RPC usage in Haskell code])
511 439
  fi
512 440
fi
513
AC_SUBST(HTOOLS_MODULES)
514
AC_SUBST(GHC_PKG_QUICKCHECK)
515

  
516
if test "$enable_htools" != "no"; then
517
  if test -z "$GHC" || test -z "$HTOOLS_MODULES"; then
518
    AC_MSG_WARN(m4_normalize([Haskell compiler/required libraries not found,
519
                              htools compilation disabled]))
441
AC_SUBST(HTOOLS_NOCURL)
442

  
443
HTOOLS_PARALLEL3=
444
AC_GHC_PKG_CHECK([parallel-3.*], [HTOOLS_PARALLEL3=-DPARALLEL3],
445
                 [AC_GHC_PKG_REQUIRE(parallel)], t)
446
AC_SUBST(HTOOLS_PARALLEL3)
447

  
448
# and now standard modules
449
AC_GHC_PKG_REQUIRE(json)
450
AC_GHC_PKG_REQUIRE(network)
451
AC_GHC_PKG_REQUIRE(mtl)
452
AC_GHC_PKG_REQUIRE(bytestring)
453
AC_GHC_PKG_REQUIRE(utf8-string)
454

  
455
# extra modules for confd functionality
456
HTOOLS_REGEX_PCRE=-DNO_REGEX_PCRE
457
has_confd=False
458
if test "$enable_confd" != "no"; then
459
  CONFD_PKG=
460
  AC_GHC_PKG_CHECK([regex-pcre], [HTOOLS_REGEX_PCRE=],
461
                   [CONFD_PKG="$CONFD_PKG regex-pcre"])
462
  AC_GHC_PKG_CHECK([hslogger], [], [CONFD_PKG="$CONFD_PKG hslogger"])
463
  AC_GHC_PKG_CHECK([Crypto], [], [CONFD_PKG="$CONFD_PKG Crypto"])
464
  AC_GHC_PKG_CHECK([text], [], [CONFD_PKG="$CONFD_PKG text"])
465
  AC_GHC_PKG_CHECK([hinotify], [], [CONFD_PKG="$CONFD_PKG hinotify"])
466
  if test -z "$CONFD_PKG"; then
467
    has_confd=True
520 468
  else
521
    HTOOLS=yes
469
    if test "$enable_confd" = "check"; then
470
      AC_MSG_WARN(m4_normalize([The required extra libraries for confd were
471
                                not found ($CONFD_PKG), confd disabled]))
472
    else
473
      AC_MSG_FAILURE(m4_normalize([The confd functionality was requested, but
474
                                   required libraries were not found:
475
                                   $CONFD_PKG]))
476
    fi
522 477
  fi
523 478
fi
479
AC_SUBST(HTOOLS_REGEX_PCRE)
480
if test "$has_confd" = "True"; then
481
  AC_MSG_NOTICE([Enabling confd usage])
482
fi
483
AC_SUBST(ENABLE_CONFD, $has_confd)
484
AM_CONDITIONAL([ENABLE_CONFD], [test x$has_confd = xTrue])
485

  
486
# development modules
487
HTOOLS_NODEV=
488
AC_GHC_PKG_CHECK([QuickCheck-2.*], [], [HTOOLS_NODEV=1], t)
489
AC_GHC_PKG_CHECK([test-framework-0.6*], [], [HTOOLS_NODEV=1], t)
490
AC_GHC_PKG_CHECK([test-framework-hunit], [], [HTOOLS_NODEV=1])
491
AC_GHC_PKG_CHECK([test-framework-quickcheck2], [], [HTOOLS_NODEV=1])
492
if test -n "$HTOOLS_NODEV"; then
493
   AC_MSG_WARN(m4_normalize([Required development modules were not found,
494
                             you won't be able to run Haskell unittests]))
495
else
496
   AC_MSG_NOTICE([Haskell development modules found, unittests enabled])
497
fi
498
AC_SUBST(HTOOLS_NODEV)
499

  
500
HTOOLS=yes
524 501
AC_SUBST(HTOOLS)
525 502

  
526 503
# --enable-split-query
......
541 518
        ;;
542 519
    esac
543 520
  ]],
544
  [[case "x${enable_confd}x${HTOOLS_NOCURL}x" in
521
  [[case "x${has_confd}x${HTOOLS_NOCURL}x" in
545 522
     xTruexx)
546 523
       enable_split_query=True
547 524
       ;;
......
551 528
   esac]])
552 529
AC_SUBST(ENABLE_SPLIT_QUERY, $enable_split_query)
553 530

  
554
if test x$enable_split_query = xTrue -a x$enable_confd != xTrue; then
531
if test x$enable_split_query = xTrue -a x$has_confd != xTrue; then
555 532
  AC_MSG_ERROR([Split queries require the confd daemon])
556 533
fi
557 534

  
......
592 569
  AC_MSG_WARN([hlint not found, checking code will not be possible])
593 570
fi
594 571

  
595
fi # end if enable_htools, define automake conditions
596

  
597 572
if test "$HTOOLS" != "yes" && test "$ENABLE_CONFD" = "True"; then
598 573
   AC_MSG_ERROR(m4_normalize([cannot enable ganeti-confd if
599 574
                              htools support is not enabled]))

Also available in: Unified diff