[uClibc] gcc-3.3.2 building problem

Rob Landley rob at landley.net
Sun Jan 25 15:59:01 UTC 2004


On Saturday 24 January 2004 13:57, Manuel Novoa III wrote:

> > I have thought it is done by the gcc-uclibc-* patches? I have checked
> > again, but only binutils-uclibc-* patches do it, the gcc ones not. So I
> > have replaced all config.sub and config.guess with those from
> > newest automake (supports linux-uclibc*) and it does not work either.
>
> There is no version of config.guess that I know of which addresses
> native uClibc systems.  I do not modifiy it in my patches either,
> since there still needs to be discussion about including some type
> of uClibc configuration-identifying suffix in the result.

I whipped up a sample patch to let gcc's config.guess know about uclibc,
if somebody was curious as to what was involved.  The technique is fairly
simple.  What exactly we want in the resulting string is still undecided,
and probably won't be much before uclibc is ready to ship a 1.0.

This particular patch makes the fourth tuple (currently hardwared as "-gnu"
on any linux system) into ${LIBC}, and sets LIBC to uclibc if the file
/usr/include/bits/uClibc_config.h exists.  It also grabs the major, minor,
and sublevel information out of that file and appends it, and appends the
letter "t" if there's no thread support and "i" if it doesn't have full
internationalization support.

So the mechanism's easy enough, if we can just figure out what the
output should look like. :)

Rob

--- config.guess.bak	2004-01-09 08:14:40.000000000 -0600
+++ config.guess	2004-01-09 19:31:15.914199808 -0600
@@ -135,6 +135,30 @@
 UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
 
+# Detect uclibc systems.
+
+LIBC="gnu"
+if [ -f /usr/include/bits/uClibc_config.h ]
+then
+	LIBC="uclibc"
+	UCLIBC_MAJOR=`sed -n "/#define __UCLIBC_MAJOR__ /s///p" usr/include/bits/uClibc_config.h`
+	UCLIBC_MINOR=`sed -n "/#define __UCLIBC_MINOR__ /s///p" usr/include/bits/uClibc_config.h`
+	UCLIBC_SUBLEVEL=`sed -n "/#define __UCLIBC_SUBLEVEL__ /s///p" usr/include/bits/uClibc_config.h`
+	if [ $UCLIBC_MAJOR = "0" ]
+	then
+		UCLIBC_MAJOR="$UCLIBC_MAJOR.$UCLIBC_MINOR.$UCLIBC_SUBLEVEL"
+	fi
+	if [[ -z `grep "#define __UCLIBC_HAS_THREADS__" usr/include/bits/uClibc_config.h` ]]
+	then
+		UCLIBC_MAJOR="$UCLIBC_MAJOR"t
+	fi
+	if [[ -z `grep "#define __UCLIBC_HAS_LOCALE__" usr/include/bits/uClibc_config.h` ]]
+	then
+		UCLIBC_MAJOR="$UCLIBC_MAJOR"i
+	fi
+	LIBC=$LIBC$UCLIBC_MAJOR
+fi
+
 # Note: order is significant - the case branches are not exclusive.
 
 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@@ -798,13 +822,13 @@
 	echo ${UNAME_MACHINE}-pc-minix
 	exit 0 ;;
     arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit 0 ;;
     ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit 0 ;;
     m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit 0 ;;
     mips:Linux:*:*)
 	eval $set_cc_for_build
@@ -823,7 +847,7 @@
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-${LIBC}" && exit 0
 	;;
     mips64:Linux:*:*)
 	eval $set_cc_for_build
@@ -842,13 +866,13 @@
 	#endif
 EOF
 	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-	test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0
+	test x"${CPU}" != x && echo "${CPU}-unknown-linux-${LIBC}" && exit 0
 	;;
     ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
+	echo powerpc-unknown-linux-${LIBC}
 	exit 0 ;;
     ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
+	echo powerpc64-unknown-linux-${LIBC}
 	exit 0 ;;
     alpha:Linux:*:*)
 	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@@ -861,31 +885,31 @@
 	  EV68*) UNAME_MACHINE=alphaev68 ;;
         esac
 	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit 0 ;;
     parisc:Linux:*:* | hppa:Linux:*:*)
 	# Look for CPU level
 	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
-	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
-	  *)    echo hppa-unknown-linux-gnu ;;
+	  PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
+	  PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
+	  *)    echo hppa-unknown-linux-${LIBC} ;;
 	esac
 	exit 0 ;;
     parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
+	echo hppa64-unknown-linux-${LIBC}
 	exit 0 ;;
     s390:Linux:*:* | s390x:Linux:*:*)
 	echo ${UNAME_MACHINE}-ibm-linux
 	exit 0 ;;
     sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit 0 ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit 0 ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	echo x86_64-unknown-linux-${LIBC}
 	exit 0 ;;
     i*86:Linux:*:*)
 	# The BFD linker knows what the default object file format is, so
@@ -900,20 +924,21 @@
 				    p'`
         case "$ld_supported_targets" in
 	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-${LIBC}"
 		;;
 	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}aout"
 		exit 0 ;;
 	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}coff"
 		exit 0 ;;
 	  "")
 		# Either a pre-BFD a.out linker (linux-gnuoldld) or
 		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}oldld"
 		exit 0 ;;
 	esac
+	if [ $LIBC != "gnu" ];then echo "$TENTATIVE" && exit 0; fi
 	# Determine whether the default compiler is a.out or elf
 	eval $set_cc_for_build
 	sed 's/^	//' << EOF >$dummy.c




More information about the uClibc mailing list