summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--src/libstore/build.cc5
2 files changed, 2 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 7b8c36f1e8..d5e858123e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,6 +90,7 @@ AC_LANG_POP(C++)
 
 # Check for chroot support (requires chroot() and bind mounts).
 AC_CHECK_FUNCS([chroot])
+AC_CHECK_FUNCS([unshare])
 AC_CHECK_HEADERS([sched.h], [], [], [])
 AC_CHECK_HEADERS([sys/param.h], [], [], [])
 AC_CHECK_HEADERS([sys/mount.h], [], [],
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index d4c5b81d3f..8d06a66f60 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -34,13 +34,10 @@
 #include <sys/mount.h>
 #endif
 #if HAVE_SCHED_H
-#if !defined _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
 #include <sched.h>
 #endif
 
-#define CHROOT_ENABLED HAVE_CHROOT && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(CLONE_NEWNS)
+#define CHROOT_ENABLED HAVE_CHROOT && HAVE_UNSHARE && HAVE_SYS_MOUNT_H && defined(MS_BIND) && defined(CLONE_NEWNS)
 
 
 namespace nix {