From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27205 invoked by alias); 8 Mar 2013 22:52:01 -0000 Received: (qmail 27194 invoked by uid 22791); 8 Mar 2013 22:52:00 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from toast.topped-with-meat.com (HELO topped-with-meat.com) (204.197.218.159) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Mar 2013 22:51:50 +0000 Received: by topped-with-meat.com (Postfix, from userid 5281) id D30512C053; Fri, 8 Mar 2013 14:51:49 -0800 (PST) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit From: Roland McGrath To: libc-ports@sourceware.org Subject: [PATCH roland/arm-preconfigure] Clean up ARM preconfigure. Message-Id: <20130308225149.D30512C053@topped-with-meat.com> Date: Fri, 08 Mar 2013 22:52:00 -0000 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=LYSvtFvi c=1 sm=1 tr=0 a=WkljmVdYkabdwxfqvArNOQ==:117 a=14OXPxybAAAA:8 a=_xR0Xv6WQj4A:10 a=Z6MIti7PxpgA:10 a=kj9zAlcOel0A:10 a=hOe2yjtxAAAA:8 a=0dtSsSmUar8A:10 a=XZGvVVuE0iF-s1NLWpMA:9 a=CjuIK1q_8ugA:10 X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2013-03/txt/msg00071.txt.bz2 There are multiple problems with the ARM preconfigure script. 1. It uses "echo" and "exit" rather than proper friendly Autoconf methods for emitting messages and diagnosing errors. 2. Its indentation does not meet our standards for shell script fragments. 3. The submachine selection logic is only performed for arm*-*-linux-gnueabi* configurations, though it has nothing whatsoever to do with Linux. 4. The CFLAGS tweak is highly suspect. This fixes the first three of those things. The CFLAGS tweak at the very least needs a comment explaining what it's there for, and why it is being done at configure time instead of just adding to sysdep-CFLAGS in sysdeps/arm/Makefile or something like that. But I have no idea what those rationales are, so I can't help there. Thanks, Roland ports/ChangeLog.arm 2013-03-08 Roland McGrath * sysdeps/arm/preconfigure.in: New file. * sysdeps/arm/preconfigure: Replaced with generated file. --- a/ports/sysdeps/arm/preconfigure +++ b/ports/sysdeps/arm/preconfigure @@ -1,53 +1,58 @@ +# This file is generated from configure.in by Autoconf. DO NOT EDIT! + # Local preconfigure fragment for sysdeps/arm + case "$machine" in arm*) - base_machine=arm - case $config_os in - linux-gnueabi*) - # Lets ask the compiler which ARM family we've got - # Unfortunately it doesn't define any flags for implementations - # that you might pass to -mcpu or -mtune - # Note if you add patterns here you must ensure that - # an appropriate directory exists in sysdeps/arm - archcppflag=`echo "" | - $CC $CFLAGS $CPPFLAGS -E -dM - | - grep '__ARM_ARCH_[0-9].*__' | - sed -e 's/^#define //' -e 's/ .*//'` + case $config_os in + linux-gnueabi*) + if "${CFLAGS+set}" != "set" ; then + CFLAGS="-g -O2" + fi + CFLAGS="$CFLAGS -fno-unwind-tables" + ;; + linux*) + as_fn_error $? "Old ABI no longer supported" "$LINENO" 5 + ;; + esac + + base_machine=arm + # Lets ask the compiler which ARM family we've got + # Unfortunately it doesn't define any flags for implementations + # that you might pass to -mcpu or -mtune + # Note if you add patterns here you must ensure that + # an appropriate directory exists in sysdeps/arm + archcppflag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define \(__ARM_ARCH_[0-9].*__\) .*$/\1/p'` - case x$archcppflag in - x__ARM_ARCH_[89]*__) - machine=armv7 - echo "Found compiler is configured for something newer than v7 - using v7" - ;; + case "x$archcppflag" in + x__ARM_ARCH_89*__) + machine=armv7 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found compiler is configured for something newer than v7 - using v7" >&5 +$as_echo "$as_me: Found compiler is configured for something newer than v7 - using v7" >&6;} + ;; - x__ARM_ARCH_7A__) - machine=armv7 - echo "Found compiler is configured for $machine" - ;; + x__ARM_ARCH_7A__) + machine=armv7 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found compiler is configured for $machine" >&5 +$as_echo "$as_me: Found compiler is configured for $machine" >&6;} + ;; - x__ARM_ARCH_6T2__) - machine=armv6t2 - echo "Found compiler is configured for $machine" - ;; - x__ARM_ARCH_6*__) - machine=armv6 - echo "Found compiler is configured for $machine" - ;; - *) - machine=arm - echo 2>&1 "arm/preconfigure: Did not find ARM architecture type; using default" - ;; - esac + x__ARM_ARCH_6T2__) + machine=armv6t2 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found compiler is configured for $machine" >&5 +$as_echo "$as_me: Found compiler is configured for $machine" >&6;} + ;; + x__ARM_ARCH_6*__) + machine=armv6 + { $as_echo "$as_me:${as_lineno-$LINENO}: Found compiler is configured for $machine" >&5 +$as_echo "$as_me: Found compiler is configured for $machine" >&6;} + ;; + *) + machine=arm + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: arm/preconfigure: Did not find ARM architecture type; using default" >&5 +$as_echo "$as_me: WARNING: arm/preconfigure: Did not find ARM architecture type; using default" >&2;} + ;; + esac - machine=arm/$machine - if [ "${CFLAGS+set}" != "set" ]; then - CFLAGS="-g -O2" - fi - CFLAGS="$CFLAGS -fno-unwind-tables" - ;; - linux*) - echo "Old ABI no longer supported" 2>&1 - exit 1 - ;; - esac - ;; + machine=arm/$machine esac --- /dev/null +++ b/ports/sysdeps/arm/preconfigure.in @@ -0,0 +1,53 @@ +GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory. +# Local preconfigure fragment for sysdeps/arm + +case "$machine" in +arm*) + case $config_os in + linux-gnueabi*) + if [ "${CFLAGS+set}" != "set" ]; then + CFLAGS="-g -O2" + fi + CFLAGS="$CFLAGS -fno-unwind-tables" + ;; + linux*) + AC_MSG_ERROR([Old ABI no longer supported]) + ;; + esac + + base_machine=arm + # Lets ask the compiler which ARM family we've got + # Unfortunately it doesn't define any flags for implementations + # that you might pass to -mcpu or -mtune + # Note if you add patterns here you must ensure that + # an appropriate directory exists in sysdeps/arm + archcppflag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define \(__ARM_ARCH_[0-9].*__\) .*$/\1/p'` + + case "x$archcppflag" in + x__ARM_ARCH_[89]*__) + machine=armv7 + AC_MSG_NOTICE([Found compiler is configured for something newer than v7 - using v7]) + ;; + + x__ARM_ARCH_7A__) + machine=armv7 + AC_MSG_NOTICE([Found compiler is configured for $machine]) + ;; + + x__ARM_ARCH_6T2__) + machine=armv6t2 + AC_MSG_NOTICE([Found compiler is configured for $machine]) + ;; + x__ARM_ARCH_6*__) + machine=armv6 + AC_MSG_NOTICE([Found compiler is configured for $machine]) + ;; + *) + machine=arm + AC_MSG_WARN([arm/preconfigure: Did not find ARM architecture type; using default]) + ;; + esac + + machine=arm/$machine +esac