Re: [GNU Autoconf 2.60] testsuite: 3 120 failed

2007-02-11 Thread Ralf Wildenhues
Hello Paul, all,

http://thread.gmane.org/gmane.comp.sysutils.autoconf.bugs/5266/focus=5549

* Paul Eggert wrote on Thu, Oct 12, 2006 at 09:45:24PM CEST:
 Ralf Wildenhues [EMAIL PROTECTED] writes:
 
  This patch kills $as_executable_p.  This breaks libtool.m4 from
  Libtool-1.5.22 (and possibly CVS HEAD, I haven't checked).
 
 OK, I installed this backward-compatibility hack.  I assume
 you'll be fixing libtool?
 
 2006-10-12  Paul Eggert  [EMAIL PROTECTED]
 
   * lib/m4sugar/m4sh.m4 (_AS_TEST_PREPARE): Set as_executable_p,
   for backward compatibility with Libtool 1.5.22.  Problem reported
   by Ralf Wildenhues.

Some things to be aware of here:

1) Libtool branch-1-5 aims to be compatible to Autoconf-2.50; also I aim
   to not add more unnecessary incompatibilities with Autoconf-2.13, as
   there are users who patch the missing bits to make it compatible with
   it.

2) Libtool (at least branch-1-5) aims to be compatible to Automake-1.4.

3) Autoconf-2.61b (CVS) still doesn't document AS_EXECUTABLE_P.

Do you think the approach below is safe enough?  Note I intentionally do
not use the _AS_TEST_PREPARE from 2.61: if you use new enough Autoconf,
then that is already defined and will be used.

Can I assume that AS_EXECUTABLE_P may eventually be made a public
Autoconf interface (then we could just do away with our copy of
_AS_TEST_PREPARE and AS_EXECUTABLE_P)?

Note CVS HEAD Libtool doesn't need this: it uses $as_executable_p only
in its version of AC_PROG_SED, which itself is not defined iff already
given by Autoconf.

OK to apply?

Cheers,
Ralf

2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

* libtool.m4 (_AS_TEST_PREPARE, AS_EXECUTABLE_P): m4_defun
these macros, if undefined, with copies from Autoconf 2.59.
(LT_AC_PROG_SED): Use AS_EXECUTABLE_P, not $as_executable_p,
this is an internal Autoconf detail.

Index: libtool.m4
===
RCS file: /cvsroot/libtool/libtool/Attic/libtool.m4,v
retrieving revision 1.314.2.170
diff -u -r1.314.2.170 libtool.m4
--- libtool.m4  5 Feb 2007 19:40:53 -   1.314.2.170
+++ libtool.m4  11 Feb 2007 09:31:44 -
@@ -6483,6 +6483,26 @@
 [AC_CHECK_TOOL(RC, windres, no)
 ])
 
+
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
+
+# _AS_TEST_PREPARE
+# 
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[as_executable_p=test -f
+])])# _AS_TEST_PREPARE
+
+# AS_EXECUTABLE_P
+# ---
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
+
 
 # NOTE: This macro has been submitted for inclusion into   #
 #  GNU Autoconf as AC_PROG_SED.  When it is available in   #
@@ -6505,7 +6525,7 @@
   test -z $as_dir  as_dir=.
   for lt_ac_prog in sed gsed; do
 for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p $as_dir/$lt_ac_prog$ac_exec_ext; then
+  if AS_EXECUTABLE_P([$as_dir/$lt_ac_prog$ac_exec_ext]); then
 lt_ac_sed_list=$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext
   fi
 done




FYI: update copyright years in libtool.texi

2007-02-11 Thread Ralf Wildenhues
Applied to HEAD and branch-1-5, respectively.

Cheers,
Ralf

HEAD:
2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

* doc/libtool.texi: Update copyright years.

Index: doc/libtool.texi
===
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.218
diff -u -r1.218 libtool.texi
--- doc/libtool.texi23 Jan 2007 23:48:55 -  1.218
+++ doc/libtool.texi11 Feb 2007 11:09:55 -
@@ -24,7 +24,7 @@
 @ifnottex
 This file documents GNU Libtool @value{VERSION}
 
-Copyright (C) 1996-2006 Free Software Foundation, Inc.
+Copyright (C) 1996-2007 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1
@@ -51,7 +51,7 @@
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 2006 Free Software Foundation, Inc.
+Copyright @copyright{} 2007 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the @sc{gnu} Free Documentation License, Version 1.1
@@ -5626,7 +5626,7 @@
 trick$ libtool --version
 ltmain.sh (GNU @@PACKAGETIMESTAMP@@) @@VERSION@@
 
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2007 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 trick$

