$OpenBSD: patch-configure,v 1.5 2001/10/02 12:27:12 espie Exp $
--- configure.orig	Sun Jan 30 03:26:06 2000
+++ configure	Tue Oct  2 12:18:11 2001
@@ -774,9 +774,23 @@ LIBPLPLOT=""
 ### Allow the user disable support for command line editing using GNU
 ### readline.
 
-READLINE_DIR=readline
+case "$canonical_host_type" in
+    *openbsd2.[0-8])
+	READLINE_DIR=readline
+	LIBREADLINE='$(TOPDIR)/readline/libreadline.$(LIBEXT)'
+	;;
+    *openbsd*)
+	# from 2.9, we don't need to build readline.  the system readline is
+	# newer than one included here.
+	READLINE_DIR=
+	LIBREADLINE='-lreadline'
+	;;
+    *) # all the others
+	READLINE_DIR=readline
+	LIBREADLINE='$(TOPDIR)/readline/libreadline.$(LIBEXT)'
+	;;
+esac
 USE_READLINE=true
-LIBREADLINE='$(TOPDIR)/readline/libreadline.$(LIBEXT)'
 if $USE_READLINE; then
   cat >> confdefs.h <<\EOF
 #define USE_READLINE 1
@@ -2438,7 +2452,7 @@ int main ()
 }
 #if defined (sun)
 int MAIN_ () { return 0; }
-#elif defined (linux) && defined (__ELF__)
+#elif (defined (linux) && defined (__ELF__)) || defined(__OpenBSD__)
 int MAIN__ () { return 0; }
 #endif
 EOF
@@ -2707,12 +2721,11 @@ else
   { echo "configure: error: See the file INSTALL for more information." 1>&2; exit 1; }
 fi
 
-FORTRAN_MAIN_FLAG=
-case "$canonical_host_type" in
-  *-linux-*)
+  if `gcc -E -dM - < /dev/null | grep __ELF__ >/dev/null`; then
     FORTRAN_MAIN_FLAG="-u MAIN__"
-  ;;
-esac
+  else
+    FORTRAN_MAIN_FLAG=""
+  fi
 if test -n "$FORTRAN_MAIN_FLAG"; then
   echo "$ac_t""defining FORTRAN_MAIN_FLAG to be $FORTRAN_MAIN_FLAG" 1>&6
 fi
@@ -2801,10 +2814,16 @@ SH_LD="$CXX"
 SH_LDFLAGS=-shared
 RLD_FLAG=
 case "$canonical_host_type" in
-  *-*-386bsd* | *-*-openbsd* | *-*-netbsd* | *-*-freebsd*)
+  *-*-386bsd* | *-*-netbsd* | *-*-freebsd*)
     SH_LD=ld
     SH_LDFLAGS=-Bshareable
   ;;
+  *-*-openbsd*)
+    # ref.  x11/qt2
+    SH_LDFLAGS="-shared -fPIC"
+    # See Makefile for $SOREV.
+    SHLEXT=so.$SOREV
+  ;;
   alpha*-dec-osf*)
     CPICFLAG=
     CXXPICFLAG=
@@ -4004,8 +4023,11 @@ if test "$ac_cv_header_fnmatch_h" = yes 
   cat > conftest.$ac_ext <<EOF
 #line 4006 "configure"
 #include "confdefs.h"
+/* the distributed test file is bound to fail in any circumstances. */
+#include <glob.h>
+#include <fnmatch.h>
 #ifdef FNM_NOESCAPE
-     #ifdef FNM_FOOBAR_PATHNAME
+     #ifdef FNM_PATHNAME
      #ifdef FNM_PERIOD
        yes
      #endif
@@ -6233,7 +6255,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA=
 INSTALL_SCRIPT='${INSTALL}'
 
 
-if test "$cross_compiling" = yes; then
+if true; then
   GNUPLOT_BINARY=gnuplot
   echo "$ac_t""assuming $GNUPLOT_BINARY exists on $canonical_host_type host" 1>&6
   
