From bbf2c9069b2b4b7975a2adc4c2f022510ae6afcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Tschumperl=C3=A9?= <david.tschumperle@gmail.com>
Date: Wed, 14 Nov 2018 15:25:57 +0100
Subject: [PATCH] Do not require -lpthread when compiling in minimal mode.

---
 CImg.h            | 2 +-
 examples/Makefile | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/CImg.h b/CImg.h
index 73fc3b7..469aec9 100644
--- a/CImg.h
+++ b/CImg.h
@@ -3071,7 +3071,7 @@ namespace cimg_library_suffixed {
       void lock(const unsigned int n) { WaitForSingleObject(mutex[n],INFINITE); }
       void unlock(const unsigned int n) { ReleaseMutex(mutex[n]); }
       int trylock(const unsigned int) { return 0; }
-#elif cimg_use_pthread
+#elif defined(cimg_use_pthread)
       pthread_mutex_t mutex[32];
       Mutex_info() { for (unsigned int i = 0; i<32; ++i) pthread_mutex_init(&mutex[i],0); }
       void lock(const unsigned int n) { pthread_mutex_lock(&mutex[n]); }
diff --git a/examples/Makefile b/examples/Makefile
index 556e40d..81ce750 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -84,6 +84,11 @@ EXTRA_FILES = use_tiff_stream use_jpeg_buffer
 # Set correct variables and paths
 #---------------------------------
 VERSION = $(shell grep 'cimg_version\ ' ../CImg.h | tail -c4 | head -c3)
+VERSION1 = $(shell grep 'cimg_version\ ' ../CImg.h | tail -c4 | head -c1)
+VERSION2 = $(shell grep 'cimg_version\ ' ../CImg.h | tail -c3 | head -c1)
+VERSION3 = $(shell grep 'cimg_version\ ' ../CImg.h | tail -c2 | head -c1)
+SVERSION=$(VERSION1).$(VERSION2).$(VERSION3)
+
 X11PATH = /usr/X11R6
 
 EXE_PRE =
@@ -294,7 +299,7 @@ endif
 #-------------------------
 .cpp:
 	@echo
-	@echo "** Compiling '$* ($(VERSION))' with '$(CXXVER)'"
+	@echo "** Compiling '$* ($(SVERSION))' with '$(CXXVER)'"
 	@echo
 	$(CXX) -o $(EXE_PRE)$*$(EXE_EXT) $< $(CFLAGS) $(CONF_CFLAGS) $(LIBS) $(CONF_LIBS)
 ifeq ($(STRIP_EXE),true)
@@ -302,7 +307,7 @@ ifeq ($(STRIP_EXE),true)
 endif
 menu:
 	@echo
-	@echo "CImg Library $(VERSION) : Examples"
+	@echo "CImg Library $(SVERSION) : Examples"
 	@echo "-----------------------------"
 	@echo "  > linux    : Linux/BSD target, X11 display, optimizations disabled."
 	@echo "  > dlinux   : Linux/BSD target, X11 display, debug mode."
-- 
GitLab