From patchwork Wed Feb 8 02:03:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Klose X-Patchwork-Id: 140051 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]) by ozlabs.org (Postfix) with SMTP id 73651B6EF3 for ; Wed, 8 Feb 2012 13:03:51 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329271432; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=k+U3a604xz0805J1lEzz0MR+4bs=; b=TNxFfUMX4AZKX4T 5E+mP5u0J16yLJef51mMMoOQcDaBCG4EMJ4aVLVFegRto/Z0lVx355NusHyFBsc1 QxhlGjEkCkJJLlCdP5Ov1yH4+iVQHe7NrTzEKwlokL9QzN5QCvtYDuQSGSSLIFbS SsIoN/qqGnN+d6CLUqKnsKuBNCCI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=iRTEkcnr1xA8pwuj8lvR3ZGWwagwjxX8v823EEJcV82lRuFr3FiBVg/m9W1yIh hcSdyNXSmWjD6Sx/LhkTVvP3TeshMFUJkMlLXjfBLdLn0JqDSaa3zZAlT2a0TdPm ZQsL9/nRJ8OK3Pc0zEWSzfos8Kc/yVirADsQmeiueZsKs=; Received: (qmail 24638 invoked by alias); 8 Feb 2012 02:03:45 -0000 Received: (qmail 24522 invoked by uid 22791); 8 Feb 2012 02:03:43 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, TW_GX X-Spam-Check-By: sourceware.org Received: from youngberry.canonical.com (HELO youngberry.canonical.com) (91.189.89.112) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Feb 2012 02:03:28 +0000 Received: from [108.60.121.129] (helo=[10.10.0.102]) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1RuwsY-0007FS-NA; Wed, 08 Feb 2012 02:03:27 +0000 Message-ID: <4F31D7EB.5000902@ubuntu.com> Date: Wed, 08 Feb 2012 03:03:23 +0100 From: Matthias Klose User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120203 Thunderbird/11.0 MIME-Version: 1.0 To: "Joseph S. Myers" CC: GCC Patches Subject: Re: [patch] avoid '//' prefixes when sysroot is set to '/' References: <4F2024FC.8060200@ubuntu.com> <4F21646A.2030501@ubuntu.com> <4F31BE47.2020506@ubuntu.com> In-Reply-To: Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 08.02.2012 02:01, Joseph S. Myers wrote: > On Wed, 8 Feb 2012, Matthias Klose wrote: > >> there is one more issue, when configuring >> >> --with-sysroot=/ --with-gxx-include-dir=/usr/include/c++/4.7 >> >> in that the leading / is stripped away in configure.ac. This case needs an >> explicit check. Ok for the trunk? > > This looks like a case where any sysroot with a trailing '/' could > misbehave and remove a leading '/' that should be left there, i.e. where > gcc_gxx_without_sysroot should be computed in a way that ignores any > trailing '/' on the sysroot setting. Or is such a removal actually > harmless in all cases except for plain '/' as the sysroot? not harmless, but not seen unless you pass --sysroot= to the driver. so lets strip the trailing / as well. this requires that the definition for AC_ARG_WITH(sysroot, ...) is moved before the use of the fixed with_sysroot before checking with_sysroot in the gcc_gxx_without_sysroot check. Matthias * configure.ac: Move AC_ARG_WITH checks for native-system-header-dir, build-sysroot, sysroot from the `Miscenalleous configure options' to the `Directories' section. * configure.ac: Strip trailing `/' from with_sysroot. (gcc_gxx_include_dir): Don't strip a `/' sysroot value. --- gcc/configure.ac.1 2012-02-08 02:38:57.199995985 +0100 +++ gcc/configure.ac 2012-02-08 02:46:21.890648210 +0100 @@ -145,6 +145,10 @@ [search for usr/lib, usr/include, et al, within DIR])], [ case ${with_sysroot} in + /) ;; + */) with_sysroot=`echo $with_sysroot | sed 's,/$,,'` ;; + esac + case ${with_sysroot} in yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; *) TARGET_SYSTEM_ROOT=$with_sysroot ;; esac @@ -211,7 +215,9 @@ if test "${with_sysroot+set}" = set; then gcc_gxx_without_sysroot=`expr "${gcc_gxx_include_dir}" : "${with_sysroot}"'\(.*\)'` if test "${gcc_gxx_without_sysroot}"; then - gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" + if test x${with_sysroot} != x/; then + gcc_gxx_include_dir="${gcc_gxx_without_sysroot}" + fi gcc_gxx_include_dir_add_sysroot=1 fi fi Index: gcc/configure.ac =================================================================== --- gcc/configure.ac (revision 183991) +++ gcc/configure.ac (working copy) @@ -118,6 +118,68 @@ local_prefix=/usr/local fi +AC_ARG_WITH([native-system-header-dir], + [ --with-native-system-header-dir=dir + use dir as the directory to look for standard + system header files in. Defaults to /usr/include.], +[ + case ${with_native_system_header_dir} in + yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; + /* | [[A-Za-z]]:[[\\/]]*) ;; + *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; + esac + configured_native_system_header_dir="${withval}" +], [configured_native_system_header_dir=]) + +AC_ARG_WITH(build-sysroot, + [AS_HELP_STRING([--with-build-sysroot=sysroot], + [use sysroot as the system root during the build])], + [if test x"$withval" != x ; then + SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" + fi], + [SYSROOT_CFLAGS_FOR_TARGET=]) +AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) + +AC_ARG_WITH(sysroot, +[AS_HELP_STRING([[--with-sysroot[=DIR]]], + [search for usr/lib, usr/include, et al, within DIR])], +[ + case ${with_sysroot} in + yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; + *) TARGET_SYSTEM_ROOT=$with_sysroot ;; + esac + + TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' + CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' + + if test "x$prefix" = xNONE; then + test_prefix=/usr/local + else + test_prefix=$prefix + fi + if test "x$exec_prefix" = xNONE; then + test_exec_prefix=$test_prefix + else + test_exec_prefix=$exec_prefix + fi + case ${TARGET_SYSTEM_ROOT} in + "${test_prefix}"|"${test_prefix}/"*|\ + "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ + '${prefix}'|'${prefix}/'*|\ + '${exec_prefix}'|'${exec_prefix}/'*) + t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" + TARGET_SYSTEM_ROOT_DEFINE="$t" + ;; + esac +], [ + TARGET_SYSTEM_ROOT= + TARGET_SYSTEM_ROOT_DEFINE= + CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' +]) +AC_SUBST(TARGET_SYSTEM_ROOT) +AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) +AC_SUBST(CROSS_SYSTEM_HEADER_DIR) + # Don't set gcc_gxx_include_dir to gxx_include_dir since that's only # passed in by the toplevel make and thus we'd get different behavior # depending on where we built the sources. @@ -739,68 +801,6 @@ ], [enable_shared=yes]) AC_SUBST(enable_shared) -AC_ARG_WITH([native-system-header-dir], - [ --with-native-system-header-dir=dir - use dir as the directory to look for standard - system header files in. Defaults to /usr/include.], -[ - case ${with_native_system_header_dir} in - yes|no) AC_MSG_ERROR([bad value ${withval} given for --with-native-system-header-dir]) ;; - /* | [[A-Za-z]]:[[\\/]]*) ;; - *) AC_MSG_ERROR([--with-native-system-header-dir argument ${withval} must be an absolute directory]) ;; - esac - configured_native_system_header_dir="${withval}" -], [configured_native_system_header_dir=]) - -AC_ARG_WITH(build-sysroot, - [AS_HELP_STRING([--with-build-sysroot=sysroot], - [use sysroot as the system root during the build])], - [if test x"$withval" != x ; then - SYSROOT_CFLAGS_FOR_TARGET="--sysroot=$withval" - fi], - [SYSROOT_CFLAGS_FOR_TARGET=]) -AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET) - -AC_ARG_WITH(sysroot, -[AS_HELP_STRING([[--with-sysroot[=DIR]]], - [search for usr/lib, usr/include, et al, within DIR])], -[ - case ${with_sysroot} in - yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_noncanonical}/sys-root' ;; - *) TARGET_SYSTEM_ROOT=$with_sysroot ;; - esac - - TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"' - CROSS_SYSTEM_HEADER_DIR='$(TARGET_SYSTEM_ROOT)$${sysroot_headers_suffix}$(NATIVE_SYSTEM_HEADER_DIR)' - - if test "x$prefix" = xNONE; then - test_prefix=/usr/local - else - test_prefix=$prefix - fi - if test "x$exec_prefix" = xNONE; then - test_exec_prefix=$test_prefix - else - test_exec_prefix=$exec_prefix - fi - case ${TARGET_SYSTEM_ROOT} in - "${test_prefix}"|"${test_prefix}/"*|\ - "${test_exec_prefix}"|"${test_exec_prefix}/"*|\ - '${prefix}'|'${prefix}/'*|\ - '${exec_prefix}'|'${exec_prefix}/'*) - t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE" - TARGET_SYSTEM_ROOT_DEFINE="$t" - ;; - esac -], [ - TARGET_SYSTEM_ROOT= - TARGET_SYSTEM_ROOT_DEFINE= - CROSS_SYSTEM_HEADER_DIR='$(gcc_tooldir)/sys-include' -]) -AC_SUBST(TARGET_SYSTEM_ROOT) -AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE) -AC_SUBST(CROSS_SYSTEM_HEADER_DIR) - AC_ARG_WITH(specs, [AS_HELP_STRING([--with-specs=SPECS], [add SPECS to driver command-line processing])],