public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Mike Frysinger <vapier@gentoo.org>
Cc: binutils@sourceware.org, gcc-patches@gcc.gnu.org
Subject: Re: *FLAGS_FOR_BUILD vs cross-compiling
Date: Sun, 07 Oct 2007 04:25:00 -0000	[thread overview]
Message-ID: <20071007042537.GA327@caradoc.them.org> (raw)
In-Reply-To: <200710061910.23606.vapier@gentoo.org>

On Sat, Oct 06, 2007 at 07:10:23PM -0400, Mike Frysinger wrote:
> the toplevel configure.ac currently does:
> CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
> CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CFLAGS}}
> LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${CFLAGS}}
> 
> there's two things wrong here ... first, the default for CXXFLAGS/LDFLAGS 
> should be CXXFLAGS/LDFLAGS, not CFLAGS.  the other is that FOR_BUILD 
> variables should not default to the host flags if $host != $build.  the 
> program FOR_BUILD variables (like AR/RANLIB/etc...) already test this, but 
> the *FLAGS do not.  so if you try to build like:
> CFLAGS="-m4" ./configure --build=x86_64-... --host=sh4-... --target=sh4-...
> it'll fail if any build binaries need to be compiled (like the "chew" binary 
> in bfd/doc/).
> 
> the attached patch should rectify both of these issues.

These files are shared with gcc, so I've forwarded to gcc-patches
where more toplevel build reviewers tend to hang out.  It seems
reasonable to me.

> -mike
> 
> 2007-10-06  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* configure.ac (CFLAGS_FOR_BUILD, CXXFLAGS_FOR_BUILD,
> 	LDFLAGS_FOR_BUILD): Default them to host flags only for $host = $build.
> 	Set default CXXFLAGS_FOR_BUILD to CXXFLAGS, not CFLAGS.  Set default
> 	LDFLAGS_FOR_BUILD to LDFLAGS, not CFLAGS.
> 	* configure: Regenerate.



> 2007-10-06  Mike Frysinger  <vapier@gentoo.org>
> 
> 	* configure.ac (CFLAGS_FOR_BUILD, CXXFLAGS_FOR_BUILD,
> 	LDFLAGS_FOR_BUILD): Default them to host flags only for $host = $build.
> 	Set default CXXFLAGS_FOR_BUILD to CXXFLAGS, not CFLAGS.  Set default
> 	LDFLAGS_FOR_BUILD to LDFLAGS, not CFLAGS.
> 	* configure: Regenerate.
> 
> --- configure.ac	1 Oct 2007 07:55:47 -0000	1.30
> +++ configure.ac	6 Oct 2007 23:06:00 -0000
> @@ -2387,9 +2387,11 @@ esac
>  
>  # Allow the user to override the flags for
>  # our build compiler if desired.
> -CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
> -CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CFLAGS}}
> -LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${CFLAGS}}
> +if test x"${build}" = x"${host}" ; then
> +  CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
> +  CXXFLAGS_FOR_BUILD=${CXXFLAGS_FOR_BUILD-${CXXFLAGS}}
> +  LDFLAGS_FOR_BUILD=${LDFLAGS_FOR_BUILD-${LDFLAGS}}
> +fi
>  
>  # On Canadian crosses, we'll be searching the right directories for
>  # the previously-installed cross compiler, so don't bother to add


-- 
Daniel Jacobowitz
CodeSourcery

       reply	other threads:[~2007-10-07  4:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200710061910.23606.vapier@gentoo.org>
2007-10-07  4:25 ` Daniel Jacobowitz [this message]
2007-10-07  7:19   ` Paolo Bonzini
2007-10-07 15:30     ` Mike Frysinger
2007-10-08  9:31       ` Nick Clifton
2007-10-08 11:30         ` Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071007042537.GA327@caradoc.them.org \
    --to=drow@false.org \
    --cc=binutils@sourceware.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).