aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-28 16:53:56 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-28 16:53:56 +0200
commit73bba12d8ba1bff2b2c0266a7fdbe1ee8ab0ad6a (patch)
tree111b155d26ef6398afcd40205dab9d4f6cf5f6c8
parenta1a5e63e1456b5905b73065f635a324f3c309a5d (diff)
Check for libreadline
-rw-r--r--Makefile.config.in1
-rw-r--r--configure.ac8
-rw-r--r--nix.spec.in2
-rw-r--r--release.nix6
-rw-r--r--shell.nix2
-rw-r--r--src/nix/local.mk4
-rw-r--r--src/nix/repl.cc4
7 files changed, 22 insertions, 5 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index 6948dad5a..3cae30d48 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -5,6 +5,7 @@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
ENABLE_S3 = @ENABLE_S3@
HAVE_SODIUM = @HAVE_SODIUM@
+HAVE_READLINE = @HAVE_READLINE@
LIBCURL_LIBS = @LIBCURL_LIBS@
OPENSSL_LIBS = @OPENSSL_LIBS@
PACKAGE_NAME = @PACKAGE_NAME@
diff --git a/configure.ac b/configure.ac
index c7026cf95..ac37456ae 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,6 +196,14 @@ if test "$gc" = yes; then
fi
+# Check for readline, needed by "nix repl".
+AX_LIB_READLINE
+if test "$ax_cv_lib_readline" != "no"; then
+ have_readline=1
+fi
+AC_SUBST(HAVE_READLINE, [$have_readline])
+
+
AC_ARG_ENABLE(init-state, AC_HELP_STRING([--disable-init-state],
[do not initialise DB etc. in `make install']),
init_state=$enableval, init_state=yes)
diff --git a/nix.spec.in b/nix.spec.in
index 390893d64..3ba2dfc94 100644
--- a/nix.spec.in
+++ b/nix.spec.in
@@ -20,9 +20,11 @@ Requires: curl
Requires: bzip2
Requires: gzip
Requires: xz
+Requires: readline
BuildRequires: bzip2-devel
BuildRequires: sqlite-devel
BuildRequires: libcurl-devel
+BuildRequires: readline-devel
# Hack to make that shitty RPM scanning hack shut up.
Provides: perl(Nix::SSH)
diff --git a/release.nix b/release.nix
index 534c218c1..7adc87386 100644
--- a/release.nix
+++ b/release.nix
@@ -299,7 +299,7 @@ let
src = jobs.tarball;
diskImage = (diskImageFun vmTools.diskImageFuns)
{ extraPackages =
- [ "sqlite" "sqlite-devel" "bzip2-devel" "emacs" "libcurl-devel" "openssl-devel" "xz-devel" ]
+ [ "sqlite" "sqlite-devel" "bzip2-devel" "emacs" "libcurl-devel" "openssl-devel" "xz-devel" "readline-devel" ]
++ extraPackages; };
memSize = 1024;
meta.schedulingPriority = 50;
@@ -321,14 +321,14 @@ let
src = jobs.tarball;
diskImage = (diskImageFun vmTools.diskImageFuns)
{ extraPackages =
- [ "libsqlite3-dev" "libbz2-dev" "libcurl-dev" "libcurl3-nss" "libssl-dev" "liblzma-dev" ]
+ [ "libsqlite3-dev" "libbz2-dev" "libcurl-dev" "libcurl3-nss" "libssl-dev" "liblzma-dev" "libreadline-dev" ]
++ extraPackages; };
memSize = 1024;
meta.schedulingPriority = 50;
postInstall = "make installcheck";
configureFlags = "--sysconfdir=/etc";
debRequires =
- [ "curl" "libsqlite3-0" "libbz2-1.0" "bzip2" "xz-utils" "libssl1.0.0" "liblzma5" ]
+ [ "curl" "libsqlite3-0" "libbz2-1.0" "bzip2" "xz-utils" "libssl1.0.0" "liblzma5" "libreadline6" ]
++ extraDebPackages;
debMaintainer = "Eelco Dolstra <eelco.dolstra@logicblox.com>";
doInstallCheck = true;
diff --git a/shell.nix b/shell.nix
index 37a936fd2..bbce68564 100644
--- a/shell.nix
+++ b/shell.nix
@@ -35,7 +35,7 @@ with import <nixpkgs> {};
shellHook =
''
export prefix=$(pwd)/inst
- configureFlags+=" --prefix=prefix"
+ configureFlags+=" --prefix=$prefix"
PKG_CONFIG_PATH=$prefix/lib/pkgconfig:$PKG_CONFIG_PATH
PATH=$prefix/bin:$PATH
'';
diff --git a/src/nix/local.mk b/src/nix/local.mk
index 21f190e47..e71cf16fa 100644
--- a/src/nix/local.mk
+++ b/src/nix/local.mk
@@ -6,6 +6,8 @@ nix_SOURCES := $(wildcard $(d)/*.cc)
nix_LIBS = libexpr libmain libstore libutil libformat
-nix_LDFLAGS = -lreadline
+ifeq ($(HAVE_READLINE), 1)
+ nix_LDFLAGS += -lreadline
+endif
$(eval $(call install-symlink, nix, $(bindir)/nix-hash))
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index 17203d3c2..13488bf1d 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -1,3 +1,5 @@
+#if HAVE_LIBREADLINE
+
#include <iostream>
#include <cstdlib>
@@ -726,3 +728,5 @@ struct CmdRepl : StoreCommand
static RegisterCommand r1(make_ref<CmdRepl>());
}
+
+#endif