This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Toplevel PR 30753 - Fix non-native builds
On Tue, Feb 13, 2007 at 07:31:01AM +0100, Paolo Bonzini wrote:
>
> >>Yes, but please leave the CFLAGS=${CFLAGS-"-g"} because I know that some
> >>people prefer to have it.
> >
> >What's it for and where does it belong? It can't possibly have
> >anything to do with the ${build} = ${host} test, I don't think.
>
> It's because the toplevel's default for CFLAGS is -g, which is later
> overridden to "-g -O2" when bootstrapping. If I had to quote by memory,
> I would have said indeed that it belonged more to host = target than to
> build = host.
>
> If you really want to scrap it, go for it -- but be prepared that
> someone complains.
I stopped to think about this remark and got very worried. If it had
really worked the way you describe, then the default whenever building
a cross compiler would have been CFLAGS=-g. I think we'd have noticed
that - since the slowdown for a non-optimized GCC is huge, on the
order of 40%.
The line didn't actually do anything, because AC_PROG_CC always sets
CFLAGS to something, and this only set a default if no value was set.
Just as well, since it ignored the result of the autoconf test for
whether $CC supported -g.
Now, if I move it before AC_PROG_CC, then it works. But a bunch of my
configurations suddenly start building un-optimized by default when
they didn't previously (i.e. with autoconf 2.13). So, I'm not going
to do that :-)
> The other remark, that the LD test must go after AC_PROG_CC, of course
> still holds.
Right, thank you for noticing. Here's what I'm checking in.
--
Daniel Jacobowitz
CodeSourcery
2007-02-13 Daniel Jacobowitz <dan@codesourcery.com>
Paolo Bonzini <bonzini@gnu.org>
PR bootstrap/30753
* configure.ac: Remove obsolete build / host tests. Use AC_PROG_CC
unconditionally. Use AC_PROG_CXX. Use ACX_TOOL_DIRS to find $prefix.
* configure: Regenerated.
Index: configure.ac
===================================================================
--- configure.ac (revision 121846)
+++ configure.ac (working copy)
@@ -1030,49 +1030,31 @@ if test -z "${CC}" && test "${build}" =
fi
if test "${build}" != "${host}" ; then
- # If we are doing a Canadian Cross, in which the host and build systems
- # are not the same, we set reasonable default values for the tools.
-
- CC=${CC-${host_noncanonical}-gcc}
- CFLAGS=${CFLAGS-"-g -O2"}
- CXX=${CXX-${host_noncanonical}-c++}
- CXXFLAGS=${CXXFLAGS-"-g -O2"}
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
-
else
- # Set reasonable default values for some tools even if not Canadian.
- # Of course, these are different reasonable default values, originally
- # specified directly in the Makefile.
- # We don't export, so that autoconf can do its job.
- # Note that all these settings are above the fragment inclusion point
- # in Makefile.in, so can still be overridden by fragments.
- # This is all going to change when we autoconfiscate...
-
CC_FOR_BUILD="\$(CC)"
- AC_PROG_CC
+fi
- # We must set the default linker to the linker used by gcc for the correct
- # operation of libtool. If LD is not defined and we are using gcc, try to
- # set the LD default to the ld used by gcc.
- if test -z "$LD"; then
- if test "$GCC" = yes; then
- case $build in
- *-*-mingw*)
- gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
- *)
- gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
- esac
- case $gcc_prog_ld in
- # Accept absolute paths.
- [[\\/]* | [A-Za-z]:[\\/]*)]
- LD="$gcc_prog_ld" ;;
- esac
- fi
- fi
+AC_PROG_CC
+AC_PROG_CXX
- CXX=${CXX-"c++"}
- CFLAGS=${CFLAGS-"-g"}
- CXXFLAGS=${CXXFLAGS-"-g -O2"}
+# We must set the default linker to the linker used by gcc for the correct
+# operation of libtool. If LD is not defined and we are using gcc, try to
+# set the LD default to the ld used by gcc.
+if test -z "$LD"; then
+ if test "$GCC" = yes; then
+ case $build in
+ *-*-mingw*)
+ gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
+ *)
+ gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
+ esac
+ case $gcc_prog_ld in
+ # Accept absolute paths.
+ [[\\/]* | [A-Za-z]:[\\/]*)]
+ LD="$gcc_prog_ld" ;;
+ esac
+ fi
fi
ACX_PROG_GNAT
@@ -1578,6 +1560,9 @@ case "$host" in
enable_gdbtk=no ;;
esac
+# To find our prefix, in gcc_cv_tool_prefix.
+ACX_TOOL_DIRS
+
copy_dirs=
AC_ARG_WITH([build-sysroot],
@@ -1597,10 +1582,7 @@ if test x"${with_headers}" != x && test
exit 1
fi
if test x"${with_headers}" != xyes ; then
- case "${exec_prefixoption}" in
- "") x=${prefix} ;;
- *) x=${exec_prefix} ;;
- esac
+ x=${gcc_cv_tool_prefix}
copy_dirs="${copy_dirs} ${with_headers} $x/${target_noncanonical}/sys-include"
fi
fi
@@ -1616,10 +1598,7 @@ if test x"${with_libs}" != x && test x"$
if test x"${with_libs}" != xyes ; then
# Copy the libraries in reverse order, so that files in the first named
# library override files in subsequent libraries.
- case "${exec_prefixoption}" in
- "") x=${prefix} ;;
- *) x=${exec_prefix} ;;
- esac
+ x=${gcc_cv_tool_prefix}
for l in ${with_libs}; do
copy_dirs="$l $x/${target_noncanonical}/lib ${copy_dirs}"
done