From e527fd58693c6ef7a7ba2e8b59d84bc1f22ff8a6 Mon Sep 17 00:00:00 2001 From: Tim Van Holder Date: Tue, 11 Sep 2001 03:18:52 +0000 Subject: [PATCH] * 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. --- ChangeLog | 18 ++++++++++++++++++ doc/PLATFORMS | 11 +++++++---- libltdl/ltdl.c | 7 +++++-- libtool.m4 | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- ltdl.m4 | 1 + 5 files changed, 81 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b4fe46563..15660d710 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-09-11 Gary V. Vaughan , Albert Chin . Tim Van Holder + + * 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 * libtool.m4 (ltdll_cmds): [$]0 doesn't appear to translate through diff --git a/doc/PLATFORMS b/doc/PLATFORMS index 9f3a12e9c..de20baa79 100644 --- a/doc/PLATFORMS +++ b/doc/PLATFORMS @@ -59,7 +59,7 @@ i*86-*-netbsd1.3I gcc 1.2e ok 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 @@ rs6000-ibm-aix4.1.4.0 gcc 1.2f ok (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 c47e31867..19293f4d0 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -86,8 +86,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA # include #endif -/* I have never seen a system without this: */ -#include +#if HAVE_ASSERT_H +# include +#else +# define assert(arg) ((void) 0) +#endif #include "ltdl.h" diff --git a/libtool.m4 b/libtool.m4 index 46c37bb70..066bf6a5c 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -149,6 +149,27 @@ _LT_AC_LTCONFIG_HACK ]) +# 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 @@ else ;; 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 + # , 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 <&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 491a08b17..615c4bc3f 100644 --- a/ltdl.m4 +++ b/ltdl.m4 @@ -32,6 +32,7 @@ AC_REQUIRE([AC_PROG_CC]) 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]) -- 2.47.2