[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug creating shared library with convenience libraries for Sun C++ c
From: |
Albert Chin |
Subject: |
Re: Bug creating shared library with convenience libraries for Sun C++ compiler |
Date: |
Sun, 14 Mar 2004 11:47:04 -0600 |
User-agent: |
Mutt/1.4i |
On Sun, Mar 14, 2004 at 02:43:41PM +0000, Scott James Remnant wrote:
> On Mon, 2004-02-16 at 07:37, Albert Chin wrote:
>
> > The patch below fixes this and reworks the tagdemo test.
> >
> Again, could you prepare this against current CVS HEAD.
Attached.
--
albert chin (address@hidden)
-- snip snip
2004-03-14 Albert Chin-A-Young <address@hidden>
* 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.
--- m4/libtool.m4 14 Mar 2004 15:05:37 -0000 1.51
+++ m4/libtool.m4 14 Mar 2004 16:27:07 -0000
@@ -5194,9 +5194,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
--- tests/tagdemo/Makefile.am 4 Jan 2004 20:45:24 -0000 1.4
+++ tests/tagdemo/Makefile.am 14 Mar 2004 16:27:07 -0000
@@ -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
--- tests/tagdemo/main.cpp 14 Oct 2003 21:46:13 -0000 1.1
+++ tests/tagdemo/main.cpp 14 Mar 2004 16:30:03 -0000
@@ -22,6 +22,7 @@
#include "foo.h"
#include "baz.h"
+#include "conv.h"
#include <iostream.h>
@@ -58,6 +59,11 @@ main (int, char *[])
// foobar_derived::foo(), which in turn calls ::foo().
if (bb->baz() == FOO_RET)
cout << "barbaz::baz is ok!" << endl;
+
+ // --------------
+
+ if (convenience())
+ cout << "convenience is ok!" << endl;
return 0;
}
--- /dev/null Sun Mar 24 15:28:28 2002
+++ tests/tagdemo/conv.h Sun Mar 14 10:31:19 2004
@@ -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 <address@hidden>
+// 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_ */
--- /dev/null Sun Mar 24 15:28:28 2002
+++ tests/tagdemo/conv.cpp Sun Mar 14 10:31:21 2004
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+// conv.cpp -- trivial convenience test library
+// Copyright (C) 1998-2000 Free Software Foundation, Inc.
+// Originally by Thomas Tanner <address@hidden>
+// 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;
+}