From patchwork Thu Jan 27 03:50:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 80580 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 303401007D1 for ; Thu, 27 Jan 2011 14:51:01 +1100 (EST) Received: (qmail 25375 invoked by alias); 27 Jan 2011 03:51:00 -0000 Received: (qmail 25364 invoked by uid 22791); 27 Jan 2011 03:50:58 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_BG, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Jan 2011 03:50:52 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0R3ofIC003415 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Jan 2011 22:50:41 -0500 Received: from freie.oliva.athome.lsd.ic.unicamp.br (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0R3odZQ014932 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Jan 2011 22:50:41 -0500 Received: from livre.localdomain (livre-to-gw.oliva.athome.lsd.ic.unicamp.br [172.31.160.19]) by freie.oliva.athome.lsd.ic.unicamp.br (8.14.4/8.14.4) with ESMTP id p0R3ocjP021946; Thu, 27 Jan 2011 01:50:38 -0200 Received: from livre.localdomain (aoliva@localhost.localdomain [127.0.0.1]) by livre.localdomain (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p0R3olam003692; Thu, 27 Jan 2011 01:50:48 -0200 Received: (from aoliva@localhost) by livre.localdomain (8.14.3/8.14.3/Submit) id p0R3ogR8003686; Thu, 27 Jan 2011 01:50:42 -0200 From: Alexandre Oliva To: "Joseph S. Myers" Cc: gcc-patches@gcc.gnu.org, Ralf Wildenhues Subject: Re: [PR libgcj/44341] introduce --with-target-{gmp,mpfr,...} References: Date: Thu, 27 Jan 2011 01:50:41 -0200 In-Reply-To: (Joseph S. Myers's message of "Tue, 25 Jan 2011 22:32:06 +0000 (UTC)") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 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 Jan 25, 2011, "Joseph S. Myers" wrote: > Even there, the options may not really be general enough, in that if you > are building libgcj, linked against libgmp, for an x86_64-linux-gnu target > in a multilib configuration, you probably want both 32-bit and 64-bit > libgmp and so a single option may not suffice to say where they are for > all multilibs. Ok, this is definitely a killer. Thanks for bringing this up. I've now simplified the patch, dropping the --with-target* options, and changing it so as to refrain from passing the host-specific options to configure cross target libraries. > What should be done in general is making it explicit (in install.texi) > that certain options are host options or target options. Thus: > --with-gmp* and other library options are purely host options and do not > relate to the target at all. *nod* > --disable-shared is purely a target option and not relevant to the > host Erhm... This may be so for GCC, but it definitely isn't so in other packages that share the top level infrastructure with GCC. Here's the simplified patch I've just smoke-tested. Any objections? for ChangeLog from Alexandre Oliva PR libgcj/44341 * configure.ac: Discard --with-* flags for host when configuring target libraries for cross build. * configure: Rebuilt. for gcc/ChangeLog from Alexandre Oliva PR libgcj/44341 * doc/install.texi: Document host options discarded when cross configuring target libraries. Index: configure.ac =================================================================== --- configure.ac.orig 2011-01-26 03:58:32.016540988 -0200 +++ configure.ac 2011-01-27 01:12:01.250018077 -0200 @@ -2845,6 +2845,7 @@ AC_SUBST_FILE(serialization_dependencies # Also strip program-prefix, program-suffix, and program-transform-name, # so that we can pass down a consistent program-transform-name. baseargs= +tbaseargs= keep_next=no skip_next=no eval "set -- $ac_configure_args" @@ -2860,6 +2861,7 @@ do ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac baseargs="$baseargs '$ac_arg'" + tbaseargs="$tbaseargs '$ac_arg'" keep_next=no continue fi @@ -2881,11 +2883,45 @@ do ;; esac + skip_targ=no + case $ac_arg in +changequote(,) + --with-* | --without-*) + libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'` + + case $libopt in + *[-_]include) + lib=`echo "$libopt" | sed 's,[-_]include$,,'` + ;; + *[-_]lib) + lib=`echo "$libopt" | sed 's,[-_]lib$,,'` + ;; + *) + lib=$libopt + ;; + esac +changequote([,]) + + case $lib in + mpc | mpfr | gmp | ppl | cloog) + # If we're processing --with-$lib, --with-$lib-include or + # --with-$lib-lib, for one of the libs above, and target is + # different from host, don't pass the current argument to any + # target library's configure. + if test x$is_cross_compiler = xyes; then + skip_targ=yes + fi + ;; + esac + ;; + esac + case "$ac_arg" in --cache-file=/dev/null | \ -cache-file=/dev/null ) # Handled here to avoid the test to skip args below. baseargs="$baseargs '$ac_arg'" + tbaseargs="$tbaseargs '$ac_arg'" # Assert: $separate_arg should always be no. keep_next=$separate_arg ;; @@ -2916,6 +2952,9 @@ do ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac baseargs="$baseargs '$ac_arg'" + if test X"$skip_targ" = Xno; then + tbaseargs="$tbaseargs '$ac_arg'" + fi keep_next=$separate_arg ;; *) @@ -2942,10 +2981,13 @@ EOF_SED gcc_transform_name=`cat conftestsed.out` rm -f conftestsed.out baseargs="$baseargs --program-transform-name='${gcc_transform_name}'" +tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'" if test "$silent" = yes; then baseargs="$baseargs --silent" + tbaseargs="$tbaseargs --silent" fi baseargs="$baseargs --disable-option-checking" +tbaseargs="$tbaseargs --disable-option-checking" # Record and document user additions to sub configure arguments. AC_ARG_VAR([build_configargs], @@ -2974,7 +3016,7 @@ esac # This seems to be due to autoconf 2.5x stupidity. host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}" -target_configargs="$target_configargs ${baseargs}" +target_configargs="$target_configargs ${tbaseargs}" # Passing a --with-cross-host argument lets the target libraries know # whether they are being built with a cross-compiler or being built Index: gcc/doc/install.texi =================================================================== --- gcc/doc/install.texi.orig 2011-01-26 03:58:33.884491660 -0200 +++ gcc/doc/install.texi 2011-01-27 01:15:49.846404205 -0200 @@ -1584,6 +1584,9 @@ shared libraries can be found by the dyn using GCC, for example by setting the runtime shared library path variable (@env{LD_LIBRARY_PATH} on GNU/Linux and Solaris systems). +These flags are applicable to the host platform only. When building +a cross compiler, they will not be used to configure target libraries. + @item --with-ppl=@var{pathname} @itemx --with-ppl-include=@var{pathname} @itemx --with-ppl-lib=@var{pathname} @@ -1604,6 +1607,9 @@ you can explicitly specify the directory shorthand assumptions are not correct, you can use the explicit include and lib options directly. +These flags are applicable to the host platform only. When building +a cross compiler, they will not be used to configure target libraries. + @item --with-host-libstdcxx=@var{linker-args} If you are linking with a static copy of PPL, you can use this option to specify how the linker should find the standard C++ library used Index: configure =================================================================== --- configure.orig 2011-01-27 01:12:06.797881999 -0200 +++ configure 2011-01-27 01:12:37.420130747 -0200 @@ -7330,6 +7330,7 @@ serialization_dependencies=serdep.tmp # Also strip program-prefix, program-suffix, and program-transform-name, # so that we can pass down a consistent program-transform-name. baseargs= +tbaseargs= keep_next=no skip_next=no eval "set -- $ac_configure_args" @@ -7345,6 +7346,7 @@ do ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac baseargs="$baseargs '$ac_arg'" + tbaseargs="$tbaseargs '$ac_arg'" keep_next=no continue fi @@ -7366,11 +7368,45 @@ do ;; esac + skip_targ=no + case $ac_arg in + + --with-* | --without-*) + libopt=`echo "$ac_arg" | sed -e 's,^--[^-_]*[-_],,' -e 's,=.*$,,'` + + case $libopt in + *[-_]include) + lib=`echo "$libopt" | sed 's,[-_]include$,,'` + ;; + *[-_]lib) + lib=`echo "$libopt" | sed 's,[-_]lib$,,'` + ;; + *) + lib=$libopt + ;; + esac + + + case $lib in + mpc | mpfr | gmp | ppl | cloog) + # If we're processing --with-$lib, --with-$lib-include or + # --with-$lib-lib, for one of the libs above, and target is + # different from host, don't pass the current argument to any + # target library's configure. + if test x$is_cross_compiler = xyes; then + skip_targ=yes + fi + ;; + esac + ;; + esac + case "$ac_arg" in --cache-file=/dev/null | \ -cache-file=/dev/null ) # Handled here to avoid the test to skip args below. baseargs="$baseargs '$ac_arg'" + tbaseargs="$tbaseargs '$ac_arg'" # Assert: $separate_arg should always be no. keep_next=$separate_arg ;; @@ -7401,6 +7437,9 @@ do ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac baseargs="$baseargs '$ac_arg'" + if test X"$skip_targ" = Xno; then + tbaseargs="$tbaseargs '$ac_arg'" + fi keep_next=$separate_arg ;; *) @@ -7427,10 +7466,13 @@ EOF_SED gcc_transform_name=`cat conftestsed.out` rm -f conftestsed.out baseargs="$baseargs --program-transform-name='${gcc_transform_name}'" +tbaseargs="$tbaseargs --program-transform-name='${gcc_transform_name}'" if test "$silent" = yes; then baseargs="$baseargs --silent" + tbaseargs="$tbaseargs --silent" fi baseargs="$baseargs --disable-option-checking" +tbaseargs="$tbaseargs --disable-option-checking" # Record and document user additions to sub configure arguments. @@ -7456,7 +7498,7 @@ esac # This seems to be due to autoconf 2.5x stupidity. host_configargs="$host_configargs --cache-file=./config.cache ${extra_host_args} ${baseargs}" -target_configargs="$target_configargs ${baseargs}" +target_configargs="$target_configargs ${tbaseargs}" # Passing a --with-cross-host argument lets the target libraries know # whether they are being built with a cross-compiler or being built