branch-1-5:
2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

* doc/libtool.texi: Update copyright years.

Index: doc/libtool.texi
===
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.134.2.19
diff -u -r1.134.2.19 libtool.texi
--- doc/libtool.texi27 Jan 2007 17:28:14 -  1.134.2.19
+++ doc/libtool.texi11 Feb 2007 11:10:22 -
@@ -24,7 +24,7 @@
 @ifnottex
 This file documents GNU Libtool @value{VERSION}
 
-Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc.
+Copyright (C) 1996-2003, 2005-2007 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1
@@ -51,7 +51,7 @@
 
 @page
 @vskip 0pt plus 1filll
-Copyright @copyright{} 1996-2003 Free Software Foundation, Inc.
+Copyright @copyright{} 1996-2003, 2005-2007 Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.1




HEAD: document old macro names and undeprecate some

2007-02-11 Thread Ralf Wildenhues
This patch fixes a documentation regression: It adds documentation for
the branch-1-5 macro naming scheme to HEAD's manual, listing most of the
old macro names as deprecated.  Since however some of the old macro
names provide functionality not possible with LT_INIT, it also
resurrects some macros as non-deprecated.  For example, invoking
AC_DISABLE_STATIC in a shell conditional works at least partly[1] (and
is used quite a bit in real-world packages).  AFAICS this is not
possible with LT_INIT([disable-static]).

Do you think that
  AC_ENABLE_FAST_INSTALL
  AM_ENABLE_FAST_INSTALL
  AC_LIBTOOL_PICMODE

should also be documented?  They are undocumented in branch-1-5; I left
them undocumented for now.

Do you think that undeprecating AC_{DISABLE,ENABLE}_{SHARED,STATIC} is a
bad idea and that they should be named LT_* instead?  FWIW, I am very
reluctant to go this route as this would introduce yet another name for
the same thing (already 4 names then: AM_X, AC_X, LT_INIT(x) and
LT_X then).

Several people have reported these issues; I have forgotten who it was,
sorry.  Speak up and you will be mentioned in the ChangeLog entry.

OK to apply?  Patch not tested very much yet.

Cheers,
Ralf

[1] There are at least two glitches with putting AC_DISABLE_SHARED et al
in a shell conditional: first, I think if you put it in one execution
branch, you have to ensure all other branches see one of the *_SHARED
macros as well.  Second, the output of the default value with --help may
be wrong then.  I may be looking into a fix eventually...


2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

* doc/libtool.texi (LT_INIT): Fix wording of intro a bit.
shared, static: Also describe these default LT_INIT options.
AC_LIBTOOL_DLOPEN, AC_LIBTOOL_WIN32_DLL
AC_DISABLE_FAST_INSTALL: Mention deprecated macro names,
including the respective LT_INIT replacement.
AC_DISABLE_SHARED, AC_DISABLE_STATIC, AC_ENABLE_SHARED
AC_ENABLE_STATIC: Document, un-deprecate.  Suggest the
respective LT_INIT replacement.
AM_DISABLE_SHARED, AM_DISABLE_STATIC, AM_ENABLE_SHARED
AM_ENABLE_STATIC: Document deprecated aliases.
(Distributing libltdl) AC_WITH_LTDL, AC_LIBLTDL_INSTALLABLE
AC_LIBLTDL_CONVENIENCE: Document deprecated aliases.
* libltdl/m4/ltoptions.m4 (AM_ENABLE_SHARED, AM_DISABLE_SHARED)
(AM_ENABLE_STATIC, AM_DISABLE_STATIC): Make these AU_ALIASes of
the respective AC_* macros, so we do not recommend LT_INIT(*) in
this case.
(AC_ENABLE_SHARED, AC_DISABLE_SHARED, AC_ENABLE_STATIC)
(AC_DISABLE_STATIC): Un-deprecate these.  Remove now-superfluous
aclocal-1.4 backwards compatibility comments.

Index: doc/libtool.texi
===
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.219
diff -u -r1.219 libtool.texi
--- doc/libtool.texi11 Feb 2007 11:11:05 -  1.219
+++ doc/libtool.texi11 Feb 2007 13:44:05 -
@@ -1862,7 +1862,8 @@
 If you are using @sc{gnu} Autoconf (or Automake), you should add a call to
 @code{LT_INIT} to your @file{configure.ac} file.  This macro
 adds many new tests to the @code{configure} script so that the generated
