PATCH: Handle Linux/mips (Re: Why is byteorder removed from /proc/cpuinfo?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 06, 2001 at 03:57:24PM -0200, Ralf Baechle wrote:
> On Thu, Dec 06, 2001 at 09:35:06AM -0800, H . J . Lu wrote:
> 
> > The byteorder field is emoved from /proc/cpuinfo in the current 2.4
> > kernel in CVS. It breaks config.guess used by all the GNU softwares.
> 
> Grrr...  In the past config.guess used gcc to compile a test program using
> gcc.  I told sometime ago to whoever it was that I'm going to remove
> all non-cpu related information (endianess should be considered per
> _thread_ on MIPS!) from /proc/cpuinfo where it has no business; the /proc
> rewrite in 2.4.15 more or less forced me into this.
> 

How about this patch?


H.J.
---
2001-12-06  H.J. Lu  (hjl@gnu.org)

	* config.guess: Properly handle Linux/mips.

--- config.guess.mips	Mon Nov  5 08:09:32 2001
+++ config.guess	Thu Dec  6 10:31:40 2001
@@ -767,10 +767,21 @@ EOF
 	echo ${UNAME_MACHINE}-unknown-linux-gnu
 	exit 0 ;;
     mips:Linux:*:*)
-	case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in
-	  big)    echo mips-unknown-linux-gnu && exit 0 ;;
-	  little) echo mipsel-unknown-linux-gnu && exit 0 ;;
-	esac
+	eval $set_cc_for_build
+	cat >$dummy.c <<EOF
+#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+cpu=mipsel
+#endif
+#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+cpu=mips
+#endif
+EOF
+	cpu=
+	eval `$CC_FOR_BUILD -E $dummy.c | grep cpu=`;
+	rm -f $dummy.c
+	if test -n "$cpu"; then
+	  echo $cpu-unknown-linux-gnu && exit 0
+	fi
 	;;
     ppc:Linux:*:*)
 	echo powerpc-unknown-linux-gnu

[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux