This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Re: other/9031
- From: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: gcc-gnats at gcc dot gnu dot org, nobody at gcc dot gnu dot org, dave dot anglin at nrc dot ca, gcc-patches at gcc dot gnu dot org, binutils at sources dot redhat dot com, neroden at twcny dot rr dot com
- Date: Sat, 28 Dec 2002 01:22:25 -0500
- Subject: Re: PATCH: Re: other/9031
- References: <200212262216.gBQMG2v2000775@hiauly1.hia.nrc.ca> <orznqs5f74.fsf@free.redhat.lsd.ic.unicamp.br>
Here is a revised patch. I have improved the gcc detection, removed the
extra double quotes from the commands used to print the ld used by gcc,
and the path canonicalization. The mingw CR removal is still in as I
have no way to determine whether this isn't still needed.
I have tested the patch with builds on hppa64-hp-hpux11.11 and
hppa2.0w-hp-hpux11.00.
The patch will be obsolete if Nanthanael's autoconfiscation patch is
installed, although I see his patch still includes the code that I
am attempting to improve.
Dave
2002-12-28 John David Anglin <dave.anglin@nrc.ca>
* configure (LD): Improve test for gcc and try to set LD to the ld
used by gcc when using gcc and not doing a Canadian Cross.
Index: configure
===================================================================
RCS file: /cvsroot/gcc/gcc/configure,v
retrieving revision 1.51
diff -u -3 -p -r1.51 configure
--- configure 22 Dec 2002 06:46:41 -0000 1.51
+++ configure 27 Dec 2002 18:51:43 -0000
@@ -1020,6 +1020,7 @@ else
YACC='\$(USUAL_YACC)'
# If CC is still not set, try to get gcc.
+ cc_prog=
if [ -z "${CC}" ]; then
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
for dir in $PATH; do
@@ -1028,6 +1029,7 @@ else
CC="gcc"
echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then
+ cc_prog=gcc
CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
else
@@ -1044,8 +1046,16 @@ else
if test -z "${CFLAGS}"; then
# Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
# is set to a version of gcc.
- case "${CC}" in
- *gcc)
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+ if ${CC} -E conftest.c | grep yes >/dev/null 2>&1; then
+ cc_prog=gcc
+ fi
+ rm -f conftest.c
+ if [ "$cc_prog" = gcc ]; then
echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"}
@@ -1055,9 +1065,23 @@ else
CXXFLAGS=${CXXFLAGS-"-O2"}
fi
rm -f conftest*
- ;;
- esac
+ fi
fi
+ fi
+
+ # If we are using gcc, try to set the LD default to the ld used by gcc.
+ if [ "$cc_prog" = gcc ]; 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
CXX=${CXX-"c++"}