-libtool script will understand the characteristics of the host:
+libtool script will understand the characteristics of the host.  It's the
+most important of a number of macros defined by Libtool:
 
 @defmac LT_PREREQ (@var{VERSION})
 Ensure that a recent enough version of Libtool is being used.  If the
@@ -1891,10 +1892,7 @@
 and also enables static libraries if they don't conflict with the shared
 libraries.  You can modify these defaults by passing either
 @code{disable-shared} or @code{disable-static} in the option list to
[EMAIL PROTECTED]:@footnote{This used to be done with additional macro
-calls, @code{AC_DISABLE_SHARED} and @code{AC_DISABLE_STATIC}.  If you
-are upgrading from such an old version, again @code{autoupdate} is your
-friend.}
[EMAIL PROTECTED], or using @code{AC_DISABLE_SHARED} or 
@code{AC_DISABLE_STATIC}.
 
 @example
 # Turn off shared libraries during beta-testing, since they
@@ -1976,11 +1974,27 @@
 default, depending on platform support, by specifying
 @option{--enable-fast-install} to @command{configure}.
 
[EMAIL PROTECTED] shared
+Change the default behaviour for @code{LT_INIT} to enable
+shared libraries.  This is the default on all systems where
+Libtool knows how to create shared libraries.
+The user may still override this default by specifying
[EMAIL PROTECTED] to @command{configure}.
+
 @item disable-shared
 Change the default behaviour for @code{LT_INIT} to disable
 shared libraries.  The user may still override this default by
 specifying @option{--enable-shared} to @command{configure}.
 
[EMAIL PROTECTED] static
+Change the default behaviour for @code{LT_INIT} to enable
+static libraries.  This is the default on all systems where
+shared 

HEAD: speed up compile mode

2007-02-11 Thread Ralf Wildenhues
Separating out func_mode_link into a separate file shaves off roughly
30% of the script execution time of `libtool --mode=compile'.  But
having yet another script hampers portability and simplicity.  A nice
thing is that it's not necessary.  It's sufficient to merely not to
have to parse the bulk of the script for this sort of speedup:

- Split up the main function to call func_mode_* right after the
  function definition.
- Move all functions (including call) in weighted priority of both
  expected usage number, average execution time per usage, and size.
  IOW, func_mode_compile first, func_mode_link and all functions that
  are only needed by it last.

Compared to branch-1-5, HEAD then needs less than half as long for
compile mode.  Here's an example:

Compiling 100 objects of CLN with `libtool -n ... /dev/null'.  That is,
measuring script overhead only.  The sources are C++, the --tag=CXX
argument is not passed so func_infer_tag has to do work.

branch-1-5:
10.18user 7.39system 0:17.54elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+1737723minor)pagefaults 0swaps

HEAD:
8.84user 3.24system 0:12.29elapsed 98%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+740140minor)pagefaults 0swaps

HEAD with a separate libtool-link script:
5.55user 2.77system 0:08.32elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+686277minor)pagefaults 0swaps

HEAD with the Main split (patch below):
5.63user 2.71system 0:08.32elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+682353minor)pagefaults 0swaps

HEAD with patch below plus reordering of functions:
5.29user 2.91system 0:08.05elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+680683minor)pagefaults 0swaps

Interestingly, adding --tag=CXX slows down the build by 2%.  Using the
C compiler instead of the C++ compiler (thus avoiding the need to search
for another tag) is 18% faster, where again passing --tag=CC slows down
things a bit.  (But see the next patch.)


OK to apply?  This set of patches is a helper for the 2.0 release in
that it helps test Libtool more efficiently.  ;-)

Seriously though, if you see any problems with this, then we can
postpone them.  They have seen quite some test exposure though, since I
wrote them some months ago.  Anyway I'd want to postpone any moving of
functions until we use something better than CVS and viewcvs.

Note the shell function markers are not needed any more.  They were
added by Peter on 2004-12-20 and went obsolete by the change by Peter
and Alexandre on 2005-04-17.  I'm removing them, now that we'd need a
lot more of them.

Cheers,
Ralf

2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

Eliminate roughly a third of the script execution time overhead
for all modes except for link/relink and uninstall/clean.

