This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
Can't build with cc on Solaris
- To: binutils at sourceware dot cygnus dot com
- Subject: Can't build with cc on Solaris
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 03 Apr 2000 02:35:33 -0300
- Cc: libtool at gnu dot org
- Organization: Cygnus Solutions, a Red Hat Company
binutils top-level configure passes --with-gnu-ld down to sub-projects
`configure' commands whenever it finds `ld' is going to be built.
This causes libtool's `configure' fragment and `ltconfig' to search
for GNU ld whenever the compiler is not GCC. If it can't find a GNU
ld, it will just bail out. I currently don't have a solution for this
problem, but one possible work-around is to arrange that the top-level
configure passes `--with-gnu-ld=build' down to sub-projects. I
haven't verified whether this works correctly so far.
The second problem, in the same scenario, is that, when libtool finds
GNU ld, it will assume that the compiler uses it. This assumption is
wrong, and causes an --enable-shared build to break. I've just come
up with a candidate solution for this problem: ltconfig will check
whether the selected compiler actually uses GNU ld. If not, it will
just refrain from using any GNU ld-specific knowledge. This is not
perfect, but it should work for now. I'll try to find some better
solution for libtool 1.4+. Meanwhile, ok to install this one in the
Sourceware CVS tree? In the binutils release branch?
Index: ChangeLog
from Alexandre Oliva <aoliva@cygnus.com>
* ltconfig (with_gnu_ld): Check whether the compiler actually uses
GNU ld.
Index: ltconfig
===================================================================
RCS file: /cvs/src/src/ltconfig,v
retrieving revision 1.2
diff -u -r1.2 ltconfig
--- ltconfig 2000/02/27 16:46:19 1.2
+++ ltconfig 2000/04/03 05:25:03
@@ -1,7 +1,7 @@
#! /bin/sh
# ltconfig - Create a system-specific libtool.
-# Copyright (C) 1996-1999 Free Software Foundation, Inc.
+# Copyright (C) 1996-2000 Free Software Foundation, Inc.
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
#
# This file is free software; you can redistribute it and/or modify it
@@ -170,7 +170,7 @@
PROGRAM=ltconfig
PACKAGE=libtool
VERSION=1.3.4
-TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)"
+TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57, modified)"
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
rm="rm -f"
@@ -1058,6 +1058,27 @@
with_gnu_ld=no
fi
echo "$ac_t$with_gnu_ld" 1>&6
+
+if test "$with_gnu_ld" = yes && test -n "$wl"; then
+ echo $ac_n "checking if the compiler ($CC) uses GNU ld... $ac_c" 1>&6
+ # Check whether this is the linker used by CC, but only if we have
+ # -Wl, or equivalent, otherwise `-v' may be interpreted by the
+ # compiler.
+ "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > conftest.ld
+ rm -f conftest.c
+ echo 'int main() {}' > conftest.c
+ ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS ${wl}-v 2>&1 |
+ egrep '(GNU|with BFD)' > conftest.ld2
+ if cmp -s conftest.ld conftest.ld2; then
+ with_gnu_ld=yes
+ else
+ with_gnu_ld=no
+ fi
+ echo "$ac_t$with_gnu_ld" 1>&6
+else
+ # Assume the worst
+ with_gnu_ld=no
+fi
# See if the linker supports building shared libraries.
echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6
--
Alexandre Oliva Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me