Subject: Proposed change to GNU config.guess
To: Tech Toolchain - NetBSD <tech-toolchain@netbsd.org>
From: Andrew Cagney <ac131313@cygnus.com>
List: tech-toolchain
Date: 12/07/1999 21:58:54
This is a multi-part message in MIME format.
--------------0066FDDF054B5209A80CA05F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hello,

	Ref: GNU config.guess and netbsd{aout,elf,}

Attatched is a patch I'm looking to submit to the autoconf group for
integration into the official GNU config.guess.  The full file is
available at:

	http://www.cygnus.com/~cagney/config.guess,netbsd-1999-12-07

This patch does three things:

	o	it consolidates all the *NetBSD* configury
		so that it appears at one point in the file.
		Ben, look Ok?

	o	For ELF targets it changes the ``guess''
		to <ARCH>-<VENDOR>-netbsdelf<VERSION>

	o	Recommends that coders using of config.guess
		match (when applicable) one or more of the
		tupples:

			*-*-netbsdelf*
			*-*-netbsdaout*
			*-*-netbsdcoff*
			*-*-netbsd*

		The short form would select the platform's
		legacy object file format.

The reasoning is somewhat pragmatic (and not what I actually expected to
be submitting :-).  Put simply:

	o	If it can determine the object file format
		that is included

	o	the ``kernel'' is omitted.  The information
		is redundant.  Besides, a tupple like
			m68k-apple-netbsd1.4.CAGNEY.GENERIC-netbsdelf1.5
		is just getting silly :-)

Assuming that no one objects to this change, I'll see about patches to
the GNU compiler and GNU debugger that allow the user to explicitly
select an object file format vis:

	--target=sparc-unknown-netbsdelf
	--target=sparc-unknown-netbsdaout

Comments?  Given that this is a policy issue, I'd like to see a comment
from NetBSD's ``core'' before proceeding.

	Andrew

PS: If people know of a reliable way of identifying either an a.out or
COFF NetBSD platform then please let me know.  I'll then revise the
patch to include that information.
--------------0066FDDF054B5209A80CA05F
Content-Type: text/plain; charset=us-ascii;
 name="diffs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="diffs"

1999-12-07  Andrew Cagney  <cagney@karybdis.cs.rmit.edu.au>
 
 	* config.guess: Rewrite NetBSD code.  return *-*-netbsdelf* for ELF
 	systems and *-*-netbsd* for all others.  Provide a guideline for how
 	to match a NetBSD tupple.
 
Index: config.guess
===================================================================
RCS file: /cvs/gdb/gdb/config.guess,v
retrieving revision 1.1.1.6
diff -p -r1.1.1.6 config.guess
*** config.guess	1999/09/28 21:51:48	1.1.1.6
--- config.guess	1999/12/07 10:28:30
*************** trap 'rm -f $dummy.c $dummy.o $dummy; ex
*** 68,73 ****
--- 68,110 ----
  # Note: order is significant - the case branches are not exclusive.
  
  case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+     *:NetBSD:*:*)
+ 	# Netbsd (nbsd) targets should (where applicable) match one or
+ 	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ 	# *-*-netbsdcoff* and *-*-netbsd*.  For targets that recently
+ 	# switched to ELF, *-*-netbsd* would select select the old
+ 	# object file format.  This provides both forward
+ 	# compatibility and a consistent mechanism for selecting the
+ 	# object file format.
+ 	# Determine the machine/vendor (is the vendor relevant).
+ 	case "${UNAME_MACHINE}" in
+ 	    amiga) machine=m68k-cbm ;;
+ 	    arm32) machine=arm-unknown ;;
+ 	    atari*) machine=m68k-atari ;;
+ 	    sun3*) machine=m68k-sun ;;
+ 	    mac68k) machine=m68k-apple ;;
+ 	    macppc) machine=powerpc-apple ;;
+ 	    hp3[0-9][05]) machine=m68k-hp ;;
+ 	    ibmrt|romp-ibm) machine=romp-ibm ;;
+ 	    *) machine=${UNAME_MACHINE}-unknown ;;
+ 	esac
+ 	# The Operating System including object format.
+ 	if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ 		| grep __ELF__ >/dev/null
+ 	then
+ 	    # Could be a.out (netbsdaout) or COFF (netbsdcoff).
+ 	    # Return netbsd for either.  FIX?
+ 	    os=netbsd
+ 	else
+ 	    os=netbsdelf
+ 	fi
+ 	# The OS release
+ 	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ 	# contains redundant information, the shorter form:
+ 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ 	echo "${machine}-${os}${release}"
+ 	exit 0 ;;
      alpha:OSF1:*:*)
  	if test $UNAME_RELEASE = "V4.0"; then
  		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
