* libtool.m4 (no_undefine_flag) [solaris*]: Don't set this flag if GCC < 3.0 with native ld, which introduces a dependency on libgcc.a under certain circumstances, which in turn violates -no-undefined. Also display a prominent configure time warning if the buggy combination of GCC and ld is detected. (AC_LIBTOOL_HEADER_ASSERT): libltdl falls foul of this bug because assert requires __eprintf from libgcc.a. This macro detects the combination of GCC and ld that produce this problem, and pretends that assert.h does not exist... * libltdl/ltdl.c (HAVE_ASSERT_H): ...so that assertions can be disabled in libltdl. Otherwise the library would only be useable when linking using gcc, or by manually adding libgcc.a to the link line of the application that uses libltdl. * ltdl.m4 (AC_LIB_LTDL): Require AC_LIBTOOL_HEADER_ASSERT. * doc/PLATFORMS: Updated.
diff --git a/ChangeLog b/ChangeLog index b4fe465..15660d7 100644 --- a/ChangeLog +++ b/ChangeLog
@@ -1,3 +1,21 @@ +2001-09-11 Gary V. Vaughan <gary@gnu.org>, Albert Chin <china@thewrittenword.com>. Tim Van Holder <tim.van.holder@pandora.be> + + * libtool.m4 (no_undefine_flag) [solaris*]: Don't set this flag + if GCC < 3.0 with native ld, which introduces a dependency on + libgcc.a under certain circumstances, which in turn violates + -no-undefined. Also display a prominent configure time warning if + the buggy combination of GCC and ld is detected. + (AC_LIBTOOL_HEADER_ASSERT): libltdl falls foul of this bug + because assert requires __eprintf from libgcc.a. This macro + detects the combination of GCC and ld that produce this problem, + and pretends that assert.h does not exist... + * libltdl/ltdl.c (HAVE_ASSERT_H): ...so that assertions can be + disabled in libltdl. Otherwise the library would only be useable + when linking using gcc, or by manually adding libgcc.a to the link + line of the application that uses libltdl. + * ltdl.m4 (AC_LIB_LTDL): Require AC_LIBTOOL_HEADER_ASSERT. + * doc/PLATFORMS: Updated. + 2001-06-25 Daniel Harvey <daniel@amristar.com.au> * libtool.m4 (ltdll_cmds): [$]0 doesn't appear to translate through
diff --git a/doc/PLATFORMS b/doc/PLATFORMS index 9f3a12e..de20baa 100644 --- a/doc/PLATFORMS +++ b/doc/PLATFORMS
@@ -59,7 +59,7 @@ i*86-*-netbsd1.2 gcc 0.9g ok i*86-*-linux-gnu gcc 1.3e ok (1.901) (Red Hat 7.0, gcc "2.96") -i*86-*-linux-gnu gcc 1.3e ok (1.911) +i*86-*-linux-gnu gcc 1.4.2 ok (SuSE 7.0, gcc 2.95.2) i*86-*-linux-gnulibc1 gcc 1.2f ok i*86-*-openbsd2.5 gcc 1.3c ok @@ -128,13 +128,16 @@ (gcc-2.7.2) rs6000-ibm-aix3.2.5 gcc 1.0i ok rs6000-ibm-aix3.2.5 xlc 1.0i ok -sparc-sun-solaris2.8 gcc 1.3e ok (1.913) - (gcc-2.95.3 & native ld) +sparc-sun-solaris2.8 gcc 1.4.2 ok + (gcc-2.95.2 & native ld) +sparc-sun-solaris2.8 gcc 1.4.2 ok + (gcc-3.0.1 & GNU ld 2.11.2) sparc-sun-solaris2.7 gcc 1.3e ok (1.913) (gcc-2.95.3 & native ld) sparc-sun-solaris2.6 gcc 1.3e ok (1.913) (gcc-2.95.3 & native ld) -sparc-sun-solaris2.5.1 gcc 1.3e ok (1.911) +sparc-sun-solaris2.5.1 gcc 1.4.2 ok + (gcc-2.95.1 & GNU ld 2.9.1) sparc-sun-solaris2.5 gcc 1.3b ok (egcs-1.1.2, GNU ld 2.9.1 & native ld) sparc-sun-solaris2.5 cc 1.3b ok
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index c47e318..19293f4 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c
@@ -86,8 +86,11 @@ # include <argz.h> #endif -/* I have never seen a system without this: */ -#include <assert.h> +#if HAVE_ASSERT_H +# include <assert.h> +#else +# define assert(arg) ((void) 0) +#endif #include "ltdl.h"
diff --git a/libtool.m4 b/libtool.m4 index 46c37bb..066bf6a 100644 --- a/libtool.m4 +++ b/libtool.m4
@@ -149,6 +149,27 @@ ]) +# AC_LIBTOOL_HEADER_ASSERT +# ------------------------ +AC_DEFUN([AC_LIBTOOL_HEADER_ASSERT], +[AC_CACHE_CHECK([whether $CC supports assert without backlinking], + [lt_cv_func_assert_works], + [case $host in + *-*-solaris*) + if test "$GCC" = yes && test "$with_gnu_ld" != yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) lt_cv_func_assert_works=no ;; + *) lt_cv_func_assert_works=yes ;; + esac + fi + ;; + esac]) + +if test "x$lt_cv_func_assert_works" = xyes; then + AC_CHECK_HEADERS(assert.h) +fi +])# AC_LIBTOOL_HEADER_ASSERT + # _LT_AC_CHECK_DLFCN # -------------------- AC_DEFUN([_LT_AC_CHECK_DLFCN], @@ -1708,7 +1729,35 @@ ;; solaris*) - no_undefined_flag=' -z text' + # gcc --version < 3.0 without binutils cannot create self contained + # shared libraries reliably, requiring libgcc.a to resolve some of + # the object symbols generated in some cases. Libraries that use + # assert need libgcc.a to resolve __eprintf, for example. Linking + # a copy of libgcc.a into every shared library to guarantee resolving + # such symbols causes other problems: According to Tim Van Holder + # <tim.van.holder@pandora.be>, C++ libraries end up with a separate + # (to the application) exception stack for one thing. + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + case `$CC --version 2>/dev/null` in + [[12]].*) + cat <<EOF 1>&2 + +*** Warning: Releases of GCC earlier than version 3.0 cannot reliably +*** create self contained shared libraries on Solaris systems, without +*** introducing a dependency on libgcc.a. Therefore, libtool is disabling +*** -no-undefined support, which will at least allow you to build shared +*** libraries. However, you may find that when you link such libraries +*** into an application without using GCC, you have to manually add +*** \`gcc --print-libgcc-file-name\` to the link command. We urge you to +*** upgrade to a newer version of GCC. Another option is to rebuild your +*** current GCC to use the GNU linker from GNU binutils 2.9.1 or newer. + +EOF + no_undefined_flag= + ;; + esac + fi # $CC -shared without GNU ld will not create a library from C++ # object files and a static libstdc++, better avoid it by now archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
diff --git a/ltdl.m4 b/ltdl.m4 index 491a08b..615c4bc 100644 --- a/ltdl.m4 +++ b/ltdl.m4
@@ -32,6 +32,7 @@ AC_REQUIRE([AC_C_CONST]) AC_REQUIRE([AC_HEADER_STDC]) AC_REQUIRE([AC_HEADER_DIRENT]) +AC_REQUIRE([AC_LIBTOOL_HEADER_ASSERT]) AC_REQUIRE([_LT_AC_CHECK_DLFCN]) AC_REQUIRE([AC_LTDL_ENABLE_INSTALL]) AC_REQUIRE([AC_LTDL_SHLIBEXT])