$OpenBSD: patch-configure_in,v 1.3 2002/05/12 19:32:41 matt Exp $

        This has been submitted to the Python team as part of patch
        554718.

--- configure.in.orig	Thu Dec 27 16:55:46 2001
+++ configure.in	Mon Jan 14 12:15:41 2002
@@ -614,7 +614,20 @@ then
 	Linux*) LDSHARED="gcc -shared";;
 	dgux*) LDSHARED="ld -G";;
 	BSD/OS*/4*) LDSHARED="gcc -shared";;
-	OpenBSD*) LDSHARED="ld -Bshareable";;
+	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*)
 		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
 		then
@@ -657,8 +670,7 @@ then
 		 fi;;
 	Linux*) CCSHARED="-fPIC";;
 	BSD/OS*/4*) CCSHARED="-fpic";;
-	OpenBSD*) CCSHARED="-fpic";;
-	FreeBSD*|NetBSD*) CCSHARED="-fPIC";;
+	FreeBSD*|NetBSD*|OpenBSD*) CCSHARED="-fPIC";;
 	UnixWare*)
 		if test "$GCC" = "yes"
 		then CCSHARED="-fPIC"
@@ -696,7 +708,7 @@ then
 	UnixWare*) LINKFORSHARED="-dy -Bdynamic -Wl,-Bexport";;
 	SCO_SV*) LINKFORSHARED="-Bdynamic -dy -Wl,-Bexport";;
 	ReliantUNIX*) LINKFORSHARED="-W1 -Blargedynsym";;
-	FreeBSD*|NetBSD*) 
+	FreeBSD*|NetBSD*|OpenBSD*) 
 		if [[ "`$CC -dM -E - </dev/null | grep __ELF__`" != "" ]]
 		then
 			LINKFORSHARED="-Wl,--export-dynamic"
@@ -828,15 +840,29 @@ if test "$with_threads" = "no"
 then
     USE_THREAD_MODULE="#"
 else
+    have_threads=no
     if test "$ac_sys_system" = "UnixWare"
      then
+	have_threads=yes
 	CC="${CC} -Kthread"
 	LIBOBJS="$LIBOBJS thread.o"
 	AC_DEFINE(WITH_THREAD)
 	AC_DEFINE(_POSIX_THREADS)
 	posix_threads=yes
 	USE_THREAD_MODULE=""
-    else
+    fi
+    if test "$have_threads" = "no" -a "$ac_sys_system" = "OpenBSD"
+     then
+	have_threads=yes
+	LIBS="-pthread $LIBS"
+	LIBOBJS="$LIBOBJS thread.o"
+	AC_DEFINE(WITH_THREAD)
+	AC_DEFINE(_REENTRANT)
+	AC_DEFINE(_POSIX_THREADS)
+	USE_THREAD_MODULE=""
+    fi
+    if test "$have_threads" = "no"
+     then
 	if test ! -z "$with_threads" -a -d "$with_threads"
 	then LDFLAGS="$LDFLAGS -L$with_threads"
 	fi
