1aa37cbacdc182daea77e7fc911adec2d252cdfd
[debian/amanda] / config / amanda / s3-device.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_S3_DEVICE
4 #
5 # OVERVIEW
6 #
7 #   Perform the necessary checks for the S3 Device.  If the S3 device should be built,
8 #   WANT_S3_DEVICE is DEFINEd and set up as an AM_CONDITIONAL.
9 #
10 #   The subsidiary DevPay support, if enabled, defines and AM_CONDITIONALizes
11 #   WANT_DEVPAY.
12 #
13 AC_DEFUN([AMANDA_S3_DEVICE], [
14     AC_REQUIRE([AMANDA_CHECK_LIBCURL])
15     AC_REQUIRE([AMANDA_CHECK_HMAC])
16
17     AC_ARG_ENABLE([s3-device],
18         AS_HELP_STRING([--disable-s3-device],
19                        [disable the S3 device]),
20         [ WANT_S3_DEVICE=$enableval ], [ WANT_S3_DEVICE=maybe ])
21
22     AC_MSG_CHECKING([whether to include the Amazon S3 device])
23     # if the user didn't specify 'no', then check for support
24     if test x"$WANT_S3_DEVICE" != x"no"; then
25         if test x"$HAVE_CURL" = x"yes" -a x"$HAVE_HMAC" = x"yes"; then
26             WANT_S3_DEVICE=yes
27         else
28             # no support -- if the user explicitly enabled the device,
29             # then this is an error
30             if test x"$WANT_S3_DEVICE" = x"yes"; then
31                 AC_MSG_RESULT(no)
32                 AC_MSG_ERROR([Cannot build the Amazon S3 device: one or more prerequisites are missing.])
33             else
34                 WANT_S3_DEVICE=no
35             fi
36         fi
37     fi
38     AC_MSG_RESULT($WANT_S3_DEVICE)
39
40     AM_CONDITIONAL([WANT_S3_DEVICE], [test x"$WANT_S3_DEVICE" = x"yes"])
41
42     # Now handle any setup for S3, if we want it.
43     if test x"$WANT_S3_DEVICE" = x"yes"; then
44         AC_DEFINE(WANT_S3_DEVICE, [], [Compile Amazon S3 driver])
45     fi
46                           
47
48     AC_ARG_ENABLE([devpay],
49                   AS_HELP_STRING([--enable-devpay],
50                                  [Use devpay authentication for Amazon S3 driver]),
51                   [WANT_DEVPAY=$enableval], [WANT_DEVPAY=no])
52
53     AC_MSG_CHECKING([whether to include the Amazon S3 device's DevPay support])
54     if test x"$WANT_DEVPAY" = x"yes"; then
55         if test x"$WANT_S3_DEVICE" != x"yes"; then
56             AC_MSG_RESULT(no)
57             AC_MSG_ERROR([DevPay support requires the S3 device (--enable-s3-device)])
58         fi
59
60         AC_DEFINE([WANT_DEVPAY], [], [Compile Amazon DevPay support])
61     fi
62     AC_MSG_RESULT($WANT_DEVPAY)
63
64     AM_CONDITIONAL([WANT_DEVPAY], [test "$WANT_DEVPAY" = "yes"])
65 ])