$NetBSD: patch-bt,v 1.2 2002/03/28 10:11:54 jmc Exp $

--- ../gcc-2.95.3/gcc/configure.in.orig 2001/04/23 11:58:07 1.1.1.2
+++ ../gcc-2.95.3/gcc/configure.in 2002/03/24 18:05:57 1.18
@@ -498,7 +498,9 @@
 	hppa*-*-*)
 		cpu_type=pa
 		;;
-	m68000-*-*)
+changequote(,)dnl
+	m680[01]0-*-*)
+changequote([,])dnl
 		cpu_type=m68k
 		;;
 	mips*-*-*)
@@ -510,6 +512,9 @@
 	pyramid-*-*)
 		cpu_type=pyr
 		;;
+	sh*-*-*)
+		cpu_type=sh
+		;;
 	sparc*-*-*)
 		cpu_type=sparc
 		;;
@@ -518,11 +523,20 @@
 	tm_file=${cpu_type}/${cpu_type}.h
 	xm_file=${cpu_type}/xm-${cpu_type}.h
 	
-	# Common parts for linux-gnu and openbsd systems
+	# Common parts for some multiplatform systems
 	case $machine in
 	*-*-linux-gnu*)
 		xm_defines="HAVE_ATEXIT POSIX BSTRING"
 		;;
+	*-*-netbsd*)
+		case $machine in
+		*-*-netbsdelf*)	tm_file=${cpu_type}/netbsd-elf.h;;
+		*)		tm_file=${cpu_type}/netbsd.h;;
+		esac
+		tmake_file="t-libc-ok t-netbsd"
+		xm_file="${xm_file} xm-netbsd.h"
+		xmake_file=none
+		;;
 	*-*-openbsd*)
 		tm_file=${cpu_type}/openbsd.h
 		tmake_file="t-libc-ok t-openbsd"
@@ -626,20 +640,15 @@
  		fi
 		;;
 	alpha*-*-netbsd*)
-		tm_file="${tm_file} alpha/elf.h alpha/netbsd.h alpha/netbsd-elf.h"
 		target_cpu_default="MASK_GAS"
-		tmake_file="alpha/t-crtbe alpha/t-ieee"
-		extra_parts="crtbegin.o crtend.o"
-		xmake_file=none
+		tmake_file="${tmake_file} alpha/t-ieee"
 		gas=yes gnu_ld=yes
 		;;
-
 	alpha*-*-openbsd*)
 		# default x-alpha is only appropriate for dec-osf.
 		target_cpu_default="MASK_GAS"
 		tmake_file="alpha/t-ieee"
 		;;
-		
 	alpha*-dec-osf*)
 		if test x$stabs = xyes
 		then
@@ -742,11 +751,12 @@
 		tm_file=arm/semiaof.h
 		tmake_file=arm/t-semiaof
 		;;
-	arm*-*-netbsd*)
-		tm_file=arm/netbsd.h
+	arm*-*-netbsdelf*)
 		xm_file="arm/xm-netbsd.h ${xm_file}"
-		tmake_file="t-netbsd arm/t-netbsd"
-       use_collect2=yes
+		gas=yes gnu_ld=yes
+		;;
+	arm*-*-netbsd*)
+		gas=yes
 		;;
 	arm*-*-linux-gnuaout*)		# ARM GNU/Linux with a.out
 		cpu_type=arm
@@ -1171,11 +1181,13 @@
 		tmake_file=t-freebsd
 		;;
 changequote(,)dnl
+	i[34567]86-*-netbsdelf*)
+changequote([,])dnl
+		gas=yes gnu_ld=yes
+		;;
+changequote(,)dnl
 	i[34567]86-*-netbsd*)
 changequote([,])dnl
-		tm_file=i386/netbsd.h
-		tmake_file=t-netbsd
-       use_collect2=yes
 		;;
 changequote(,)dnl
 	i[34567]86-*-openbsd*)
@@ -2043,12 +2055,21 @@
 		tmake_file=m68k/t-lynx
 		extra_headers=math-68881.h
 		float_format=m68k
+		;;
+	m68*-*-netbsdelf*)
+		case $machine in
+		  m68010-*)
+		    target_cpu_default="0"
+		    ;;
+		  *)
+		    target_cpu_default="MASK_68020|MASK_68881|MASK_BITFIELD"
+		    ;;
+		esac
+		float_format=m68k
+		gas=yes gnu_ld=yes
 		;;
-	m68k*-*-netbsd*)
-		tm_file=m68k/netbsd.h
-		tmake_file=t-netbsd
+	m68*-*-netbsd*)
 		float_format=m68k
-       use_collect2=yes
 		;;
 	m68k*-*-openbsd*)
 		float_format=m68k
