This is the mail archive of the libc-hacker@cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

config.sub modifications for Linux kernel version numbers



glibc will in the near future want to be able to tell the difference
between different minor versions of the Linux kernel.  (We want to
elide backward compatibility crud when configured for newer versions.)
In preparation for this I've modified config.sub so that it
understands canonical names of the form X-Y-linux2.1-gnu.  I put the
number before the -gnu prefix since it is an attribute of the kernel
proper, not the entire system.  Also, the space after -gnu is already
used for C library versioning.

I have not modified config.guess to emit these canonical names since
it may break stuff, and I'm not certain whether the default
configuration of software that cares should be "kernel running on this
machine" rather than "support them all if you can".

If this is not the correct place to send this patch, please let me know.

zw

--- config.sub	Thu Jan 14 03:53:11 1999
+++ config.sub.new	Sat Jan 16 10:45:13 1999
@@ -66,19 +66,34 @@
 
 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
 # Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  linux-gnu*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
+basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+if [ x$basic_machine == x$1 ]
+then os= gnurev=
+else
+    os=`echo $1 | sed 's/.*-/-/'`
+    case $basic_machine in
+      *-linux*)
+	# New-style `-linux-gnu' configuration name.
+	gnurev=$os
+	os=`echo $basic_machine | sed 's/.*-/-/'`
+	basic_machine=`echo $basic_machine | sed 's/-[^-]*$//'`
+	;;
+      *)
+        # Check for old style -linuxN.N or -linuxLIBREV names.
+	os=`echo $os | sed 's!-gnu/linux!-linux!'`
+        case $os in
+	  -linux[0-9]*)
+	    # Postfix is a kernel version number.
+	    gnurev=-gnu
+	    ;;
+	  -linux*)
+	    # The postfix is the library rev (oldld/aout/libc1).
+	    gnurev=-gnu`echo $os | sed 's/-linux//'`
+	    os=-linux
+	    ;;
+	esac
+    esac
+fi
 
 ### Let's recognize common machines as not being operating systems so
 ### that things like config.sub decstation-3100 work.  We also
@@ -630,7 +645,7 @@
 # Here we handle the default manufacturer of certain CPU types.  It is in
 # some cases the only manufacturer, in others, it is the most popular.
 	mips)
-		if [ x$os = x-linux-gnu ]; then
+		if [ -n "$gnurev" ]; then
 			basic_machine=mips-unknown
 		else
 			basic_machine=mips-mips
@@ -701,9 +716,6 @@
 	-unixware*)
 		os=-sysv4.2uw
 		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-		;;
 	# First accept the basic system types.
 	# The portable systems comes first.
 	# Each alternative MUST END IN A *, to match a version number.
@@ -720,11 +732,14 @@
 	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
 	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
 	      | -cygwin32* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -uxpv*)
+	      | -mingw32* | -uxpv*)
 	# Remember, each alternative MUST END IN *, to match a version number.
 		;;
+	-linux*.*.*)
+		# Trim off the patchlevel.
+		os=`echo $os | sed 's/\.[^.]*$//'`
+		;;
 	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
 		;;
 	-sunos5*)
 		os=`echo $os | sed -e 's|sunos5|solaris2|'`
@@ -958,4 +973,4 @@
 		;;
 esac
 
-echo $basic_machine$os
+echo $basic_machine$os$gnurev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]