]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* libtool.m4: When linking convenience libraries on Solaris
authorAlbert Chin-A-Young <china@thewrittenword.com>
Wed, 24 Mar 2004 03:06:48 +0000 (03:06 +0000)
committerScott James Remnant <scott@netsplit.com>
Wed, 24 Mar 2004 03:06:48 +0000 (03:06 +0000)
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.

ChangeLog
m4/libtool.m4
tests/tagdemo/Makefile.am
tests/tagdemo/conv.cpp [new file with mode: 0644]
tests/tagdemo/conv.h [new file with mode: 0644]
tests/tagdemo/main.cpp

index 8b229e2cbcdee7fa6fb281ab115a04c7e6244a5d..81ed1eece852f265f2be3d6fbfe1a2dd44f98f7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2004-03-24  Albert Chin-A-Young  <china@thewrittenword.com>
 
+       * 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.
 
index ea7b437ffd3d7ce7dcf803338bcb8aaf00903892..5346bf4c459dd983279eb023120b8513e4dffec4 100644 (file)
@@ -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
index 28eeee7b1f533a30d58e464c742b9da4eb70207a..e31abbb422ccbe2e2fbec78ab50b745ed4b79663 100644 (file)
 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 (file)
index 0000000..0713a19
--- /dev/null
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+//    conv.cpp -- trivial convenience test library
+//    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+//    Originally by Thomas Tanner <tanner@ffii.org>
+//    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 (file)
index 0000000..6f07a17
--- /dev/null
@@ -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 <tanner@ffii.org>
+//    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_ */
index 676acecae853ccbde78fe263625866f21ebbfc0f..556050bf82000bae036514dd76a489298314c6c6 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "foo.h"
 #include "baz.h"
+#include "conv.h"
 #include <iostream.h>
 
 
@@ -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;
 }