From 5f04af2484e66ff418356493135ec41f2a086bd5 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Thu, 29 Aug 2019 13:50:58 +0200
Subject: [PATCH] [Makefile] add -thread where needed

---
 Makefile                       | 6 ------
 share/Makefile.config.in       | 2 ++
 share/Makefile.plugin.template | 4 ++--
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index 340b7d67bad..7fbec98f070 100644
--- a/Makefile
+++ b/Makefile
@@ -1300,12 +1300,6 @@ gui: gui-$(OCAMLBEST)
 ALL_GUI_CMO= $(ALL_CMO) $(GRAPH_GUICMO) $(GUICMO)
 ALL_GUI_CMX= $(patsubst %.cma,%.cmxa,$(ALL_GUI_CMO:.cmo=.cmx))
 
-ifeq ($(LABLGTK_VERSION),3)
-THREAD=-thread
-else
-THREAD=
-endif
-
 bin/viewer.byte$(EXE): BYTE_LIBS+= $(GRAPH_GUICMO)
 bin/viewer.byte$(EXE): $(filter-out $(GRAPH_GUICMO),$(ALL_GUI_CMO)) \
 			$(GEN_BYTE_LIBS) \
diff --git a/share/Makefile.config.in b/share/Makefile.config.in
index a22fd9b13c7..ea46fb652da 100644
--- a/share/Makefile.config.in
+++ b/share/Makefile.config.in
@@ -108,9 +108,11 @@ HAS_GTKSOURCEVIEW ?=@HAS_GTKSOURCEVIEW@
 LABLGTK_VERSION ?=@LABLGTK_VERSION@
 ifeq ("$(LABLGTK_VERSION)","3")
   GTKSOURCEVIEW:=lablgtk3-sourceview3
+  THREAD:=-thread
 else
   GTKSOURCEVIEW:=\
     $(patsubst lablgtk%,$(LABLGTK).%,$(basename $(notdir @GTKSOURCEVIEW@)))
+  THREAD:=
 endif
 
 # lablgnomecanvas
diff --git a/share/Makefile.plugin.template b/share/Makefile.plugin.template
index 63edcb5cf60..72cf1127a0c 100644
--- a/share/Makefile.plugin.template
+++ b/share/Makefile.plugin.template
@@ -456,8 +456,8 @@ $(NAME_DOCFLAGS):= $(DOC_FLAGS) $(PLUGIN_DOCFLAGS) \
 			$(addprefix -package ,$(PLUGIN_REQUIRES) $(LIBRARY_NAMES))
 
 ifeq ($(HAS_GUI),yes)
-$(NAME_GUI_BFLAGS):=$($(NAME_BFLAGS)) $(addprefix -package ,$(LIBRARY_NAMES_GUI))
-$(NAME_GUI_OFLAGS):=$($(NAME_OFLAGS)) $(addprefix -package ,$(LIBRARY_NAMES_GUI))
+$(NAME_GUI_BFLAGS):=$($(NAME_BFLAGS)) $(THREAD) $(addprefix -package ,$(LIBRARY_NAMES_GUI))
+$(NAME_GUI_OFLAGS):=$($(NAME_OFLAGS)) $(THREAD) $(addprefix -package ,$(LIBRARY_NAMES_GUI))
 $(TARGET_GUI_BFLAGS):= $(PLUGIN_LINK_GUI_BFLAGS)
 $(TARGET_GUI_OFLAGS):= $(PLUGIN_LINK_GUI_OFLAGS)
 $(NAME_DOCFLAGS) := $($(NAME_DOCFLAGS)) $(addprefix -package ,$(LIBRARY_NAMES_GUI))
-- 
GitLab