@@ -2363,10 +2384,12 @@
 			use_collect2=yes
 	      fi
 	      ;;
-	mipsel-*-netbsd* | mips-dec-netbsd*)    # Decstation running NetBSD
-		tm_file=mips/netbsd.h
-		# On NetBSD, the headers are already okay, except for math.h.
-		tmake_file=t-netbsd
+	mipseb*-*-netbsd*)
+		tmake_file="${tmake_file} mips/t-mipseb"
+		gas=yes gnu_ld=yes
+		;;
+	mips*-*-netbsd*)
+		gas=yes gnu_ld=yes
 		;;
        mips*-*-linux*)                         # Linux MIPS, either endian.
 		xmake_file=x-linux
@@ -2724,11 +2747,6 @@
 		use_collect2=yes
 		;;
 	ns32k-*-netbsd*)
-		tm_file=ns32k/netbsd.h
-		xm_file="ns32k/xm-netbsd.h ${xm_file}"
-		# On NetBSD, the headers are already okay, except for math.h.
-		tmake_file=t-netbsd
-       use_collect2=yes
 		;;
         pdp11-*-bsd)
 		tm_file="${tm_file} pdp11/2bsd.h"
@@ -2753,6 +2771,10 @@
 	romp-*-openbsd*)
 		# Nothing special
 		;;
+	powerpc-*-netbsd*)
+		tmake_file="${tmake_file} rs6000/t-rs6000"
+		xm_file="rs6000/xm-sysv4.h xm-netbsd.h"
+		;;
 	powerpc-*-openbsd*)
 		tmake_file="${tmake_file} rs6000/t-rs6000 rs6000/t-openbsd"
 		;;
@@ -3005,6 +3027,13 @@
 		tm_file=sh/elf.h
 		float_format=sh
 		;;
+	sh-*-netbsdelf*)
+		float_format=sh
+		;;
+	shle-*-netbsdelf*)
+		tm_file="sh/netbsd-elf.h sh/netbsd-elf-little.h"
+		float_format=sh;
+		;;
 	sh-*-rtemself*)
 		tmake_file="sh/t-sh t-rtems"
 		tm_file=sh/rtemself.h
@@ -3033,10 +3062,12 @@
 		tmake_file=sparc/t-sparcbare
 		tm_file="sparc/aout.h libgloss.h"
 		;;
+	sparc-*-netbsdelf*)
+		tmake_file="${tmake_file} sparc/t-netbsd"
+		gas=yes gnu_ld=yes
+		;;
 	sparc-*-netbsd*)
-		tm_file=sparc/netbsd.h
-		tmake_file=t-netbsd
-       use_collect2=yes
+		tmake_file="${tmake_file} sparc/t-netbsd"
 		;;
 	sparc-*-openbsd*)
 		# we need collect2 until our bug is fixed...
@@ -3228,6 +3259,11 @@
 		extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o"
 		gnu_ld=yes
 		;;
+        sparc64-*-netbsd*)
+		tm_file=sparc/netbsd64.h
+		xm_file="sparc/xm-sp64.h xm-netbsd.h"
+		gas=yes gnu_ld=yes
+		;;
 # This hasn't been upgraded to GCC 2.
 #	tahoe-harris-*)			# Harris tahoe, using COFF.
 #		tm_file=tahoe/harris.h
@@ -3275,10 +3311,8 @@
 		float_format=vax
 		;;
 	vax-*-netbsd*)
-		tm_file="${tm_file} netbsd.h vax/netbsd.h"
-		tmake_file=t-netbsd
 		float_format=vax
-       use_collect2=yes
+		gas=yes gnu_ld=yes
 		;;
 	vax-*-openbsd*)
 		tmake_file="${tmake_file} vax/t-openbsd"
@@ -3569,6 +3603,12 @@
   esac
 fi
 
+case $target in
+  alpha*|sparc64*)
+    build_xm_file="${build_xm_file} xm-target64.h"
+    host_xm_file="${host_xm_file} xm-target64.h";;
+esac
+
 # Handle cpp installation.
 if test x$enable_cpp != xno
 then
@@ -3655,8 +3695,8 @@
 	/*) realsrcdir=${srcdir};;
 	*) realsrcdir=../${srcdir};;
 	esac
-	CC=${CC_FOR_BUILD} ${realsrcdir}/configure \
-		--target=$target --host=$build --build=$build
+	CC=${CC_FOR_BUILD} LIBS= ${realsrcdir}/configure \
+		--target=$target --host=$build --build=$build ||exit 1
 
 	# We just finished tests for the build machine, so rename
 	# the file auto-build.h in the gcc directory.
