$OpenBSD: patch-configure_in,v 1.8 2006/01/22 11:33:32 alek Exp $
--- configure.in.orig	Fri May  7 21:13:47 2004
+++ configure.in	Wed Aug 11 09:55:49 2004
@@ -136,7 +136,7 @@ case $ac_sys_system/$ac_sys_release in
   # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined,
   # even though select is a POSIX function. Reported by J. Ribbens.
   # Reconfirmed for OpenBSD 3.3 by Zachary Hamm, for 3.4 by Jason Ish.
-  OpenBSD/2.* | OpenBSD/3.@<:@01234@:>@) 
+  OpenBSD/2.* | OpenBSD/3.@<:@0123456789@:>@) 
     define_xopen_source=no;;
   # On Solaris 2.6, sys/wait.h is inconsistent in the usage
   # of union __?sigval. Reported by Stuart Bishop.
@@ -1280,14 +1280,28 @@ then
 	Linux*|GNU*) LDSHARED='$(CC) -shared';;
 	dgux*) LDSHARED="ld -G";;
 	BSD/OS*/4*) LDSHARED="gcc -shared";;
-	OpenBSD*|FreeBSD*)
+	FreeBSD*)
 		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
 		then
 			LDSHARED="cc -shared ${LDFLAGS}"
 		else
 			LDSHARED="ld -Bshareable ${LDFLAGS}"
 		fi;;
-	NetBSD*) LDSHARED="cc -shared ${LDFLAGS}";;
+	OpenBSD*)
+		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
+		then
+			LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
+		else
+			case `uname -r` in
+			[[01]].* | 2.[[0-7]] | 2.[[0-7]].*)
+			   LDSHARED="ld -Bshareable ${LDFLAGS}"
+			   ;;
+			*)
+			   LDSHARED='$(CC) -shared $(CCSHARED) ${LDFLAGS}'
+			   ;;
+			esac
+		fi;;
+	NetBSD*) LDSHARED="${CC} -shared ${LDFLAGS}";;
 	OpenUNIX*|UnixWare*)
 		if test "$GCC" = "yes"
 		then LDSHARED='$(CC) -shared'
@@ -1424,9 +1438,10 @@ AC_CHECK_LIB(dld, shl_load)	# Dynamic li
 
 # only check for sem_ini if thread support is requested
 if test "$with_threads" = "yes" -o -z "$with_threads"; then
-    AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
+#    AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
 						# posix4 on Solaris 2.6
 						# pthread (first!) on Linux
+    LIBS="-pthread ${LIBS}"
 fi
 
 # check if we need libintl for locale functions
