From 3f7e23cf08560facf861e1773390d4f5b67d39cc Mon Sep 17 00:00:00 2001
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Date: Mon, 19 Aug 2019 22:45:22 +0200
Subject: Make using pthread optional

Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
---
 configure.ac | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index a13a64c..cc938dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,11 @@ AC_ARG_WITH([selinux],
 			[Build with SELinux label file support])],
 	[want_selinux="${withval}"], [want_selinux="maybe"])
 
+AC_ARG_WITH([pthread],
+	[AS_HELP_STRING([--without-pthread],
+			[Build without pthread based block compressor])],
+	[want_pthread="${withval}"], [want_pthread="yes"])
+
 ##### search for dependencies #####
 
 AM_CONDITIONAL([WITH_GZIP], [true])
@@ -133,9 +138,11 @@ yes) AM_COND_IF([WITH_SELINUX], [], [AC_MSG_ERROR([cannot find selinux])]) ;;
 no)  AM_CONDITIONAL([WITH_SELINUX], [false]) ;;
 esac
 
-have_pthread="no"
-AX_PTHREAD([have_pthread="yes"], [])
-AM_CONDITIONAL([HAVE_PTHREAD], [test "x$have_pthread" != "xno"])
+AM_CONDITIONAL([HAVE_PTHREAD], [false])
+if test "x$want_pthread" = "xyes"; then
+	AX_PTHREAD([AM_CONDITIONAL([HAVE_PTHREAD], [true])],
+		   [AC_MSG_ERROR([cannot find pthread])])
+fi
 
 ##### additional checks #####
 AX_COMPILE_CHECK_SIZEOF(time_t)
-- 
cgit v1.2.3