* libltdl/m4/libtool.m4 (_LT_CONFIG): Remove unused `TEST SUITE
MARKER', obsolete since 2005-04-17.
* libltdl/config/ltmain.m4sh: Likewise, several instances.
(Main): Tear apart, moving individual bits up as early in the
script as possible, to help the shell to avoid parsing the rest.

Index: libltdl/config/ltmain.m4sh
===
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.59
diff -u -r1.59 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  28 Jan 2007 15:13:25 -  1.59
+++ libltdl/config/ltmain.m4sh  11 Feb 2007 14:49:41 -
@@ -425,7 +425,6 @@
 exit $?
 }
 
-# TEST SUITE MARKER ## NON-FUNCTION
 # Parse options once, thoroughly.  This comes as soon as possible in
 # the script to make things like `libtool --version' happen quickly.
 {
@@ -576,7 +575,6 @@
   # anything was wrong.
   $exit_cmd $EXIT_FAILURE
 }
-# TEST SUITE MARKER ## BEGIN SOURCABLE
 
 # func_check_version_match
 # Ensure that we are using m4 macros, and libtool script from the same
@@ -614,6 +612,38 @@
 }
 
 
+## --- ##
+##Main.##
+## --- ##
+
+{
+  # Sanity checks first:
+  func_check_version_match
+
+  if test $build_libtool_libs != yes  test $build_old_libs != yes; then
+func_fatal_configuration not configured to build any kind of library
+  fi
+
+  test -z $mode  func_fatal_error error: you must specify a MODE.
+
+
+  # Darwin sucks
+  eval std_shrext=\$shrext_cmds\
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n $execute_dlfiles  test $mode != execute; then
+func_error unrecognized option \`-dlopen'
+$ECHO $help 12
+exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help=$help
+  help=Try \`$progname --help --mode=$mode' for more information.
+}
+
+
 # func_lalib_p file
 # True iff FILE is a libtool `.la' library or `.lo' object file.
 # This function is only a basic sanity check; it will hardly flush out
@@ -1549,6 +1579,8 @@
 exit $EXIT_SUCCESS
 }
 
+test $mode = compile  

HEAD: option splitting in shell

2007-02-11 Thread Ralf Wildenhues
This improves script time for compile mode by roughly 7% with bash on
GNU/Linux, for C++ sources, without passing --tag=CXX, i.e., letting
func_infer_tag do its job.  With this patch, passing --tag=CXX saves
another 4% on top, as it should be.  ;-)

This patch conflicts (trivially) with the other two speedup patches;
apply this one second.

Cheers,
Ralf

2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

* libltdl/m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): New function
func_opt_split, for XSI and portable shell.
* libltdl/config/ltmain.m4sh: Move the insertion point for the
configure-generated shell functions to before the first option
parsing loop.  Rewrite the separation of the long options to use
func_opt_split.

Index: libltdl/m4/libtool.m4
===
RCS file: /cvsroot/libtool/libtool/libltdl/m4/libtool.m4,v
retrieving revision 1.90
diff -u -r1.90 libtool.m4
--- libltdl/m4/libtool.m4   5 Feb 2007 19:40:18 -   1.90
+++ libltdl/m4/libtool.m4   11 Feb 2007 14:53:07 -
@@ -7041,6 +7040,13 @@
   func_stripname_result=${func_stripname_result#${1}}
   func_stripname_result=${func_stripname_result%${2}}
 }
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
 _LT_EOF
 ;;
   *) # Bourne compatible functions.
@@ -7080,6 +7086,17 @@
| $Xsed -e s%^${1}%% -e s%${2}\$%%`;;
   esac
 }
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO X${1} | $Xsed -e $my_sed_long_opt`
+  func_opt_split_arg=`$ECHO X${1} | $Xsed -e $my_sed_long_arg`
+}
 _LT_EOF
 esac
 
Index: libltdl/config/ltmain.m4sh
===
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.59
diff -u -r1.59 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  28 Jan 2007 15:13:25 -  1.59
+++ libltdl/config/ltmain.m4sh  11 Feb 2007 14:53:10 -
@@ -425,14 +425,12 @@
 exit $?
 }
 
+# Generated shell functions inserted here.
+
+
 # Parse options once, thoroughly.  This comes as soon as possible in
 # the script to make things like `libtool --version' happen quickly.
 {
-  # sed scripts:
-  my_sed_single_opt='1s/^\(..\).*$/\1/;q'
-  my_sed_single_rest='1s/^..\(.*\)$/\1/;q'
-  my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
-  my_sed_long_arg='1s/^-[[^=]]*=//'
 
   # Shorthand for --mode=foo, only valid as the first argument
   case $1 in
@@ -525,28 +522,11 @@
 
   # Separate optargs to long options:
   -dlopen=*|--mode=*|--tag=*)
