From patchwork Wed Jan 27 20:13:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Eduardo Seo X-Patchwork-Id: 10641 X-Patchwork-Delegate: schwab@linux-m68k.org Received: (qmail 105222 invoked by alias); 27 Jan 2016 20:14:01 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 105207 invoked by uid 89); 27 Jan 2016 20:14:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=seo, Automatic, eduardo, Eduardo X-HELO: e24smtp04.br.ibm.com X-IBM-Helo: d24dlp02.br.ibm.com X-IBM-MailFrom: cseo@linux.vnet.ibm.com X-IBM-RcptTo: libc-alpha@sourceware.org Subject: Re: [PATCH] powerpc: Automatically guess --with-cpu value To: Andreas Schwab References: <56577683.3000206@linux.vnet.ibm.com> <87zix2302z.fsf@totoro.br.ibm.com> <5679E63E.8070101@linux.vnet.ibm.com> <877fk4ug09.fsf@totoro.br.ibm.com> <568D718E.70209@linux.vnet.ibm.com> <8760z6l8bf.fsf@igel.home> <568EC0F6.9060902@linux.vnet.ibm.com> <87d1tbn7hp.fsf@igel.home> <569D1203.10106@linux.vnet.ibm.com> <87fuxudbzm.fsf@igel.home> Cc: Tulio Magno Quites Machado Filho , GLIBC From: Carlos Eduardo Seo Message-ID: <56A924FC.2000802@linux.vnet.ibm.com> Date: Wed, 27 Jan 2016 18:13:48 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <87fuxudbzm.fsf@igel.home> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16012720-0029-0000-0000-0000059059D7 On 1/18/16 3:38 PM, Andreas Schwab wrote: > > Your sort key isn't numeric. No, but 'sort' will ignore the text prefix and produce the desired result nevertheless. Anyway, I'll just remove -n option. It is not necessary. diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure index 0c6fdde..da3a5ce 100644 --- a/sysdeps/powerpc/preconfigure +++ b/sysdeps/powerpc/preconfigure @@ -15,3 +15,35 @@ powerpc*) rm -f conftest.i ;; esac + +# Lets ask the compiler which Power processor we've got, in case the user did +# not choose a --with-cpu value. +# Note if you add patterns here you must ensure that an appropriate directory +# exists in sysdeps/powerpc +if test -z "$with_cpu"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: --with-cpu not set. Trying to detect CPU." >&5 + $as_echo "$as_me: --with-cpu not set. Trying to detect CPU." >&6;} + archcpu=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | + sed -n 's/^#define \(_ARCH_PWR[0-9].*\) .*$/\1/p' | + sort -r | head -n 1` + +# Set --with-cpu as appropriate. + case "$archcpu" in + _ARCH_PWR5X) + submachine="power5+" + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5 + $as_echo "$as_me: CPU identified as $submachine" >&6;} + ;; + _ARCH_PWR*) + submachine=`echo $archcpu | sed "s/_ARCH_PWR/power/" | + tr '[:upper:]' '[:lower:]'` + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU identified as $submachine" >&5 + $as_echo "$as_me: CPU identified as $submachine" >&6;} + ;; + *) + submachine="" + { $as_echo "$as_me:${as_lineno-$LINENO}: CPU not identified; using default" >&5 + $as_echo "$as_me: CPU not identified; using default" >&6;} + ;; + esac +fi