Fix disable-static -all-static (was: testsuite: 24 25 64 failed)

2008-03-24 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Mon, Mar 24, 2008 at 12:56:56PM CET:
 I'll address 25 separately (confirmed with --disable-static, BTW).

Proposed, slightly ugly patch.  Can you try it please, and do you have a
name and email address to put in the ChangeLog and THANKS?

Thus, OK to apply?  Note that our manual explicitly allows to use
-static even with --disable-static (which I am not sure whether it works
everywhere, but the static.at test should expose that when libtool is
configured that way), so the situation isn't quite clear-cut.

Cheers,
Ralf

2008-03-24  Ralf Wildenhues  [EMAIL PROTECTED]

Document that disable-static plus -all-static is not portable.
* doc/libtool.texi (Link mode): -all-static does not go well
with disable-static on most systems.
* tests/static.at (static linking flags for programs) [!aix]:
With --disable-static but nonempty link_static_flag, skip the
m-all-static link.  Do not skip it on AIX, as there the
enable_static is self-inflicted, and thus expected to work.
* THANKS: Update.
Report by Nix.

Index: doc/libtool.texi
===
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.239
diff -u -r1.239 libtool.texi
--- doc/libtool.texi4 Mar 2008 21:07:36 -   1.239
+++ doc/libtool.texi24 Mar 2008 12:37:17 -
@@ -1322,7 +1322,8 @@
 @item -all-static
 If @var{output-file} is a program, then do not link it against any
 shared libraries at all.  If @var{output-file} is a library, then only
-create a static library.
+create a static library.  In general, this flag cannot be used together
+with @samp{disable-static} (@pxref{LT_INIT}).
 
 @item -avoid-version
 Tries to avoid versioning (@pxref{Versioning}) for libraries and modules,
Index: tests/static.at
===
RCS file: /cvsroot/libtool/libtool/tests/static.at,v
retrieving revision 1.6
diff -u -r1.6 static.at
--- tests/static.at 25 Mar 2007 12:12:43 -  1.6
+++ tests/static.at 24 Mar 2008 12:31:42 -
@@ -1,6 +1,6 @@
 # static.at -- test flags for static/dynamic linking  -*- Autotest -*-
 #
-#   Copyright (C) 2006, 2007 Free Software Foundation, Inc.
+#   Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
 #   Written by Ralf Wildenhues, 2006
 #
 #   This file is part of GNU Libtool.
@@ -92,6 +92,16 @@
 if test -n $per_deplib_static_flag  test -n $per_deplib_dynamic_flag; 
then
   per_deplib=:
 fi
+# On GNU/Linux with --disable-static, m-all-static fails to link.
+# What we'd like to state here is: if the user actively passed
+# --disable-static (as opposed to: the libtool.m4 macros set
+# enable_static=no), then they cannot expect -all-static to work.
+# So we punt, knowing that we mangle enable_static on AIX only.
+can_link_all_static=-all-static
+case $host_os,$have_static,$link_static_flag in
+  aix*) ;;
+  *,false,?*) can_link_all_static= ;;
+esac
 
 # Create broken libraries.  They will later be moved to those
 # directories where the respective libraries should be linked
@@ -248,10 +258,10 @@
   $CC $CPPFLAGS $CFLAGS -c m.c
 
   # global static flags.
-  for st in -static -static-libtool-libs -all-static; do
+  for st in -static -static-libtool-libs $can_link_all_static; do
 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS $st -o m$st m.$OBJEXT \
- -L$libdir1 -la1 a2/liba2.la -L$libdir3 -R$libdir3 -la3],
-[0], [ignore], [ignore])
+   -L$libdir1 -la1 a2/liba2.la -L$libdir3 -R$libdir3 -la3],
+   [0], [ignore], [ignore])
   done
 
   # per-deplib static/shared flags.
@@ -296,7 +306,7 @@
 
   ### install the programs.
   # We can't install any program that links dynamically against liba2.
-  for st in -static -static-libtool-libs -all-static `$per_deplib  echo 2 12 
23 123 123a`; do 
+  for st in -static -static-libtool-libs $can_link_all_static `$per_deplib  
echo 2 12 23 123 123a`; do 
 echo # m$st
 AT_CHECK([$LIBTOOL --mode=install cp m$st $bindir/m$st], [0], [ignore], 
[stderr])
 if $have_static; then




Re: Fix disable-static -all-static (was: testsuite: 24 25 64 failed)

2008-03-24 Thread Bob Friesenhahn

On Mon, 24 Mar 2008, Ralf Wildenhues wrote:


* Ralf Wildenhues wrote on Mon, Mar 24, 2008 at 12:56:56PM CET:

I'll address 25 separately (confirmed with --disable-static, BTW).


Proposed, slightly ugly patch.  Can you try it please, and do you have a
name and email address to put in the ChangeLog and THANKS?

Thus, OK to apply?  Note that our manual explicitly allows to use
-static even with --disable-static (which I am not sure whether it works
everywhere, but the static.at test should expose that when libtool is
configured that way), so the situation isn't quite clear-cut.


This patch looks good to apply to me.

Bob
==
Bob Friesenhahn
[EMAIL PROTECTED], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,http://www.GraphicsMagick.org/





Re: Fix disable-static -all-static

2008-03-24 Thread Ralf Wildenhues
On Mon, Mar 24, 2008 at 01:42:19PM +, Nix wrote:
  * Ralf Wildenhues wrote on Mon, Mar 24, 2008 at 12:56:56PM CET:
  I'll address 25 separately (confirmed with --disable-static, BTW).
 
  Proposed, slightly ugly patch.
 
 It's only ugly if you consider it nasty to encode knowledge of the
 program being tested into the testsuite, and if that's bad then white-
 box testing is hopeless and most of the new libtool testsuite goes to
 the wall :)

No, it's ugly in that ideally, all per-system knowledge is encoded in
libtool.m4 and ltdl.m4, and expressed in the variables at the beginning
of the generated libtool script, and thus, all other code should just
decide based on that.

Thanks to you and Bob for the feedback, I've applied the patch.

Cheers,
Ralf




Re: Fix disable-static -all-static

2008-03-24 Thread Nix
On 24 Mar 2008, Ralf Wildenhues stated:

 * Ralf Wildenhues wrote on Mon, Mar 24, 2008 at 12:56:56PM CET:
 I'll address 25 separately (confirmed with --disable-static, BTW).

 Proposed, slightly ugly patch.

It's only ugly if you consider it nasty to encode knowledge of the
program being tested into the testsuite, and if that's bad then white-
box testing is hopeless and most of the new libtool testsuite goes to
the wall :)

 Can you try it please, and do you have a

Done. (The new faster testsuite in 2.2 is decidedly nice.)

...

 25: static linking flags for programs   ok

yay! only 24 55 64 failed now: no new failures.

 name and email address to put in the ChangeLog and THANKS?

Nix [EMAIL PROTECTED] will do: it's the name I use most.

 Thus, OK to apply?

I say go for it, for what (nothing) my word is worth. (The `static'
libraries on AIX aren't really what other systems think of as static
libraries anyway, are they, what with the dynamic linker being able to
use them and all.)

-- 
`The rest is a tale of post and counter-post.' --- Ian Rawlings
   describes USENET