Imported Upstream version 2.6.0
[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     if test "$libcurl_feature_SSL" != "yes" ||
18        test "$libcurl_protocol_HTTPS" != "yes"; then
19         s3_ssl=no
20     else
21         s3_ssl=yes
22     fi
23
24     AC_ARG_ENABLE([s3-device],
25         AS_HELP_STRING([--disable-s3-device],
26                        [disable the S3 device]),
27         [ WANT_S3_DEVICE=$enableval ], [ WANT_S3_DEVICE=maybe ])
28
29     AC_MSG_CHECKING([whether to include the Amazon S3 device])
30     # if the user didn't specify 'no', then check for support
31     if test x"$WANT_S3_DEVICE" != x"no"; then
32         if test x"$HAVE_CURL" = x"yes" -a x"$HAVE_HMAC" = x"yes"; then
33             WANT_S3_DEVICE=yes
34         else
35             # no support -- if the user explicitly enabled the device,
36             # then this is an error
37             if test x"$WANT_S3_DEVICE" = x"yes"; then
38                 AC_MSG_RESULT(no)
39                 AC_MSG_ERROR([Cannot build the Amazon S3 device: one or more prerequisites are missing.])
40             else
41                 WANT_S3_DEVICE=no
42             fi
43         fi
44     fi
45     AC_MSG_RESULT($WANT_S3_DEVICE)
46
47     AM_CONDITIONAL([WANT_S3_DEVICE], [test x"$WANT_S3_DEVICE" = x"yes"])
48
49     # Now handle any setup for S3, if we want it.
50     if test x"$WANT_S3_DEVICE" = x"yes"; then
51         AC_DEFINE(WANT_S3_DEVICE, [], [Compile Amazon S3 driver])
52         if test x"$s3_ssl" = x"no"; then
53           AMANDA_MSG_WARN([Encryption support is not available for S3; requests will be sent in plaintext.])
54         fi
55     fi
56                           
57
58     AC_ARG_ENABLE([devpay],
59                   AS_HELP_STRING([--enable-devpay],
60                                  [Use devpay authentication for Amazon S3 driver]),
61                   [WANT_DEVPAY=$enableval], [WANT_DEVPAY=no])
62
63     AC_MSG_CHECKING([whether to include the Amazon S3 device's DevPay support])
64     if test x"$WANT_DEVPAY" = x"yes"; then
65         if test x"$WANT_S3_DEVICE" != x"yes"; then
66             AC_MSG_RESULT(no)
67             AC_MSG_ERROR([DevPay support requires the S3 device (--enable-s3-device)])
68         fi
69
70         if test "$s3_ssl" != "yes"; then
71             AC_MSG_RESULT(no)
72             AC_MSG_ERROR([Cannot use devpay without HTTPS/SSL support in libcurl.])
73         fi
74
75         AC_DEFINE([WANT_DEVPAY], [], [Compile Amazon DevPay support])
76     fi
77     AC_MSG_RESULT($WANT_DEVPAY)
78
79     AM_CONDITIONAL([WANT_DEVPAY], [test "$WANT_DEVPAY" = "yes"])
80 ])