This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: *FLAGS_FOR_BUILD vs cross-compiling


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]