From dd64637baf5614686dbe544352d62c59ac5cb779 Mon Sep 17 00:00:00 2001
From: Joe Marcus Clarke <marcus@FreeBSD.org>
Date: Fri, 6 Feb 2004 17:34:48 +0000
Subject: Do the same PTHREAD_{CFLAGS,LIBS} magic here so that the installed
 FreeBSD.cf includes the correct settings.

Reported by:	Stefan Farfeleder <stefan@fafoe.narf.at>
---
 devel/imake-4/Makefile      |  6 ++++++
 devel/imake-4/files/patch-d | 35 ++++++++++++++++++++++++++++++++---
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/devel/imake-4/Makefile b/devel/imake-4/Makefile
index a7e896a090ad..dbb222eb7cfb 100644
--- a/devel/imake-4/Makefile
+++ b/devel/imake-4/Makefile
@@ -18,6 +18,7 @@ COMMENT=	Imake and other utilities from XFree86
 
 PREFIX?=	${X11BASE}
 USE_PERL5=	YES
+USE_REINPLACE=	yes
 
 .ifdef USE_IMAKE
 .error You have `USE_IMAKE' variable defined either in environment or in make(1) arguments. Please undefine and try again.
@@ -66,6 +67,11 @@ InstallXdmConfig?=	YES
 InstallXinitConfig?=	YES
 InstallAppDefFiles?=	YES
 
+pre-configure:
+	@${REINPLACE_CMD} -e 's|%%PTHREAD_CFLAGS%%|${PTHREAD_CFLAGS}|g ; \
+		s|%%PTHREAD_LIBS%%|${PTHREAD_LIBS}|g' \
+		${WRKSRC}/cf/FreeBSD.cf
+
 post-install:
 	@${MKHTMLINDEX} ${PREFIX}/lib/X11/doc/html
 
diff --git a/devel/imake-4/files/patch-d b/devel/imake-4/files/patch-d
index 3b1b280c237c..9c63e1fad9dd 100644
--- a/devel/imake-4/files/patch-d
+++ b/devel/imake-4/files/patch-d
@@ -1,6 +1,35 @@
---- cf/FreeBSD.cf.orig	Fri May  4 05:12:35 2001
-+++ cf/FreeBSD.cf	Mon Jun  4 19:31:27 2001
-@@ -444,14 +444,14 @@
+--- cf/FreeBSD.cf.orig	Tue Jan 14 21:52:12 2003
++++ cf/FreeBSD.cf	Fri Feb  6 12:27:55 2004
+@@ -89,14 +89,14 @@
+ # endif
+ # define HasPosixThreads	YES
+ # define ThreadedX		YES
+-# define SystemMTDefines	-D_REENTRANT -D_THREAD_SAFE
++# define SystemMTDefines	%%PTHREAD_CFLAGS%%
+ /*
+  * FreeBSD has tread-safe api but no getpwnam_r yet.
+  */
+ # define HasThreadSafeAPI	YES
+ # define MTSafeAPIDefines	-DXUSE_MTSAFE_API -DXNO_MTSAFE_PWDAPI
+ # if HasLibPthread
+-#  define ThreadsLibraries	-lpthread
++#  define ThreadsLibraries	%%PTHREAD_LIBS%%
+ # else
+ #  if OSRelVersion >= 500043
+ #   define BuildThreadStubLibrary  NO
+@@ -106,9 +106,9 @@
+ #   define NeedUIThrStubs          YES
+ #  endif
+ #  if (OSRelVersion >= 500016)
+-#   define ThreadsLibraries	-lc_r
++#   define ThreadsLibraries	%%PTHREAD_LIBS%%
+ #  else
+-#   define ThreadsLibraries	-pthread
++#   define ThreadsLibraries	%%PTHREAD_LIBS%%
+ #  endif
+ #  define SharedX11Reqs		$(LDPRELIB) $(XTHRSTUBLIB)
+ #  define SharedXtReqs		$(LDPRELIB) $(XLIBONLY) $(SMLIB) $(ICELIB) $(XTHRSTUBLIB)
+@@ -485,14 +485,14 @@
  /* The GCC strength-reduce bug is fixed for FreeBSD 2.1.5 and later */
  #ifndef DefaultGcc2i386Opt
  #if OSMajorVersion > 2 || (OSMajorVersion == 2 && OSMinorVersion > 1) || (OSMajorVersion == 2 && OSMinorVersion == 1 && OSTeenyVersion >= 5)
-- 
cgit debian/1.2.3+git2.25.1-1-2-gaceb0