about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T15·16+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-05-04T15·16+0200
commit75d2492f20dc513337de3ef2d45e1d5c68c7dff8 (patch)
tree61c9ee0856ef91bc3e4c524eeccf845828ccf9ad
parent16d9c872e41eb39248d88a3ba7c5706267676153 (diff)
Make the aws-cpp-sdk dependency optional
-rw-r--r--Makefile2
-rw-r--r--Makefile.config.in1
-rw-r--r--configure.ac10
-rw-r--r--release.nix11
-rw-r--r--src/libstore/local.mk6
-rw-r--r--src/libstore/s3-binary-cache-store.cc6
6 files changed, 28 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 52312343d429..8f3688475e62 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ makefiles = \
   doc/manual/local.mk \
   tests/local.mk
 
-GLOBAL_CXXFLAGS += -std=c++0x -g -Wall
+GLOBAL_CXXFLAGS += -std=c++11 -g -Wall
 
 -include Makefile.config
 
diff --git a/Makefile.config.in b/Makefile.config.in
index f0de4da37855..3a7892e8b6bb 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -3,6 +3,7 @@ CC = @CC@
 CFLAGS = @CFLAGS@
 CXX = @CXX@
 CXXFLAGS = @CXXFLAGS@
+ENABLE_S3 = @ENABLE_S3@
 HAVE_SODIUM = @HAVE_SODIUM@
 LIBCURL_LIBS = @LIBCURL_LIBS@
 OPENSSL_LIBS = @OPENSSL_LIBS@
diff --git a/configure.ac b/configure.ac
index 4698c7c7c11a..d06842054eeb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,6 +61,7 @@ CFLAGS=
 CXXFLAGS=
 AC_PROG_CC
 AC_PROG_CXX
+AX_CXX_COMPILE_STDCXX_11
 
 
 # Use 64-bit file system calls so that we can support files > 2 GiB.
@@ -193,6 +194,15 @@ AC_SUBST(HAVE_SODIUM, [$have_sodium])
 PKG_CHECK_MODULES([LIBLZMA], [liblzma], [CXXFLAGS="$LIBLZMA_CFLAGS $CXXFLAGS"])
 
 
+# Look for aws-cpp-sdk-s3.
+AC_LANG_PUSH(C++)
+AC_CHECK_HEADERS([aws/s3/S3Client.h],
+  [AC_DEFINE([ENABLE_S3], [1], [Whether to enable S3 support via aws-cpp-sdk-s3.])
+  enable_s3=1], [enable_s3=])
+AC_SUBST(ENABLE_S3, [$enable_s3])
+AC_LANG_POP(C++)
+
+
 # Whether to use the Boehm garbage collector.
 AC_ARG_ENABLE(gc, AC_HELP_STRING([--enable-gc],
   [enable garbage collection in the Nix expression evaluator (requires Boehm GC) [default=no]]),
diff --git a/release.nix b/release.nix
index 6fab352b2687..4803788fe009 100644
--- a/release.nix
+++ b/release.nix
@@ -27,6 +27,7 @@ let
           [ curl bison flex perl libxml2 libxslt bzip2 xz
             pkgconfig sqlite libsodium
             docbook5 docbook5_xsl
+            autoconf-archive
           ] ++ lib.optional (!lib.inNixShell) git;
 
         configureFlags = ''
@@ -71,15 +72,13 @@ let
         src = tarball;
 
         buildInputs =
-          [ curl perl bzip2 xz openssl pkgconfig sqlite boehmgc
-
+          [ curl perl bzip2 xz openssl pkgconfig sqlite boehmgc ]
+          ++ lib.optional stdenv.isLinux libsodium
+          ++ lib.optional stdenv.isLinux
             (aws-sdk-cpp.override {
               apis = ["s3"];
               customMemoryManagement = false;
-            })
-
-          ]
-          ++ lib.optional stdenv.isLinux libsodium;
+            });
 
         configureFlags = ''
           --disable-init-state
diff --git a/src/libstore/local.mk b/src/libstore/local.mk
index 22b0f235e0b2..9d5c04dca0c5 100644
--- a/src/libstore/local.mk
+++ b/src/libstore/local.mk
@@ -8,7 +8,11 @@ libstore_SOURCES := $(wildcard $(d)/*.cc)
 
 libstore_LIBS = libutil libformat
 
-libstore_LDFLAGS = $(SQLITE3_LIBS) -lbz2 $(LIBCURL_LIBS) $(SODIUM_LIBS) -laws-cpp-sdk-s3 -laws-cpp-sdk-core -pthread
+libstore_LDFLAGS = $(SQLITE3_LIBS) -lbz2 $(LIBCURL_LIBS) $(SODIUM_LIBS) -pthread
+
+ifeq ($(ENABLE_S3), 1)
+	libstore_LDFLAGS += -laws-cpp-sdk-s3 -laws-cpp-sdk-core
+endif
 
 ifeq ($(OS), SunOS)
 	libstore_LDFLAGS += -lsocket
diff --git a/src/libstore/s3-binary-cache-store.cc b/src/libstore/s3-binary-cache-store.cc
index cffcb1bf214f..e64d0eb852aa 100644
--- a/src/libstore/s3-binary-cache-store.cc
+++ b/src/libstore/s3-binary-cache-store.cc
@@ -1,3 +1,7 @@
+#include "config.h"
+
+#if ENABLE_S3
+
 #include "s3-binary-cache-store.hh"
 #include "nar-info.hh"
 #include "nar-info-disk-cache.hh"
@@ -251,3 +255,5 @@ static RegisterStoreImplementation regStore([](
 });
 
 }
+
+#endif