-   arg=`$ECHO X$opt | $Xsed -e $my_sed_long_arg`
-   opt=`$ECHO X$opt | $Xsed -e $my_sed_long_opt`
-   set dummy $opt $arg ${1+$@}
+   func_opt_split $opt
+   set dummy $func_opt_split_opt $func_opt_split_arg 
${1+$@}
shift
;;
 
-  # Separate optargs to short options:
-#  -x*|-y*)
-#  arg=`$ECHO X$opt |$Xsed -e $my_sed_single_rest`
-#  opt=`$ECHO X$opt |$Xsed -e $my_sed_single_opt`
-#  set dummy $opt $arg ${1+$@}
-#  shift
-#  ;;
-
-  # Separate non-argument short options:
-#  -z*|-z*|-y*)
-#  rest=`$ECHO X$opt |$Xsed -e $my_sed_single_rest`
-#  opt=`$ECHO X$opt |$Xsed -e $my_sed_single_opt`
-#  set dummy $opt -$rest ${1+$@}
-#  shift
-#  ;;
-
   -\?|-h)  func_usage  ;;
   --help)  opt_help=:  ;;
   --version)   func_version;;




Re: HEAD: speed up compile mode

2007-02-11 Thread Peter O'Gorman


On Feb 11, 2007, at 11:59 PM, Ralf Wildenhues wrote:




OK to apply?  This set of patches is a helper for the 2.0 release in
that it helps test Libtool more efficiently.  ;-)




Just gave it a quick read. Looks fine to me, please apply (and thank  
you!).


Peter




Re: HEAD: option splitting in shell

2007-02-11 Thread Peter O'Gorman


On Feb 12, 2007, at 12:00 AM, Ralf Wildenhues wrote:


This improves script time for compile mode by roughly 7% with bash on
GNU/Linux, for C++ sources, without passing --tag=CXX, i.e., letting
func_infer_tag do its job.  With this patch, passing --tag=CXX saves
another 4% on top, as it should be.  ;-)

This patch conflicts (trivially) with the other two speedup patches;
apply this one second.


Not tested this one either, but looks fine.

Peter




Re: HEAD: lo2o in shell

2007-02-11 Thread Peter O'Gorman


On Feb 12, 2007, at 12:01 AM, Ralf Wildenhues wrote:


This improves script time for compile mode by roughly 3% with bash on
GNU/Linux.  Rewriting lists of objects is best done the way we do it
already with sed, that's why not all instances of $lo2o are killed.

This patch conflicts trivially with the other speedup patches; apply
this one last.


This one makes sense too.

Peter




Re: HEAD: speed up compile mode

2007-02-11 Thread Ralf Wildenhues
Hi Peter,

* Peter O'Gorman wrote on Sun, Feb 11, 2007 at 04:26:54PM CET:
 On Feb 11, 2007, at 11:59 PM, Ralf Wildenhues wrote:
 
 OK to apply?  This set of patches is a helper for the 2.0 release in
 that it helps test Libtool more efficiently.  ;-)

 Just gave it a quick read. Looks fine to me, please apply (and thank  
 you!).

* Peter O'Gorman wrote on Sun, Feb 11, 2007 at 04:30:01PM CET:
 
 Not tested this one either, but looks fine.

* Peter O'Gorman wrote on Sun, Feb 11, 2007 at 04:32:34PM CET:
 
 This one makes sense too.

Thanks for all your speedy reviews!  I applied all three patches.

Cheers,
Ralf




FYI: HEAD: new export.at test

2007-02-11 Thread Ralf Wildenhues
The new cmdline_wrap.test fails on most systems.  For those not so
familiar with this relatively new test: what it does is take the libtool
script, set max_cmd_len very low so that all kinds of command line
wrapping actions are triggered in link mode.  And then all those tests
in the testsuite that exercise the plain libtool script, are rerun with
the modified script.  Of course, if any of those other tests fail for
another reason, then cmdline_wrap will also fail, but of course some
failure cases are only triggered by it.

While looking into this, I noticed several distinct but related bugs:

1) The linker script and reloadable object file generation code assumed
that at least one object is present on the command line.  The
convenience tests showed that many compilers cope with only having
convenience archives listed as input to a library.  If possible, I would
like Libtool to cope with that, because it is convenient for users; if
not, then we should start to think about warning against it in
func_mode_link.  Anyway my current thinking is that we shouldn't give up
just yet.  (Also, Automake usually needs a source file for a library to
be able deduce the right --tag, but that can be worked around by passing
that manually in *_LIBTOOLFLAGS.)

