Re: PATCH: Don't fall back to static libraries if building them was disabled.

Brooks Moses <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches,gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
On 07/07/2011 08:37 AM, Vadim Zeitlin wrote:
> On Thu, 23 Jun 2011 23:07:17 +0200 Peter Rosin <[email protected]> wrote:
> PR> Den 2011-06-23 14:25 skrev Vadim Zeitlin:
> PR> > Am I the only one to think that this behaviour is singularly
> PR> > unhelpful?
> PR>
> PR> Of course not, others have stated that a patch would be welcome to
> PR> fix --disable-static (and --enable-shared) to error out if it is not
> PR> possible to create a shared library (due to a missing -no-undefined).
>
>   Sorry for the delay, I got distracted by other things but here is finally
> the promised trivial patch (I also cc it to libtool-patches just in case,
> sorry if you get this message twice):

Looks like there's consensus that this at least is an improvement, so I've 
committed it as attached.  (I also amended the warning slightly to make it 
clear what it meant for the build.)

Thanks,
- Brooks
0001-libtool-Don-t-fall-back-to-static-libraries-if-build.patch (text/x-patch, 1.8 KB)
From 12641bdc45d091fd1e014d242dcf271237f3c95c Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <[email protected]>
Date: Wed, 9 Oct 2013 17:35:13 -0700
Subject: [PATCH] libtool: Don't fall back to static libraries if building them
 was disabled

If -no-undefined was not specified but the platform didn't
support shared libraries with undefined symbols (e.g. Cygwin/
MinGW), static libraries were built instead of shared ones,
even if building them was explicitly disabled with --disable-
static configure option.

Fix this by stopping with a fatal error if a shared library
can't be built in this case instead of unexpectedly building a
static library instead.

* libltdl/config/ltmain.m4sh (func_mode_link()): Stop with
fatal error when trying to build a shared library without -no-
undefined on a platform not supporting undefined symbols in
shared libraries.

Copyright-paperwork-exempt: Yes
---
 build-aux/ltmain.in | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 363ce9b..58b443c 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -6984,9 +6984,12 @@ func_mode_link ()
 	# Check to see if the archive will have undefined symbols.
 	if test yes = "$allow_undefined"; then
 	  if test unsupported = "$allow_undefined_flag"; then
-	    func_warning "undefined symbols not allowed in $host shared libraries"
-	    build_libtool_libs=no
-	    build_old_libs=yes
+	    if test "$build_old_libs" = yes; then
+	      func_warning "undefined symbols not allowed in $host shared libraries; building static only"
+	      build_libtool_libs=no
+	    else
+	      func_fatal_error "can't build $host shared library unless -no-undefined is specified"
+	    fi
 	  fi
 	else
 	  # Don't allow undefined symbols.
-- 
1.8.4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.