about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-02-13T09·09+0100
committerGitHub <noreply@github.com>2019-02-13T09·09+0100
commit25722bd39aece28a3ab8ef05fa14cece37b8c8fe (patch)
tree949694cbe850b79001cba63612a63d2d2481dc1f
parent7a7ec2229834aa294b3e09df7f514b7134287ec2 (diff)
parent7ce1fae59f6cb4341f61a48a5216cb252e4eca54 (diff)
Merge pull request #2677 from matthewbauer/disable-shared
Support --disable-shared flag.
-rw-r--r--Makefile.config.in2
-rw-r--r--configure.ac10
-rw-r--r--mk/libraries.mk2
3 files changed, 13 insertions, 1 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index b01a4afbfbab..59730b646387 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -1,4 +1,6 @@
+AR = @AR@
 BDW_GC_LIBS = @BDW_GC_LIBS@
+BUILD_SHARED_LIBS = @BUILD_SHARED_LIBS@
 CC = @CC@
 CFLAGS = @CFLAGS@
 CXX = @CXX@
diff --git a/configure.ac b/configure.ac
index 5a2526672fdb..410b20972f2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@ AC_PROG_CXX
 AC_PROG_CPP
 AX_CXX_COMPILE_STDCXX_14
 
+AC_CHECK_TOOL([AR], [ar])
 
 # Use 64-bit file system calls so that we can support files > 2 GiB.
 AC_SYS_LARGEFILE
@@ -267,6 +268,15 @@ AC_ARG_WITH(sandbox-shell, AC_HELP_STRING([--with-sandbox-shell=PATH],
   sandbox_shell=$withval)
 AC_SUBST(sandbox_shell)
 
+AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared],
+  [Build shared libraries for Nix [default=yes]]),
+  shared=$enableval, shared=yes)
+if test "$shared" = yes; then
+  AC_SUBST(BUILD_SHARED_LIBS, 1, [Whether to build shared libraries.])
+else
+  AC_SUBST(BUILD_SHARED_LIBS, 0, [Whether to build shared libraries.])
+fi
+
 
 # Expand all variables in config.status.
 test "$prefix" = NONE && prefix=$ac_default_prefix
diff --git a/mk/libraries.mk b/mk/libraries.mk
index 14c95fa91cf6..3953446cba32 100644
--- a/mk/libraries.mk
+++ b/mk/libraries.mk
@@ -125,7 +125,7 @@ define build-library
     $(1)_PATH := $$(_d)/$$($(1)_NAME).a
 
     $$($(1)_PATH): $$($(1)_OBJS) | $$(_d)/
-	$(trace-ar) ar crs $$@ $$?
+	$(trace-ar) $(AR) crs $$@ $$?
 
     $(1)_LDFLAGS_USE += $$($(1)_PATH) $$($(1)_LDFLAGS)