$OpenBSD: patch-gas_configure_in,v 1.13 2003/07/28 05:12:01 brad Exp $
--- gas/configure.in.orig	Wed Oct 30 12:07:32 2002
+++ gas/configure.in	Mon Jul 21 16:22:49 2003
@@ -193,7 +193,8 @@ changequote([,])dnl
       arm*-*-linux-gnu* | arm*-*-uclinux*)	
 					fmt=elf  em=linux ;;
       arm-*-netbsdelf*)                 fmt=elf  em=nbsd ;;
-      arm-*-netbsd* | arm-*-openbsd*)   fmt=aout em=nbsd ;;
+      arm-*-netbsd*)                    fmt=aout em=nbsd ;;
+      arm-*-openbsd*)                   fmt=elf  em=obsd ;;
       arm-*-oabi | thumb-*-oabi)        fmt=elf ;;
       arm-epoc-pe | thumb-epoc-pe)      fmt=coff em=epoc-pe ;;
       arm-*-wince)			fmt=coff em=wince-pe ;;
@@ -222,7 +223,7 @@ changequote([,])dnl
       hppa-*-*elf*)         fmt=elf em=hppa ;;
       hppa-*-lites*)        fmt=elf em=hppa ;;
       hppa-*-netbsd*)       fmt=elf em=nbsd ;;
-      hppa-*-openbsd*)      fmt=elf em=hppa ;;
+      hppa-*-openbsd*)      fmt=elf em=obsd ;;
       hppa-*-osf*)          fmt=som em=hppa ;;
       hppa-*-rtems*)        fmt=elf em=hppa ;;
       hppa-*-hpux11*)	    case ${cpu} in
@@ -260,7 +261,19 @@ changequote([,])dnl
 					;;
 			    esac
 			    ;;
-      i386-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes;;
+changequote(,)dnl
+      i386-*-openbsd*)	    em=obsd bfd_gas=yes
+			     case ${cpu} in
+			      x86_64)	fmt=elf ;;
+			      *) case ${os} in
+				  openbsd[0-2].* | openbsd3.[0-2])
+				     fmt=aout ;;
+				  *)
+				     fmt=elf ;;
+			       esac
+			     esac
+			    ;;
+changequote([,])dnl
       i386-*-linux*aout* | i386-*-linux*oldld)   fmt=aout em=linux ;;
       i386-*-linux*coff*)   fmt=coff em=linux ;;
       i386-*-linux-gnu*)    fmt=elf em=linux bfd_gas=yes ;;
@@ -344,7 +357,7 @@ changequote([,])dnl
       m68k-*-netbsdelf*)    fmt=elf em=nbsd bfd_gas=yes ;;
       m68k-*-netbsdaout* | m68k-*-netbsd*)
 			    fmt=aout em=nbsd bfd_gas=yes ;;
-      m68k-*-openbsd*)      fmt=aout em=nbsd bfd_gas=yes ;;
+      m68k-*-openbsd*)      fmt=aout em=obsd bfd_gas=yes ;;
       m68k-apple-aux*)      fmt=coff em=aux ;;
       m68k-*-psos*)         fmt=elf em=psos;;
 
@@ -355,7 +368,6 @@ changequote([,])dnl
       mcore-*-pe)	    fmt=coff em=pe bfd_gas=yes ;;
 
       # don't change em like *-*-bsd does
-      mips-dec-openbsd*)    fmt=elf endian=little ;;
       mips-dec-bsd*)        fmt=aout endian=little ;;
       mips-sony-bsd*)       fmt=ecoff ;;
       mips-*-bsd*)          AC_MSG_ERROR(Unknown vendor for mips-bsd configuration.) ;;
@@ -434,7 +446,6 @@ changequote([,])dnl
       sh64-*-elf*)	    fmt=elf ;;
       ns32k-pc532-mach* | ns32k-pc532-ux*)    fmt=aout em=pc532mach ;;
       ns32k-*-netbsd* | ns32k-pc532-lites*)  fmt=aout em=nbsd532 ;;
-      ns32k-pc532-openbsd*) fmt=aout em=nbsd532 ;;
 
       sparc-*-rtemsaout*)   fmt=aout ;;
       sparc-*-rtemself*)    fmt=elf ;;
@@ -458,12 +469,17 @@ changequote([,])dnl
                                 sparc64) fmt=elf ;;
                             esac
                             ;;
-      sparc-*-openbsd*)     em=nbsd
-                            case ${cpu} in
-                               sparc) fmt=aout ;;
-                               sparc64) fmt=elf ;;
-                            esac
-                            ;;
+changequote(,)dnl
+      sparc-*-openbsd*)   em=obsd bfd_gas=yes
+			     case ${os} in
+			        openbsd[0-2].* | openbsd3.[0-1])
+				   fmt=aout ;;
+			        *)
+				   fmt=elf ;;
+			     esac
+                          ;;
+changequote([,])dnl
+      sparc64-*-openbsd*) em=obsd bfd_gas=yes fmt=elf ;;
 
       strongarm-*-coff)     fmt=coff ;;
       strongarm-*-elf)      fmt=elf ;;
