Commit 70571545 by John David Anglin Committed by John David Anglin

configure.in (LD): Improve test for gcc.

	* 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.

From-SVN: r60891
parent 1bb2cc34
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.
2002-12-31 Tom Tromey <tromey@redhat.com> 2002-12-31 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt. * Makefile.in: Rebuilt.
......
...@@ -1456,12 +1456,14 @@ else ...@@ -1456,12 +1456,14 @@ else
YACC="\$(USUAL_YACC)" YACC="\$(USUAL_YACC)"
# If CC is still not set, try to get gcc. # If CC is still not set, try to get gcc.
cc_prog_is_gcc=
if test -z "${CC}" ; then if test -z "${CC}" ; then
IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:"
for dir in $PATH; do for dir in $PATH; do
test -z "$dir" && dir=. test -z "$dir" && dir=.
if test -f $dir/gcc; then if test -f $dir/gcc; then
CC="gcc" CC="gcc"
cc_prog_is_gcc=yes
echo 'void f(){}' > conftest.c echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"} CFLAGS=${CFLAGS-"-g -O2"}
...@@ -1477,11 +1479,20 @@ else ...@@ -1477,11 +1479,20 @@ else
IFS="$save_ifs" IFS="$save_ifs"
CC=${CC-cc} CC=${CC-cc}
else 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 if test -z "${CFLAGS}"; then
# Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC # Here CC is set but CFLAGS is not. Use a quick hack to use -O2 if CC
# is set to a version of gcc. # is set to a version of gcc.
case "${CC}" in if test "$cc_prog_is_gcc" = yes; then
*gcc)
echo 'void f(){}' > conftest.c echo 'void f(){}' > conftest.c
if test -z "`${CC} -g -c conftest.c 2>&1`"; then if test -z "`${CC} -g -c conftest.c 2>&1`"; then
CFLAGS=${CFLAGS-"-g -O2"} CFLAGS=${CFLAGS-"-g -O2"}
...@@ -1491,7 +1502,25 @@ else ...@@ -1491,7 +1502,25 @@ else
CXXFLAGS=${CXXFLAGS-"-O2"} CXXFLAGS=${CXXFLAGS-"-O2"}
fi fi
rm -f conftest* 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 esac
fi fi
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment