[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AC_PROG_LD
From: |
John David Anglin |
Subject: |
Re: AC_PROG_LD |
Date: |
Fri, 20 Dec 2002 19:22:24 -0500 (EST) |
Robert,
> libtool uses gcc for linking and we need to ensure that appropriate
> linker options are passed to the gcc linker. Thus, the libtool
> configuration process needs to determine the linker used by gcc
> and its type in order to correctly set options for it. It should
> ignore what's in LD unless it sometimes uses it for linking as well.
> Do you you see this as a viable approach?
I've enclosed a patch along the lines described above. It changes
the libtool macros to no longer touch the LD variable. This is against
the libtool.m4 macros in binutils where I first noticed the problem.
If you think this is a viable approach, let me know and I will generate
a version against the cvs source. I have had a successful build
of binutils using it.
Dave
--
J. David Anglin address@hidden
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)
Index: libtool.m4
===================================================================
RCS file: /cvs/src/src/libtool.m4,v
retrieving revision 1.8
diff -u -3 -p -r1.8 libtool.m4
--- libtool.m4 28 Jan 2002 04:59:30 -0000 1.8
+++ libtool.m4 21 Dec 2002 00:05:57 -0000
@@ -61,7 +61,7 @@ AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
AR="$AR" LTCC="$CC" CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
-MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LTLD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
@@ -444,7 +444,7 @@ if test "$GCC" = yes; then
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
- test -z "$LD" && LD="$ac_prog"
+ test -z "$LTLD" && LTLD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
@@ -460,8 +460,9 @@ elif test "$with_gnu_ld" = yes; then
else
AC_MSG_CHECKING([for non-GNU ld])
fi
+test -n "$LD" && test -z "$LTLD" && LTLD="$LD"
AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
+[if test -z "$LTLD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
@@ -479,22 +480,22 @@ AC_CACHE_VAL(lt_cv_path_LD,
done
IFS="$ac_save_ifs"
else
- lt_cv_path_LD="$LD" # Let the user override the test with a path.
+ lt_cv_path_LD="$LTLD" # Let the user override the test with a path.
fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
+LTLD="$lt_cv_path_LD"
+if test -n "$LTLD"; then
+ AC_MSG_RESULT($LTLD)
else
AC_MSG_RESULT(no)
fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+test -z "$LTLD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_PROG_LD_GNU
])
AC_DEFUN([AC_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[AC_CACHE_CHECK([if the linker ($LTLD) is GNU ld], lt_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
+if $LTLD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
lt_cv_prog_gnu_ld=yes
else
lt_cv_prog_gnu_ld=no
@@ -505,7 +506,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld
# AC_PROG_LD_RELOAD_FLAG - find reload flag for linker
# -- PORTME Some linkers may need a different reload flag.
AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
-[AC_CACHE_CHECK([for $LD option to reload object files], lt_cv_ld_reload_flag,
+[AC_CACHE_CHECK([for $LTLD option to reload object files],
lt_cv_ld_reload_flag,
[lt_cv_ld_reload_flag='-r'])
reload_flag=$lt_cv_ld_reload_flag
test -n "$reload_flag" && reload_flag=" $reload_flag"
@@ -809,7 +813,7 @@ lt_save_CFLAGS="$CFLAGS"
dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
dnl is set to the C++ compiler.
AR="$AR" LTCC="$CC" CC="$CXX" CXX="$CXX" CFLAGS="$CXXFLAGS"
CPPFLAGS="$CPPFLAGS" \
-MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LTLD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \
@@ -843,7 +847,7 @@ lt_save_CFLAGS="$CFLAGS"
dnl Make sure LTCC is set to the C compiler, i.e. set LTCC before CC
dnl is set to the C++ compiler.
AR="$AR" LTCC="$CC" CC="$GCJ" CFLAGS="$GCJFLAGS" CPPFLAGS="$CPPFLAGS" \
-MAGIC_CMD="$MAGIC_CMD" LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
+MAGIC_CMD="$MAGIC_CMD" LD="$LTLD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" STRIP="$STRIP" \
AS="$AS" DLLTOOL="$DLLTOOL" OBJDUMP="$OBJDUMP" \
objext="$OBJEXT" exeext="$EXEEXT" reload_flag="$reload_flag" \