From: Albert Chin-A-Young Date: Wed, 24 Mar 2004 03:06:48 +0000 (+0000) Subject: * libtool.m4: When linking convenience libraries on Solaris X-Git-Tag: release-1-9b~122 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=735c5757810832a6ea724130f181e727d7d4e8bb;p=thirdparty%2Flibtool.git * libtool.m4: When linking convenience libraries on Solaris with the Sun C++ compiler, pass convenience libraries through to the linker with -Qoption between allextract/defaultextract. The Sun C++ compiler bundles -Qoption arguments so convenience libraries are linked with defaultextract otherwise. * tagdemo/Makefile.am, tagdemo/main.cpp, tagdemo/conv.h, tagdemo/conv.cpp: Augment tagdemo test to link a convenience library with a libtool library. --- diff --git a/ChangeLog b/ChangeLog index 8b229e2cb..81ed1eece 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2004-03-24 Albert Chin-A-Young + * libtool.m4: When linking convenience libraries on Solaris + with the Sun C++ compiler, pass convenience libraries through + to the linker with -Qoption between allextract/defaultextract. + The Sun C++ compiler bundles -Qoption arguments so + convenience libraries are linked with defaultextract + otherwise. + * tagdemo/Makefile.am, tagdemo/main.cpp, tagdemo/conv.h, + tagdemo/conv.cpp: Augment tagdemo test to link a convenience + library with a libtool library. + * ltmain.in: Piecewise linking doesn't work when the output file is an absolute path, use the basename only instead. diff --git a/m4/libtool.m4 b/m4/libtool.m4 index ea7b437ff..5346bf4c4 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -5123,9 +5123,13 @@ case $host_os in *) # The C++ compiler is used as linker so we must use $wl # flag to pass the commands to the underlying system - # linker. + # linker. We must also pass each convience library through + # to the system linker between allextract/defaultextract. + # The C++ compiler will combine linker options so we + # cannot just pass the convience library names through + # without $wl. # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;; esac _LT_AC_TAGVAR(link_all_deplibs, $1)=yes diff --git a/tests/tagdemo/Makefile.am b/tests/tagdemo/Makefile.am index 28eeee7b1..e31abbb42 100644 --- a/tests/tagdemo/Makefile.am +++ b/tests/tagdemo/Makefile.am @@ -20,19 +20,23 @@ AUTOMAKE_OPTIONS = no-dependencies foreign ACLOCAL_AMFLAGS = -I ../../m4 -noinst_LTLIBRARIES = libfoo.la -lib_LTLIBRARIES = libbaz.la +noinst_LTLIBRARIES = libconv.la +lib_LTLIBRARIES = libfoo.la libbaz.la libfoo_la_SOURCES = foo.cpp libfoo_la_LDFLAGS = -no-undefined -libfoo_la_LIBADD = $(LIBM) +libfoo_la_LIBADD = libconv.la $(LIBM) # Test some of the ILD support when using tagged configurations. libbaz_la_SOURCES = baz.cpp libbaz_la_LDFLAGS = -no-undefined libbaz_la_LIBADD = libfoo.la -noinst_HEADERS = foo.h baz.h +# Test convenience libraries. +libconv_la_SOURCES = conv.cpp +libconv_la_LDFLAGS = -no-undefined + +noinst_HEADERS = foo.h baz.h conv.h bin_PROGRAMS = tagdemo diff --git a/tests/tagdemo/conv.cpp b/tests/tagdemo/conv.cpp new file mode 100644 index 000000000..0713a1972 --- /dev/null +++ b/tests/tagdemo/conv.cpp @@ -0,0 +1,29 @@ +// -*- C++ -*- +// conv.cpp -- trivial convenience test library +// Copyright (C) 1998-2000 Free Software Foundation, Inc. +// Originally by Thomas Tanner +// This file is part of GNU Libtool. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. + +#include "conv.h" + +// Our C functions. +int +convenience(void) +{ + return 1; +} diff --git a/tests/tagdemo/conv.h b/tests/tagdemo/conv.h new file mode 100644 index 000000000..6f07a170b --- /dev/null +++ b/tests/tagdemo/conv.h @@ -0,0 +1,32 @@ +// -*- C++ -*- +// conv.h -- part of the interface to the libfoo* libraries +// Copyright (C) 1998-1999 Free Software Foundation, Inc. +// Originally by Thomas Tanner +// This file is part of GNU Libtool. + +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +// USA. + +// Only include this header file once. +#ifndef _CONV_H_ +#define _CONV_H_ 1 + +// Our C test functions. +extern "C" +{ + int convenience(void); +} + +#endif /* !_CONV_H_ */ diff --git a/tests/tagdemo/main.cpp b/tests/tagdemo/main.cpp index 676acecae..556050bf8 100644 --- a/tests/tagdemo/main.cpp +++ b/tests/tagdemo/main.cpp @@ -22,6 +22,7 @@ #include "foo.h" #include "baz.h" +#include "conv.h" #include @@ -59,5 +60,10 @@ main (int, char *[]) if (bb->baz() == FOO_RET) cout << "barbaz::baz is ok!" << endl; + // -------------- + + if (convenience()) + cout << "convenience is ok!" << endl; + return 0; }