public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: PATCH: Re: other/9031
@ 2002-12-27 22:26 John David Anglin
0 siblings, 0 replies; 7+ messages in thread
From: John David Anglin @ 2002-12-27 22:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: John David Anglin <dave@hiauly1.hia.nrc.ca>
To: Alexandre Oliva <aoliva@redhat.com>
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, dave.anglin@nrc.ca,
gcc-patches@gcc.gnu.org, binutils@sources.redhat.com, neroden@twcny.rr.com
Subject: Re: PATCH: Re: other/9031
Date: Sat, 28 Dec 2002 01:22:25 -0500
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++"}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Re: other/9031
@ 2003-01-04 21:06 John David Anglin
0 siblings, 0 replies; 7+ messages in thread
From: John David Anglin @ 2003-01-04 21:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: aoliva@redhat.com (Alexandre Oliva)
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, dave.anglin@nrc.ca,
gcc-patches@gcc.gnu.org, binutils@sources.redhat.com, neroden@twcny.rr.com
Subject: Re: PATCH: Re: other/9031
Date: Sat, 4 Jan 2003 15:58:55 -0500 (EST)
> > Ok, but I wouldn't mind if you waited for Nathan's patch to go in
> > before adjusting yours. If you agree, consider the updated patch
> > pre-approved, but please post it, for the record.
>
> In fact, consider now sinclude()ing libtool.m4 and using its
> AC_PROG_LD macro.
I have installed the following revised version of the patch on the main.
The code now checks to see if LD is set. There are some minor variable
name changes and other revisions due to the fact that the code is now
processed by autoconf.
Tested on hppa64-hp-hpux11.11 and hppa2.0w-hp-hpux11.11.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2003-01-04 John David Anglin <dave.anglin@nrc.ca>
* configure.in (LD): Improve test for gcc. Try to set LD to the ld used
by gcc if LD is not defined and we are not doing a Canadian Cross.
* configure: Rebuilt.
Index: configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/configure.in,v
retrieving revision 1.202
diff -u -3 -p -r1.202 configure.in
--- configure.in 28 Dec 2002 17:57:14 -0000 1.202
+++ configure.in 29 Dec 2002 19:01:47 -0000
@@ -1456,12 +1456,14 @@ else
YACC="\$(USUAL_YACC)"
# If CC is still not set, try to get gcc.
+ cc_prog_is_gcc=
if test -z "${CC}" ; then
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
for dir in $PATH; do
test -z "$dir" && dir=.
if test -f $dir/gcc; then
CC="gcc"
+ cc_prog_is_gcc=yes
echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"}
@@ -1477,11 +1479,20 @@ else
IFS="$save_ifs"
CC=${CC-cc}
else
+ # Determine if we are using gcc.
+ cat > conftest.c <<EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+ if ${CC} -E conftest.c | grep yes >/dev/null 2>&1; then
+ cc_prog_is_gcc=yes
+ fi
+ rm -f conftest.c
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)
+ if test "$cc_prog_is_gcc" = yes; then
echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"}
@@ -1491,7 +1502,25 @@ else
CXXFLAGS=${CXXFLAGS-"-O2"}
fi
rm -f conftest*
- ;;
+ fi
+ fi
+ 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 "$cc_prog_is_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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Re: other/9031
@ 2002-12-28 1:26 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2002-12-28 1:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: Alexandre Oliva <aoliva@redhat.com>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, dave.anglin@nrc.ca,
gcc-patches@gcc.gnu.org, binutils@sources.redhat.com, neroden@twcny.rr.com
Subject: Re: PATCH: Re: other/9031
Date: 28 Dec 2002 07:15:53 -0200
On Dec 28, 2002, Alexandre Oliva <aoliva@redhat.com> wrote:
>> 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.
> Ok, but I wouldn't mind if you waited for Nathan's patch to go in
> before adjusting yours. If you agree, consider the updated patch
> pre-approved, but please post it, for the record.
In fact, consider now sinclude()ing libtool.m4 and using its
AC_PROG_LD macro.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Re: other/9031
@ 2002-12-27 22:36 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2002-12-27 22:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: Alexandre Oliva <aoliva@redhat.com>
To: John David Anglin <dave@hiauly1.hia.nrc.ca>
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, dave.anglin@nrc.ca,
gcc-patches@gcc.gnu.org, binutils@sources.redhat.com, neroden@twcny.rr.com
Subject: Re: PATCH: Re: other/9031
Date: 28 Dec 2002 04:31:35 -0200
On Dec 28, 2002, John David Anglin <dave@hiauly1.hia.nrc.ca> wrote:
> Here is a revised patch.
Heh. Thanks. Just as I was about to approve the original patch :-)
> 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.
Ok, but I wouldn't mind if you waited for Nathan's patch to go in
before adjusting yours. If you agree, consider the updated patch
pre-approved, but please post it, for the record.
Thanks!
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Re: other/9031
@ 2002-12-26 20:16 John David Anglin
0 siblings, 0 replies; 7+ messages in thread
From: John David Anglin @ 2002-12-26 20:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: aoliva@redhat.com (Alexandre Oliva)
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, dave.anglin@nrc.ca,
gcc-patches@gcc.gnu.org, binutils@sources.redhat.com
Subject: Re: PATCH: Re: other/9031
Date: Thu, 26 Dec 2002 23:10:28 -0500 (EST)
> host. So perhaps it would be more reasonable to change case $host to
> case $build. Besides, I suppose the problem may actually be caused by
> the unnecessary use of double quotes in the assignment. I *think*
> taking them out may cause the needless CR to go away without affecting
> anything else.
I don't think so. The double quotes were mine and not in the original
libtool macro. The original comment regarding the CR was that gcc leaves
a trailing CR which upsets mingw. I am unable to test whether this is
actually a problem. The libtool patch to strip carriage returns was made
by Gary Vaughan on 1999-08-03. The predates the libtool archive. I agree
that $host should be $build.
> Also, pathname canonicalization is tricky business. Replacing
> foo/../ with / is only a good idea when foo is not a soft link. Do we
> really need this?
I did the pathname canonicalization because the libtool macro did it
and I was trying the provide a default value for LD comparible to what
libtool would generate. It's unnecessary in the configurations that
I use and would have no objection in removing it.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: PATCH: Re: other/9031
@ 2002-12-26 19:16 Alexandre Oliva
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Oliva @ 2002-12-26 19:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: Alexandre Oliva <aoliva@redhat.com>
To: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
Cc: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, dave.anglin@nrc.ca,
gcc-patches@gcc.gnu.org, binutils@sources.redhat.com
Subject: Re: PATCH: Re: other/9031
Date: 27 Dec 2002 01:11:11 -0200
On Dec 26, 2002, "John David Anglin" <dave@hiauly1.hia.nrc.ca> wrote:
> The enclosed patch fixes the problem reported in other/9031. The
> technique for determining LD is derived from that used by the
> libtool AC_PROG_LD macro.
> + case $host 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
I don't think this is appropriate. If mingw's CRs are causing
trouble, they'd cause trouble when mingw is the build machine, not the
host. So perhaps it would be more reasonable to change case $host to
case $build. Besides, I suppose the problem may actually be caused by
the unnecessary use of double quotes in the assignment. I *think*
taking them out may cause the needless CR to go away without affecting
anything else.
Another issue is that CC's ending with gcc may not be a good test for
whether the host compiler is CC. I realize this is not the only
occurrence of case $CC in *gcc) in the configure script, but even that
one should IMHO be changed so as to use something more similar to
autoconf's test for whether we are using GNU C.
Also, pathname canonicalization is tricky business. Replacing
foo/../ with / is only a good idea when foo is not a soft link. Do we
really need this?
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer
^ permalink raw reply [flat|nested] 7+ messages in thread
* PATCH: Re: other/9031
@ 2002-12-26 14:26 John David Anglin
0 siblings, 0 replies; 7+ messages in thread
From: John David Anglin @ 2002-12-26 14:26 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR other/9031; it has been noted by GNATS.
From: "John David Anglin" <dave@hiauly1.hia.nrc.ca>
To: gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org
Cc: dave.anglin@nrc.ca, gcc-patches@gcc.gnu.org, binutils@sources.redhat.com
Subject: PATCH: Re: other/9031
Date: Thu, 26 Dec 2002 17:16:02 -0500 (EST)
> Thank you very much for your problem report.
> It has the internal identification `other/9031'.
> The individual assigned to look at your
> report is: unassigned.
>
> >Category: other
> >Responsible: unassigned
> >Synopsis: Cygnus configure versus libtool AC_PROG_LD macro
> >Arrival-Date: Fri Dec 20 12:36:00 PST 2002
The enclosed patch fixes the problem reported in other/9031. The technique
for determining LD is derived from that used by the libtool AC_PROG_LD macro.
Tested on hppa64-hp-hpux11.11 and hppa2.0w-hp-hpux11.11. Ok for main?
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
2002-12-26 John David Anglin <dave.anglin@nrc.ca>
* configure (LD): 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.50
diff -u -3 -p -r1.50 configure
--- configure 16 Dec 2002 18:18:42 -0000 1.50
+++ configure 21 Dec 2002 21:08:30 -0000
@@ -1059,6 +1059,29 @@ else
fi
fi
+ # If we are using gcc, try to set the LD default to the ld used by gcc.
+ case "${CC}" in
+ *gcc)
+ case $host 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]:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the path of ld
+ gcc_prog_ld=`echo $gcc_prog_ld| sed 's%\\\\%/%g'`
+ while echo $gcc_prog_ld| grep "$re_direlt" > /dev/null 2>&1; do
+ gcc_prog_ld=`echo $gcc_prog_ld| sed "s%$re_direlt%/%"`
+ done
+ LD="$gcc_prog_ld" ;;
+ esac
+ ;;
+ esac
+
CXX=${CXX-"c++"}
CFLAGS=${CFLAGS-"-g"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-01-04 21:06 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-27 22:26 PATCH: Re: other/9031 John David Anglin
-- strict thread matches above, loose matches on Subject: below --
2003-01-04 21:06 John David Anglin
2002-12-28 1:26 Alexandre Oliva
2002-12-27 22:36 Alexandre Oliva
2002-12-26 20:16 John David Anglin
2002-12-26 19:16 Alexandre Oliva
2002-12-26 14:26 John David Anglin
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).