Rationale:
On some releases of OpenServer 5, libc was poorly constructed and had
static versions of __ctype. Due to a bug with copy relocations, linking
a shared library with -lc would result in a shared library having one
notion of __ctype, and the a.out having another. Thus, things like
atoi() would behave differently inside the shared library versus the a.out.
This is really bad. Also, there is no need to link in -lc, as it is always
loaded by definition, as that is the RTLD and you cant have any form of
dynamic ELF program without it.
On OpenServer 6 and UnixWare, explicitly linking with -lc is even worse.
The threads library is constructed in such a way that it provides several
of the same functions that appear in libc. The version for libthread.so
are the real, threads-safe versions. The versions that are in libc are
stub versions that are present to allow programs to link, while still using
simpler versions of things like mutexes and condition variables. In order
for threads to work correctly, libc *must* be the very last library in the
load order, so that those symbols that need it are resolved out of the
threads library. If you explicitly link with -lc when creating a shared
library, then libc is processed as a dependency when the shared library
is loaded, and appears too early in the dependency chain.
2005-10-24 Kean Johnston <address@hidden>
* ltmain.in(*-*-sco3.2v5*): Dont pass through -lc.
(*-*-sysv5*): Ditto.
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.91
diff -u -3 -p -r1.334.2.91 ltmain.in
--- ltmain.in 18 Oct 2005 07:26:05 -0000 1.334.2.91
+++ ltmain.in 30 Oct 2005 21:22:25 -0000
@@ -1494,6 +1495,15 @@ EOF
# Rhapsody C and math libraries are in the System framework
deplibs="$deplibs -framework System"
continue
+ ;;
+ *-*-sco3.2v5* | *-*-sco5v6*)
+ # Causes problems with __ctype
+ test "X$arg" = "X-lc" && continue
+ ;;
+ *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
esac
elif test "X$arg" = "X-lc_r"; then
case $host in