2) If there are only convenience archives as library inputs, then using
-export-symbols{,-regex} would mistakenly export all symbols.  Also,
some $EGREP would on some systems try to read a nonexisting file
(causing another failure).

3) -export-symbols-regex fails to hide symbols if the command line
length was exceeded.

The convenience tests run inside cmdline_wrap expose (1), the patch
below adds a test adapted from stresstest.at that also exposes (2) and
(3) (in conjunction with cmdline_wrap).  I would like to fix all
failures at once, due to the intertwined code in ltmain.  Currently,
I'm about half-way through.  I'll post what I have in a followup mail
FYI, but won't apply it.

After this is fixed, there is still a (at least one ;-) scenario where
we don't cope with long command lines: if merely the list of passed
convenience archives exceeds the limit.  But that can be worked around
by the user, by simply subsuming some convenience archives in another
convenience archive.

Cheers,
Ralf

2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

* tests/export.at: New test: expose -export-symbols failure
when the input consists solely of convenience archives, and
failure to not export all symbols when the command line length
is exceeded.
* Makefile.am: Adjust.

Index: Makefile.am
===
RCS file: /cvsroot/libtool/libtool/Makefile.am,v
retrieving revision 1.206
diff -u -r1.206 Makefile.am
--- Makefile.am 6 Feb 2007 19:19:45 -   1.206
+++ Makefile.am 11 Feb 2007 16:41:18 -
@@ -407,6 +407,7 @@
  tests/fail.at \
  tests/shlibpath.at \
  tests/static.at \
+ tests/export.at \
  tests/search-path.at \
  tests/destdir.at \
  tests/old-m4-iface.at \
