From patchwork Thu Jan 7 19:48:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cseo X-Patchwork-Id: 564409 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 870C81402F0 for ; Fri, 8 Jan 2016 06:48:23 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=WPJfBCXZ; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=beI9 +zDbFlUMMiN7pA0mBBNZz5PG6APvJRC9Me3ih30Z9XONMOqDNOfzXfwjEQFucISi UQRTjz9bbSpe9fWMX9gTNnC1uvTGr0pN3/W7iCSXDl4wdUEak0oY77oIDK0v4OXt LMt8xLh6h/LSseT7qNID35Q8NWM8XVw3r6eWrnE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=WPJfVhoTkf gvaERFgR95KsMX+ww=; b=WPJfBCXZBpEpf6Z9oyrWMcV5tGlHP9RrVKMvpKufrh o4JJ6cXEEVVF6OeiMjl2oFi+EBGeoFE4XbvgjYMEpgU5qqz9iBFvrhRCOIbIHXid vkV17MPqpdqWFAipjSBF/GINPfaTJOKHvwOL2mZRSuIdtObof9VE1epEcj0WoZ3s g= Received: (qmail 125742 invoked by alias); 7 Jan 2016 19:48:16 -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 124860 invoked by uid 89); 7 Jan 2016 19:48:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.6 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, LIKELY_SPAM_BODY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=seo, CC, Automatic, cseolinuxvnetibmcom X-HELO: e24smtp03.br.ibm.com X-IBM-Helo: d24dlp01.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> Cc: Tulio Magno Quites Machado Filho , GLIBC From: Carlos Eduardo Seo Message-ID: <568EC0F6.9060902@linux.vnet.ibm.com> Date: Thu, 7 Jan 2016 17:48:06 -0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <8760z6l8bf.fsf@igel.home> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16010719-0025-0000-0000-000005B886C4 On 1/6/16 7:14 PM, Andreas Schwab wrote: > > ${x//} is bash-specific. > Oops, fixed. diff --git a/sysdeps/powerpc/preconfigure b/sysdeps/powerpc/preconfigure index 0c6fdde..1274f8b 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 -Vr | 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