*************** EOF
*** 129,137 ****
      Amiga*:UNIX_System_V:4.0:*)
  	echo m68k-cbm-sysv4
  	exit 0;;
-     amiga:NetBSD:*:*)
-       echo m68k-cbm-netbsd${UNAME_RELEASE}
-       exit 0 ;;
      amiga:OpenBSD:*:*)
  	echo m68k-unknown-openbsd${UNAME_RELEASE}
  	exit 0 ;;
--- 166,171 ----
*************** EOF
*** 162,170 ****
      arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
  	echo arm-acorn-riscix${UNAME_RELEASE}
  	exit 0;;
-     arm32:NetBSD:*:*)
- 	echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- 	exit 0 ;;
      SR2?01:HI-UX/MPP:*:*)
  	echo hppa1.1-hitachi-hiuxmpp
  	exit 0;;
--- 196,201 ----
*************** EOF
*** 221,229 ****
      aushp:SunOS:*:*)
  	echo sparc-auspex-sunos${UNAME_RELEASE}
  	exit 0 ;;
-     atari*:NetBSD:*:*)
- 	echo m68k-atari-netbsd${UNAME_RELEASE}
- 	exit 0 ;;
      atari*:OpenBSD:*:*)
  	echo m68k-unknown-openbsd${UNAME_RELEASE}
  	exit 0 ;;
--- 252,257 ----
*************** EOF
*** 253,267 ****
      *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
          echo m68k-unknown-mint${UNAME_RELEASE}
          exit 0 ;;
-     sun3*:NetBSD:*:*)
- 	echo m68k-sun-netbsd${UNAME_RELEASE}
- 	exit 0 ;;
      sun3*:OpenBSD:*:*)
  	echo m68k-unknown-openbsd${UNAME_RELEASE}
  	exit 0 ;;
-     mac68k:NetBSD:*:*)
- 	echo m68k-apple-netbsd${UNAME_RELEASE}
- 	exit 0 ;;
      mac68k:OpenBSD:*:*)
  	echo m68k-unknown-openbsd${UNAME_RELEASE}
  	exit 0 ;;
--- 281,289 ----
*************** EOF
*** 274,282 ****
      powerpc:machten:*:*)
  	echo powerpc-apple-machten${UNAME_RELEASE}
  	exit 0 ;;
-     macppc:NetBSD:*:*)
-         echo powerpc-apple-netbsd${UNAME_RELEASE}
-         exit 0 ;;
      RISC*:Mach:*:*)
  	echo mips-dec-mach_bsd4.3
  	exit 0 ;;
--- 296,301 ----
*************** EOF
*** 405,411 ****
      ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  	echo romp-ibm-bsd4.4
  	exit 0 ;;
!     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC NetBSD and
  	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
  	exit 0 ;;                           # report: romp-ibm BSD 4.3
      *:BOSX:*:*)
--- 424,430 ----
      ibmrt:4.4BSD:*|romp-ibm:BSD:*)
  	echo romp-ibm-bsd4.4
  	exit 0 ;;
!     ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
  	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
  	exit 0 ;;                           # report: romp-ibm BSD 4.3
      *:BOSX:*:*)
*************** EOF
*** 566,574 ****
      F301:UNIX_System_V:*:*)
         echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
         exit 0 ;;
-     hp3[0-9][05]:NetBSD:*:*)
- 	echo m68k-hp-netbsd${UNAME_RELEASE}
- 	exit 0 ;;
      hp300:OpenBSD:*:*)
  	echo m68k-unknown-openbsd${UNAME_RELEASE}
  	exit 0 ;;
--- 585,590 ----
*************** EOF
*** 589,597 ****
  	    fi
  	fi
  	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- 	exit 0 ;;
-     *:NetBSD:*:*)
- 	echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
  	exit 0 ;;
      *:OpenBSD:*:*)
  	echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
--- 605,610 ----

--------------0066FDDF054B5209A80CA05F--