--- /dev/null   2007-02-11 11:22:03.168311497 +0100
+++ tests/export.at 2007-02-11 17:40:24.0 +0100
@@ -0,0 +1,164 @@
+# Hand crafted tests for GNU Libtool. -*- Autotest -*-
+# Copyright 2007 Free Software Foundation, Inc.
+
+# 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, 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., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# Test symbol exports.
+
+AT_SETUP([Export test])
+AT_KEYWORDS([libtool])
+
+AT_CHECK([$LIBTOOL --features | grep 'disable shared libraries'  (exit 77)],
+[1], [ignore])
+AT_CHECK([eval `$LIBTOOL --config | sed -n '/^archive_expsym_cmds=/,/^$/p'`
+  test -n $archive_expsym_cmds || echo false can-hide])
+can_hide=:
+test -s can-hide  can_hide=false
+
+LDFLAGS=$LDFLAGS -no-undefined
+libdir=`pwd`/inst/lib
+mkdir inst inst/lib
+
+AT_DATA(a.c,
+[[/* all kinds of data items */
+#ifdef __cplusplus
+extern C {
+#endif
+
+int v1;
+static int v2;
+int v3 = 0;
+int v4 = 1;
+extern const int v5, v6;
+extern const char *v7;
+extern const char v8[];
+extern int (*const v12) (void);
+const int v5 = 0;
+const int v6 = 1;
+const char* v7 = \01foo;
+const char v8[] = \01bar;
+int v9(void) { return v2 + 1; }
+int (*v10) (void);
+int (*v11) (void) = v9;
+int (*const v12) 

Re: [GNU Autoconf 2.60] testsuite: 3 120 failed

2007-02-11 Thread Bob Friesenhahn

On Sun, 11 Feb 2007, Peter O'Gorman wrote:


Hi Ralf,

Could we test if test -x works and use that? I know that this is barely used, 
but it bugs me that test -f does not test for the executable bit :)


I think autoconf has this:

if test -x / /dev/null 21; then
  as_executable_p='test -x'
else
 as_executable_p='test -f'
fi


I seem to recall that with some versions of the MSYS shell 'test -x' 
pretends to work (but does not).  It is best to make sure before 
depending on it.  Some systems don't support the notion of 
'executable' files.


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





Re: FYI: HEAD: new export.at test

2007-02-11 Thread Ralf Wildenhues
* Ralf Wildenhues wrote on Sun, Feb 11, 2007 at 05:47:16PM CET:
 I would like to fix all failures at once, due to the intertwined code
 in ltmain.  Currently, I'm about half-way through.  I'll post what I
 have in a followup mail FYI, but won't apply it.

This patch makes the cmdline_wrap test pass on GNU/Linux and newer
Solaris.  Showing 'diff -b', hiding the indentation of the large
block inside `if $have_libobjs'.

Cheers,
Ralf

2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

Fix -export-symbols and -export-symbols-regex for links that
exceed the command line length and use convenience archives.

* libltdl/config/ltmain.m4sh (func_mode_link) have_libobjs:
New variable, to avoid being sensitive to $libobjs containing a
single space.
(func_mode_link): Avoid grepping a nonexistent file if using
reloadable objects.  Do not create a linker script nor a linker
input file if no objects are passed.  Apply export_symbols_regex
in case the command line length is exceeded.

Index: libltdl/config/ltmain.m4sh
===
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.62
diff -u -b -r1.62 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  11 Feb 2007 16:22:42 -  1.62
+++ libltdl/config/ltmain.m4sh  11 Feb 2007 18:15:35 -
@@ -5088,6 +5088,11 @@
# Use standard objects if they are pic
test -z $pic_flag  libobjs=`$ECHO X$libobjs | $SP2NL | $Xsed -e 
$lo2o | $NL2SP`
 
+   case $libobjs in
+   *[[!\ ]]*) have_libobjs=: ;;
+   *) have_libobjs=false ;;
+   esac
+
delfiles=
if test -n $export_symbols  test -n $include_expsyms; then
  $opt_dry_run || cp $export_symbols $output_objdir/$libname.uexp
@@ -5140,7 +5145,7 @@
  fi
done
IFS=$save_ifs
-   if test -n $export_symbols_regex; then
+   if test -n $export_symbols_regex  test X$skipped_export != 
X:; then
  func_show_eval '$EGREP -e $export_symbols_regex 
$export_symbols  ${export_symbols}T'
  func_show_eval '$MV ${export_symbols}T $export_symbols'
fi
@@ -5251,7 +5256,7 @@
  last_robj=
  k=1
 
- if test X$skipped_export != X:  test $with_gnu_ld = yes; then
+ if $have_libobjs  test X$skipped_export != X:  test 
$with_gnu_ld = yes; then
output=${output_objdir}/${output_la}.lnkscript
func_echo creating GNU ld script: $output
$ECHO 'INPUT ('  $output
@@ -5261,7 +5266,7 @@
done
$ECHO ')'  $output
delfiles=$delfiles $output
- elif test X$skipped_export != X:  test X$file_list_spec != X; 
then
+ elif $have_libobjs  test X$skipped_export != X:  test 
X$file_list_spec != X; then
output=${output_objdir}/${output_la}.lnk
func_echo creating linker input file list: $output
:  $output
@@ -5272,6 +5277,7 @@
delfiles=$delfiles $output
output=\$file_list_spec$output\
  else
+   if $have_libobjs; then
func_echo creating reloadable object files...
output=$output_objdir/$output_la-${k}.$objext
# Loop over the list of objects to be linked.
@@ -5306,15 +5312,6 @@
test -z $concat_cmds || concat_cmds=$concat_cmds~
eval concat_cmds=\\${concat_cmds}$reload_cmds $objlist $last_robj\
 
-   if ${skipped_export-false}; then
- func_echo generating symbol list for \`$libname.la'
- export_symbols=$output_objdir/$libname.exp
- $opt_dry_run || $RM $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- eval concat_cmds=\\$concat_cmds~$export_symbols_cmds\
-   fi
-
# Set up a command to remove the reloadable object files
# after they are used.
i=0
@@ -5323,7 +5320,21 @@
  i=`expr $i + 1`
  delfiles=$delfiles $output_objdir/$output_la-${i}.$objext
done
+   else
+ output=
+   fi
 
+   if ${skipped_export-false}; then
+ func_echo generating symbol list for \`$libname.la'
+ export_symbols=$output_objdir/$libname.exp
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z $concat_cmds || concat_cmds=$concat_cmds~
+ eval concat_cmds=\\$concat_cmds$export_symbols_cmds\
+   fi
+
+   $have_libobjs 
func_echo creating a temporary reloadable object file: $output
 
# Loop through the commands generated above and execute them.
@@ -5348,6 +5359,11 @@
  }
done
IFS=$save_ifs
+
+   if test -n 

Re: FYI: HEAD: new export.at test

2007-02-11 Thread Bob Friesenhahn

On Sun, 11 Feb 2007, Ralf Wildenhues wrote:


* Ralf Wildenhues wrote on Sun, Feb 11, 2007 at 05:47:16PM CET:

I would like to fix all failures at once, due to the intertwined code
in ltmain.  Currently, I'm about half-way through.  I'll post what I
have in a followup mail FYI, but won't apply it.


This patch makes the cmdline_wrap test pass on GNU/Linux and newer
Solaris.  Showing 'diff -b', hiding the indentation of the large
block inside `if $have_libobjs'.


Provided that this patch does not increase the test error count prior 
to test #49, I am happy with it. :-)


Bob



Cheers,
Ralf

2007-02-11  Ralf Wildenhues  [EMAIL PROTECTED]

Fix -export-symbols and -export-symbols-regex for links that
exceed the command line length and use convenience archives.

* libltdl/config/ltmain.m4sh (func_mode_link) have_libobjs:
New variable, to avoid being sensitive to $libobjs containing a
single space.
(func_mode_link): Avoid grepping a nonexistent file if using
reloadable objects.  Do not create a linker script nor a linker
input file if no objects are passed.  Apply export_symbols_regex
in case the command line length is exceeded.

Index: libltdl/config/ltmain.m4sh
===
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.62
diff -u -b -r1.62 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  11 Feb 2007 16:22:42 -  1.62
+++ libltdl/config/ltmain.m4sh  11 Feb 2007 18:15:35 -
@@ -5088,6 +5088,11 @@
# Use standard objects if they are pic
test -z $pic_flag  libobjs=`$ECHO X$libobjs | $SP2NL | $Xsed -e 
$lo2o | $NL2SP`

+   case $libobjs in
+   *[[!\ ]]*) have_libobjs=: ;;
+   *) have_libobjs=false ;;
+   esac
+
delfiles=
if test -n $export_symbols  test -n $include_expsyms; then
  $opt_dry_run || cp $export_symbols $output_objdir/$libname.uexp
@@ -5140,7 +5145,7 @@
  fi
done
IFS=$save_ifs
-   if test -n $export_symbols_regex; then
+   if test -n $export_symbols_regex  test X$skipped_export != 
X:; then
  func_show_eval '$EGREP -e $export_symbols_regex $export_symbols  
${export_symbols}T'
  func_show_eval '$MV ${export_symbols}T $export_symbols'
fi
@@ -5251,7 +5256,7 @@
  last_robj=
  k=1

- if test X$skipped_export != X:  test $with_gnu_ld = yes; then
+ if $have_libobjs  test X$skipped_export != X:  test 
$with_gnu_ld = yes; then
output=${output_objdir}/${output_la}.lnkscript
func_echo creating GNU ld script: $output
$ECHO 'INPUT ('  $output
@@ -5261,7 +5266,7 @@
done
$ECHO ')'  $output
delfiles=$delfiles $output
- elif test X$skipped_export != X:  test X$file_list_spec != X; 
then
+ elif $have_libobjs  test X$skipped_export != X:  test 
X$file_list_spec != X; then
output=${output_objdir}/${output_la}.lnk
func_echo creating linker input file list: $output
:  $output
@@ -5272,6 +5277,7 @@
delfiles=$delfiles $output
output=\$file_list_spec$output\
  else
+   if $have_libobjs; then
func_echo creating reloadable object files...
output=$output_objdir/$output_la-${k}.$objext
# Loop over the list of objects to be linked.
@@ -5306,15 +5312,6 @@
test -z $concat_cmds || concat_cmds=$concat_cmds~
eval concat_cmds=\\${concat_cmds}$reload_cmds $objlist $last_robj\

-   if ${skipped_export-false}; then
- func_echo generating symbol list for \`$libname.la'
- export_symbols=$output_objdir/$libname.exp
- $opt_dry_run || $RM $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- eval concat_cmds=\\$concat_cmds~$export_symbols_cmds\
-   fi
-
# Set up a command to remove the reloadable object files
# after they are used.
i=0
@@ -5323,7 +5320,21 @@
  i=`expr $i + 1`
  delfiles=$delfiles $output_objdir/$output_la-${i}.$objext
done
+   else
+ output=
+   fi

+   if ${skipped_export-false}; then
+ func_echo generating symbol list for \`$libname.la'
+ export_symbols=$output_objdir/$libname.exp
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z $concat_cmds || concat_cmds=$concat_cmds~
+ eval concat_cmds=\\$concat_cmds$export_symbols_cmds\
+   fi
+
+   $have_libobjs 
func_echo creating a temporary reloadable object file: $output

# Loop through the commands generated