Re: [PATCH] msvc: don't try to export import descriptors.

2010-09-23 Thread Peter Rosin
Den 2010-09-24 07:15 skrev Ralf Wildenhues:
> Hi Peter,
> 
> * Peter Rosin wrote on Fri, Sep 24, 2010 at 12:39:13AM CEST:
>> With the patch posted with subject: [PATCH] tests: import variables for MSVC.
>> I found that libtool tries to put some bad symbols in the generated
>> symbol lookup table leading to errors such as this:
> 
>> Ok to push?
> 
> Yes, with nit below addressed.

Thanks for the review!  Pushed with nits.

>> Subject: [PATCH] msvc: don't try to export import descriptors.
>>
>> * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin, mingw]
>> [pw32, cegcc] : Don't export symbols in
>> import libraries related to describing what dll(s) the import
>> library is importing. Fixes problem in tests/demo-make.test
>> and some other tests.
> 
>> --- a/libltdl/m4/libtool.m4
>> +++ b/libltdl/m4/libtool.m4
>> @@ -4492,7 +4492,9 @@ m4_if([$1], [CXX], [
>>  ;;
>>cygwin* | mingw* | cegcc*)
>>  case $cc_basename in
>> -cl*) ;;
>> +cl*)
>> +  _LT_TAGVAR(exclude_expsyms, 
>> $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*']
> 
> Does cl generate _GLOBAL_OFFSET_TABLE_ symbols, or _GLOBAL__F* ones?

No, not that I know of.

> If yes, is the leading underscore for the former optional?
> 
> I'm guessing "no" for both of these, which means you can omit them here.

Ok, I'll zap them.  If this is the wrong decision I guess we'll find out.

> I'm also guessing that GCC won't generate them either on w32, but really
> not so sure about that; and the MSVC case is easier because we don't risk
> regressions in leaving them out for now.

Cheers,
Peter



Re: [PATCH] tests: import variables for MSVC.

2010-09-23 Thread Ralf Wildenhues
Hi Peter,

* Peter Rosin wrote on Fri, Sep 24, 2010 at 12:25:14AM CEST:
> Subject: [PATCH] tests: import variables for MSVC.
> 
> * tests/depdemo/sysdep.h (EXTERN): New define, saying how to
> declare variables that might need to be imported.
> * tests/depdemo/l1/l1.h, tests/depdemo/l2/l2.h,
> tests/depdemo/l3/l3.h, tests/depdemo/l4/l4.h: Use it.
> * tests/demo/foo.h (EXTERN): New define, saying how to declare
> variables that might need to be imported. Use it.
> * tests/pdemo/foo.h (EXTERN) [MSVC]: Make MSVC import variables
> if needed.

Patch is ok with me if it keeps GCC working, and Chuck is ok with it.
You meant to use __declspec everywhere not declspec, even in your text
part of the mail, right?


A documentation addition describing the most general case of annotations
(multiple libraries, mixed static/shared, full MSVC + everything else
support) plus simplifications for common cases,
- no MSVC,
- no shared/static mixing,
- rely on auto-import,
- ...

would be good to have.  Something from which I can deduce that your
patch must be correct.

Of course, if libtool can somehow help with this any more, so much the
better.  But I'm less optimistic on this than I was those five years
ago.  :-/


Also, may I remind you that you promised a number of testsuite additions
before the release.

Thanks,
Ralf



Re: [PATCH] msvc: don't try to export import descriptors.

2010-09-23 Thread Ralf Wildenhues
Hi Peter,

* Peter Rosin wrote on Fri, Sep 24, 2010 at 12:39:13AM CEST:
> With the patch posted with subject: [PATCH] tests: import variables for MSVC.
> I found that libtool tries to put some bad symbols in the generated
> symbol lookup table leading to errors such as this:

> Ok to push?

Yes, with nit below addressed.

> Subject: [PATCH] msvc: don't try to export import descriptors.
> 
> * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin, mingw]
> [pw32, cegcc] : Don't export symbols in
> import libraries related to describing what dll(s) the import
> library is importing. Fixes problem in tests/demo-make.test
> and some other tests.

> --- a/libltdl/m4/libtool.m4
> +++ b/libltdl/m4/libtool.m4
> @@ -4492,7 +4492,9 @@ m4_if([$1], [CXX], [
>  ;;
>cygwin* | mingw* | cegcc*)
>  case $cc_basename in
> -cl*) ;;
> +cl*)
> +  _LT_TAGVAR(exclude_expsyms, 
> $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*']

Does cl generate _GLOBAL_OFFSET_TABLE_ symbols, or _GLOBAL__F* ones?
If yes, is the leading underscore for the former optional?

I'm guessing "no" for both of these, which means you can omit them here.
I'm also guessing that GCC won't generate them either on w32, but really
not so sure about that; and the MSVC case is easier because we don't risk
regressions in leaving them out for now.

Same below, of course.

> +  ;;
>  *)
>_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
> $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
> DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ 
> ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
>_LT_TAGVAR(exclude_expsyms, 
> $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
> @@ -5064,6 +5066,7 @@ _LT_EOF
>   # The linker will not automatically build a static lib if we build a 
> DLL.
>   # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
>   _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
> + _LT_TAGVAR(exclude_expsyms, 
> $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*']
>   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
> $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ 
> ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | 
> uniq > $export_symbols'
>   # Don't use ranlib
>   _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'

Thanks,
Ralf



Re: [PATCH] Skip need_lib_prefix.at on systems without lib prefix on libraries.

2010-09-23 Thread Ralf Wildenhues
Hello Peter,

* Peter Rosin wrote on Fri, Sep 17, 2010 at 08:44:43AM CEST:
> need_lib_prefix.at currently fails with MSVC. I think the test
> is there to ensure that "weird" systems continue to work even
> if the testsuite is running on a "normal" system. "weird" in
> this case are systems with need_lib_prefix set to "unknown" and
> "normal" are those with it set to "no". However, there are
> even weirder systems where need_lib_prefix should perhaps be
> set to "never" (i.e. MSVC) but that currently simply sets it
> to "no". "never" would perhaps be more appropriate since preopen
> doesn't work right if libs have a lib prefix. I think OS/2 is
> affected in the same way as MSVC, but I have no means to test
> that.
> 
> The below patch makes the need_lib_prefix.at test skip for the
> even weirder systems, i.e. those where libname_spec does not
> prefix library names with lib.
> 
> Ok to push?
> 
> 
> You may want to compare this patch with thread
> 
> http://lists.gnu.org/archive/html/libtool-patches/2009-01/msg00174.html
> 
> which instead makes the test pass for the even weirder systems,
> but I don't think that is really desired. Why should the code be
> changed to accommodate a contrived test case? Because this would
> never happen in the wild, right?

The part about this patch which I'm unsure about is this:

Does the testsuite otherwise cover well enough the fact that users may
name their modules with or without leading 'lib' prefix (and with .la or
.dll or .so suffix or so)?

IOW, I'd like to be sure we're not hiding anything here.

And yes, I think (part of) the log entry from the initial test addition
probably deserves to be a comment in the test, so we don't have to look
it up again.

> Subject: [PATCH] Skip need_lib_prefix.at on systems without lib prefix on 
> libraries.
> 
> * tests/need_lib_prefix.at [MSVC, OS/2]: Skip this test on
> systems that do not have libraries prefixed with lib.

Thanks,
Ralf



[PATCH] msvc: don't try to export import descriptors.

2010-09-23 Thread Peter Rosin
Hi!

With the patch posted with subject: [PATCH] tests: import variables for MSVC.
I found that libtool tries to put some bad symbols in the generated
symbol lookup table leading to errors such as this:

libtool: link: (cd .libs && /home/peda/automake/lib/compile cl -MD -Zi -EHsc -c 
"helldl.exeS.c")
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

helldl.exeS.c
helldl.exeS.c(25) : error C2143: syntax error : missing '{' before '-'
helldl.exeS.c(25) : error C2059: syntax error : '-'
helldl.exeS.c(39) : error C2065: '_IMPORT_DESCRIPTOR_hello' : undeclared 
identifier
helldl.exeS.c(39) : error C2036: 'void *' : unknown size
make: *** [helldl.exe] Error 2

This patch fixes those problems.  No regressions otherwise.

Ok to push?

Cheers,
Peter


>From b36c46a667443d4bacd99281f23f44fff1add44e Mon Sep 17 00:00:00 2001
From: Peter Rosin 
Date: Thu, 23 Sep 2010 23:02:42 +0200
Subject: [PATCH] msvc: don't try to export import descriptors.

* libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin, mingw]
[pw32, cegcc] : Don't export symbols in
import libraries related to describing what dll(s) the import
library is importing. Fixes problem in tests/demo-make.test
and some other tests.

Signed-off-by: Peter Rosin 
---
 ChangeLog |9 +
 libltdl/m4/libtool.m4 |5 -
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 647c151..b5f183d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-23  Peter Rosin  
+
+   msvc: don't try to export import descriptors.
+   * libltdl/m4/libtool.m4 (_LT_LINKER_SHLIBS) [cygwin, mingw]
+   [pw32, cegcc] : Don't export symbols in
+   import libraries related to describing what dll(s) the import
+   library is importing. Fixes problem in tests/demo-make.test
+   and some other tests.
+
 2010-09-22  Ralf Wildenhues  
 
Fix regression in command-line length computation.
diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
index 6aebb63..ce33bfe 100644
--- a/libltdl/m4/libtool.m4
+++ b/libltdl/m4/libtool.m4
@@ -4492,7 +4492,9 @@ m4_if([$1], [CXX], [
 ;;
   cygwin* | mingw* | cegcc*)
 case $cc_basename in
-cl*) ;;
+cl*)
+  _LT_TAGVAR(exclude_expsyms, 
$1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*']
+  ;;
 *)
   _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 
DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ 
]]/s/.* //'\'' | sort | uniq > $export_symbols'
   _LT_TAGVAR(exclude_expsyms, 
$1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
@@ -5064,6 +5066,7 @@ _LT_EOF
# The linker will not automatically build a static lib if we build a 
DLL.
# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+   _LT_TAGVAR(exclude_expsyms, 
$1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*|_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*']
_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | 
$global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ 
]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq 
> $export_symbols'
# Don't use ranlib
_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
-- 
1.7.1





Re: [PATCH] tests: import variables for MSVC.

2010-09-23 Thread Vincent Torri



On Fri, 24 Sep 2010, Peter Rosin wrote:


Hi!
I don't know how to set up the defines so that EXTERN becomes

1. "extern" when you use a static library
2. "extern" when you build a static library
3. "extern declspec(dllimport)" when you use a shared library
4. "extern declspec(dllexport)" when you build a shared library

I could fix 2 and 4, but separating 1 and 3 is not possible. Since
extern declspec(dllimport) works everywhere with MSVC I'm taking the
easy option with this patch.

Or should I add -DBUILDING_FOO to Makefile.am and variations of the below
to the code?

#ifdef _MSC_VER
# ifdef BUILDING_FOO
#  ifdef DLL_EXPORT
#   define EXTERN extern declspec(dllexport)
#  endif
# else
#  define EXTERN extern declspec(dllimport)
# endif
#endif
#ifndef EXTERN
# define EXTERN extern
#endif


here is what I use:

http://trac.enlightenment.org/e/browser/trunk/PROTO/evil/src/lib/Evil.h#L7

It's what you do, with just an additional else in DLL_EXPORT case, without 
your #ifndef.


works fine with gcc (mingw, mingw-w64, mingw32ce) and vc++

hth

Vincent Torri



[PATCH] tests: import variables for MSVC.

2010-09-23 Thread Peter Rosin
Hi!

This is a repost of an old patch.  Ralf said a long time ago that I should
drop the fixes for the old testsuite, but since I'm short of problems in
the new testsuite and the old one isn't going away, I'm revisiting this.

This was first posted here as part of a much bigger patch:
http://lists.gnu.org/archive/html/libtool-patches/2005-07/msg00033.html

Ralf didn't like it here:
http://lists.gnu.org/archive/html/libtool-patches/2005-08/msg00069.html

Some words from me on the subject:
http://lists.gnu.org/archive/html/libtool-patches/2005-08/msg00076.html

I don't know how to set up the defines so that EXTERN becomes

1. "extern" when you use a static library
2. "extern" when you build a static library
3. "extern declspec(dllimport)" when you use a shared library
4. "extern declspec(dllexport)" when you build a shared library

I could fix 2 and 4, but separating 1 and 3 is not possible. Since
extern declspec(dllimport) works everywhere with MSVC I'm taking the
easy option with this patch.

Or should I add -DBUILDING_FOO to Makefile.am and variations of the below
to the code?

#ifdef _MSC_VER
# ifdef BUILDING_FOO
#  ifdef DLL_EXPORT
#   define EXTERN extern declspec(dllexport)
#  endif
# else
#  define EXTERN extern declspec(dllimport)
# endif
#endif
#ifndef EXTERN
# define EXTERN extern
#endif

Cheers,
Peter


>From 044c0e8de4c98da753e7b17d87f03c8eebe2bcbe Mon Sep 17 00:00:00 2001
From: Peter Rosin 
Date: Thu, 23 Sep 2010 22:55:04 +0200
Subject: [PATCH] tests: import variables for MSVC.

* tests/depdemo/sysdep.h (EXTERN): New define, saying how to
declare variables that might need to be imported.
* tests/depdemo/l1/l1.h, tests/depdemo/l2/l2.h,
tests/depdemo/l3/l3.h, tests/depdemo/l4/l4.h: Use it.
* tests/demo/foo.h (EXTERN): New define, saying how to declare
variables that might need to be imported. Use it.
* tests/pdemo/foo.h (EXTERN) [MSVC]: Make MSVC import variables
if needed.

Signed-off-by: Peter Rosin 
---
 ChangeLog  |   12 
 tests/demo/foo.h   |8 +++-
 tests/depdemo/l1/l1.h  |2 +-
 tests/depdemo/l2/l2.h  |2 +-
 tests/depdemo/l3/l3.h  |2 +-
 tests/depdemo/l4/l4.h  |2 +-
 tests/depdemo/sysdep.h |6 ++
 tests/pdemo/foo.h  |2 ++
 8 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 647c151..af99b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-23  Peter Rosin  
+
+   tests: import variables for MSVC.
+   * tests/depdemo/sysdep.h (EXTERN): New define, saying how to
+   declare variables that might need to be imported.
+   * tests/depdemo/l1/l1.h, tests/depdemo/l2/l2.h,
+   tests/depdemo/l3/l3.h, tests/depdemo/l4/l4.h: Use it.
+   * tests/demo/foo.h (EXTERN): New define, saying how to declare
+   variables that might need to be imported. Use it.
+   * tests/pdemo/foo.h (EXTERN) [MSVC]: Make MSVC import variables
+   if needed.
+
 2010-09-22  Ralf Wildenhues  
 
Fix regression in command-line length computation.
diff --git a/tests/demo/foo.h b/tests/demo/foo.h
index 167096a..b0a1a47 100644
--- a/tests/demo/foo.h
+++ b/tests/demo/foo.h
@@ -37,6 +37,12 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #  endif
 #endif
 
+#ifdef _MSC_VER
+# define EXTERN extern __declspec(dllimport)
+#else
+# define EXTERN extern
+#endif
+
 /* __BEGIN_DECLS should be used at the beginning of your declarations,
so that C++ compilers don't mangle their names.  Use __END_DECLS at
the end of C declarations. */
@@ -83,7 +89,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 __BEGIN_DECLS
 int foo LT_PARAMS((void));
 int hello LT_PARAMS((void));
-extern int nothing;
+EXTERN int nothing;
 __END_DECLS
 
 #endif /* !_FOO_H_ */
diff --git a/tests/depdemo/l1/l1.h b/tests/depdemo/l1/l1.h
index 8e773ca..47f7be0 100644
--- a/tests/depdemo/l1/l1.h
+++ b/tests/depdemo/l1/l1.h
@@ -30,7 +30,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l1;
+EXTERN int var_l1;
 intfunc_l1 __P((int));
 __END_DECLS
 
diff --git a/tests/depdemo/l2/l2.h b/tests/depdemo/l2/l2.h
index 728b1df..500049d 100644
--- a/tests/depdemo/l2/l2.h
+++ b/tests/depdemo/l2/l2.h
@@ -30,7 +30,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l2;
+EXTERN int var_l2;
 intfunc_l2 __P((int));
 __END_DECLS
 
diff --git a/tests/depdemo/l3/l3.h b/tests/depdemo/l3/l3.h
index 6f0b446..59eff6d 100644
--- a/tests/depdemo/l3/l3.h
+++ b/tests/depdemo/l3/l3.h
@@ -30,7 +30,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 #include "sysdep.h"
 
 __BEGIN_DECLS
-extern int var_l3;
+EXTERN int var_l3;
 intfunc_l3 __P((int));
 __END_DECLS
 
diff --git a/tests/depdemo/l4/l4.h b/tests/depdemo/l4/l4.h
index bdf21d0..a78be74 100644
--- a/tests/depdemo/l4/l4.h
+++ b/tests/depdemo/l4/l4.h
@@ -30,7 +30,7 @@ or obtained by writ

Re: [PATCH v2 07/11] build: make better use of automatic variables in `Makefile.am'.

2010-09-23 Thread Ralf Wildenhues
Hi Gary,

this isn't a review, I'm just adding a couple of hints that come to
mind at first glance.

* Gary V. Vaughan wrote on Thu, Sep 23, 2010 at 05:21:24PM CEST:
> Rules are getting shorter and more readable again now.  I'm assuming
> there are no portability problems with "$@" and "$^" in regular rules?

$@ is portable.  $^ is not portable.

These things are all documented.  Here's the Posix page for make:

here are the Autoconf manual sections about portable make:


> If there are, at least keeping this change in a separate patch makes
> it easy enough to omit or amend.

Thanks.  Please amend and resubmit, I will review then.

> Now that these rules are all executing from the build tree, there's
> no need to manually check all the paths match the current directory,
> or keep long hand-typed duplicate paths scattered around.  We can
> use $@ (and $^ in some places) knowing that they're still correct
> when we've stayed in the same directory they were calculated for.
> 
> Okay to push?
> 
> * Makefile.am (libtoolize, libtoolize.in, libltdl/Makefile.am)
> (libltdl/config/mkstamp, libltdl/config/ltmain.m4sh)
> (libltdl/m4/ltversion.m4, tests/testsuite,.tests/defs.in):
> Make better use of automatic variables.

Cheers,
Ralf



Re: [PATCH v2 06/11] build: name temporary files in `Makefile.am' consistently.

2010-09-23 Thread Ralf Wildenhues
Hi Gary,

this isn't a full review, I'm just adding a couple of hints that come to
mind at first glance.

* Gary V. Vaughan wrote on Thu, Sep 23, 2010 at 05:21:23PM CEST:
> This is another silly patch that ends up being mostly edited away
> by the next couple of patches in the series... but I think it's
> useful to split it out so that you can see what I'm thinking at
> each stage.  It was also a good exercise because after splitting,
> I realised that the original 3/4 didn't apply this concept in all
> the places it could have.
> 
> Okay to push?

Consistent naming seems like a good idea, however I'll note that while
8.3 file systems with cutoff policy allow to distinguish between
'libtoolize' and 'libtoolize.tmp', they don't do so for 'libtoolize'
and 'libtoolizeT'.

I normally wouldn't say we still need to really care about this much any
more, but we've had some DJGPP fixes in Autoconf and Automake a few
months ago due to bug reports.

Oh well, dunno if that's relevant.

> * Makefile.am (libltdl/m4/ltversion.m4): Rename temporary file
> to `ltversion.m4T'.
> (libltdl/config/ltmain.sh): Rename temporary file to `ltmain.shT'.
> (libtoolize): Rename temporary file to `libtoolizeT'.
> (tests/defs): Rename temporary file to `defsT'
> (tests/testsuite): Rename temporary file to `testsuiteT'.
> (CLEANFILES): Adjust and add `tests/defsT' and `tests/testsuiteT'.

Cheers,
Ralf



Re: [PATCH v2 02/11] maint: don't leak developer GREP, SED etc into distribution file.

2010-09-23 Thread Ralf Wildenhues
Hello Gary,

* Gary V. Vaughan wrote on Thu, Sep 23, 2010 at 05:21:19PM CEST:
> I've pared this down to the absolute minimum necessary to fix the
> bug it is targetting.  I did run this through `make distcheck' (and
> it passed), but most of the others following only got a cursory
> `git clean -x -d -f && ./bootstrap && ./configure && ./make all
> check TESTS=tests/sh.test TESTSUITEFLAGS=1' unless noted otherwise.

Did you look at the output of the cursory check?  Like, after this
patch, I get this in the output:

  ##  ##
  ## @PACKAGE_STRING@ test suite. ##
  ##  ##

See below for an explanation.

> > With this patch applied, the generated libtool script still contains
> > the following lines:
> > 
> > : ${EGREP="@EGREP@"}
> > : ${FGREP="@FGREP@"}
> > : ${GREP="@GREP@"}
> > : ${LN_S="@LN_S@"}
> > [...]
> > : ${SED="@SED@"}
> > 
> > Now, the lines are all ineffective, because the tag variables (which
> > will be expanded before these lines) will set all of these variables.
> > Kind of ugly, but alright if you prefer to clean that up later.
> 
> Oh!  I'd forgotten that AC_INIT_COMMANDS don't get run through the
> AC_SUBST machinery :(

Unfortunately, I cannot parse this statement.  What does
AC_INIT_COMMANDS have to do with these lines which come from
general.m4sh originally?

> I'd like to tackle that separately.  Unfortunately those settings
> come from general.m4sh boilerplate and are required by libtoolize, so
> it's not entirely straight forward.

Agreed.

> I'm torn between running our
> own minimal substitution to fill the values in from libtool.m4, or
> having the make rule for libtool just edit them out.  Thoughts?

Editing them out is fine.  Again, fixing this later is fine with me,
too.

> Okay to push this one now?

It is still not quite correct.  See below.

> * Makefile.am: Having rearranged the file, now apply the actual
> changes to follow-up.
> (edit): Split into two parts...
> (bootstrap_edit): ...substitutions that should happen at bootstrap
> time...
> (configure_edit): ...and substitutions that should not happen until
> configure time.
> * Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh)
> (libtoolize.in): Use bootstrap_edit.

This log line is not reflected in the patch contents.  And in fact, with
the patch applied, the generated libtoolize script still has
untransformed strings:

$ head libtoolize | sed 's/^/| '
| #! /bin/sh
| # Generated from libtoolize.m4sh by GNU Autoconf 2.68.
| 
| # libtoolize (GNU @PACKAGE@@TIMESTAMP@) @VERSION@
[...]

> (libtoolize, tests/package.m4): Use configure_edit.

For tests/package.m4, this is the wrong thing to do; see below.

> * HACKING (Release Procedure): Remove the note to workaround the
> bug fixed by this changeset.
> * NEWS (Bug fixes): Mention that this bug is now fixed.
> Reported by Joerg Sonnenberger.

> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -75,26 +75,23 @@ EXTRA_DIST += bootstrap $(srcdir)/libtoolize.in 
> $(auxdir)/ltmain.m4sh \
>  CLEANFILES += libtool libtoolize libtoolize.tmp \
> $(auxdir)/ltmain.tmp $(m4dir)/ltversion.tmp
>  
> -edit = sed \
> - -e 's,@EGREP\@,$(EGREP),g' \
> - -e 's,@FGREP\@,$(FGREP),g' \
> - -e 's,@GREP\@,$(GREP),g' \
> - -e 's,@LN_S\@,$(LN_S),g' \
> - -e 's,@MACRO_VERSION\@,$(VERSION),g' \
> - -e 's,@PACKAGE\@,$(PACKAGE),g' \
> - -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
> - -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' \
> - -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
> - -e 's,@PACKAGE_STRING\@,$(PACKAGE_NAME) $(VERSION),g' \
> - -e 's,@PACKAGE_TARNAME\@,$(PACKAGE),g' \
> - -e 's,@PACKAGE_VERSION\@,$(VERSION),g' \
> - -e 's,@SED\@,$(SED),g' \
> - -e 's,@VERSION\@,$(VERSION),g' \
> - -e 's,@aclocaldir\@,$(aclocaldir),g' \
> - -e 's,@datadir\@,$(datadir),g' \
> - -e 's,@pkgdatadir\@,$(pkgdatadir),g' \
> - -e 's,@host_triplet\@,$(host_triplet),g' \
> - -e 's,@prefix\@,$(prefix),g'
> +## These are the replacements that need to be made at bootstrap time,
> +## because they must be static in distributed files, and not accidentally
> +## changed by configure running on the build machine.
> +bootstrap_edit  = sed \
> +   -e 's,@MACRO_VERSION\@,$(VERSION),g' \
> +   -e "s,@MACRO_REVISION\@,$$correctver,g" \
> +   -e "s,@MACRO_SERIAL\@,$$serial,g" \
> +   -e 's,@PACKAGE\@,$(PACKAGE),g' \
> +   -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
> +   -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' \
> +   -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
> +   -e "s,@package_revision\@,$$correctver,g" \
> +   -e 's,@PACKAGE_STRING\@,$(PACKAGE_NAME) $(VERSION),g' \
> +   -e 's,@PACKAGE_TARNAME\@,$(PACKAGE),g' \
> +   -e 's,@PACKAGE_VERSION\@,$(VERSION),g' \
> +   -e "s,@TIMESTAMP\@,$$TIMESTAMP,g" \
> +   -e 

Re: [PATCH v2 02/11] maint: don't leak developer GREP, SED etc into distribution file.

2010-09-23 Thread Gary V. Vaughan
typu ahead...

On 23 Sep 2010, at 22:21, Gary V. Vaughan wrote:
> I'm torn between running our
> own minimal substitution to fill the values in from libtool.m4, or
> having the make rule for libtool just edit them out.  Thoughts?

Of course, I mean the rule for ltmain.sh could edit them out
as it generates ltmain.sh.

Cheers,
-- 
Gary V. Vaughan (g...@gnu.org)


PGP.sig
Description: This is a digitally signed message part


[PATCH v2 07/11] build: make better use of automatic variables in `Makefile.am'.

2010-09-23 Thread Gary V. Vaughan
Rules are getting shorter and more readable again now.  I'm assuming
there are no portability problems with "$@" and "$^" in regular rules?
If there are, at least keeping this change in a separate patch makes
it easy enough to omit or amend.

Now that these rules are all executing from the build tree, there's
no need to manually check all the paths match the current directory,
or keep long hand-typed duplicate paths scattered around.  We can
use $@ (and $^ in some places) knowing that they're still correct
when we've stayed in the same directory they were calculated for.

Okay to push?

* Makefile.am (libtoolize, libtoolize.in, libltdl/Makefile.am)
(libltdl/config/mkstamp, libltdl/config/ltmain.m4sh)
(libltdl/m4/ltversion.m4, tests/testsuite,.tests/defs.in):
Make better use of automatic variables.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |6 +++
 Makefile.am |   99 +++---
 2 files changed, 52 insertions(+), 53 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f26e65b..85ac802 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: make better use of automatic variables in `Makefile.am'.
+   * Makefile.am (libtoolize, libtoolize.in, libltdl/Makefile.am)
+   (libltdl/config/mkstamp, libltdl/config/ltmain.m4sh)
+   (libltdl/m4/ltversion.m4, tests/testsuite,.tests/defs.in):
+   Make better use of automatic variables.
+
build: name temporary files in `Makefile.am' consistently.
* Makefile.am (libltdl/m4/ltversion.m4): Rename temporary file
to `ltversion.m4T'.
diff --git a/Makefile.am b/Makefile.am
index 9143350..32b192c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -108,23 +108,21 @@ bootstrap_edit  = sed \
 ## how ltversion.m4 appears in our dependencies.
 EXTRA_DIST += $(m4dir)/ltversion.in $(srcdir)/$(m4dir)/ltversion.m4
 $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in configure.ac ChangeLog
-   @target='$(srcdir)/$(m4dir)/ltversion.m4'; $(rebuild); \
-   if test -f "$$target"; then \
- eval `sed -n '/^macro_revision=/p' $(srcdir)/$(m4dir)/ltversion.m4`; \
+   @$(rebuild); \
+   if test -f "$@"; then \
+ eval `sed -n '/^macro_revision=/p' "$@"`; \
  test "$$macro_revision" = "$$revision" && rebuild=false; \
fi; \
for prereq in $?; do \
  case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- rm -f $(srcdir)/$(m4dir)/ltversion.m4T; \
+ rm -f "$...@t"; \
  serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
- echo $(bootstrap_edit) \
-   $(srcdir)/$(m4dir)/ltversion.in \> $(srcdir)/$(m4dir)/ltversion.m4; 
\
- $(bootstrap_edit) \
- $(srcdir)/$(m4dir)/ltversion.in > 
$(srcdir)/$(m4dir)/ltversion.m4T; \
- chmod a-w $(srcdir)/$(m4dir)/ltversion.m4T; \
- mv -f $(srcdir)/$(m4dir)/ltversion.m4T 
$(srcdir)/$(m4dir)/ltversion.m4; \
+ echo "$(bootstrap_edit) $(srcdir)/$(m4dir)/ltversion.in > $@"; \
+ $(bootstrap_edit) "$(srcdir)/$(m4dir)/ltversion.in" > "$...@t"; \
+ chmod a-w "$...@t"; \
+ mv -f "$...@t" "$@"; \
fi
 
 ## And for similar reasons, ltmain.sh can't be built from config.status.
@@ -139,41 +137,37 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
 ##   tree whenever config.status regenerates the Makefile.
 EXTRA_DIST += $(srcdir)/$(auxdir)/ltmain.sh
 $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) $(auxdir)/ltmain.m4sh configure.ac 
ChangeLog
-   @target='$(srcdir)/$(auxdir)/ltmain.sh'; $(rebuild); \
-   if test -f "$$target"; then \
- eval `sed -n '/^package_revision=/p' "$$target"`; \
+   @$(rebuild); \
+   if test -f "$@"; then \
+ eval `sed -n '/^package_revision=/p' "$@"`; \
  test "$$package_revision" = "$$revision" && rebuild=false; \
fi; \
for prereq in $?; do \
  case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- rm -f $(srcdir)/$(auxdir)/ltmain.in $(srcdir)/$(auxdir)/ltmain.shT \
-   $(srcdir)/$(auxdir)/ltmain.sh; \
+ rm -f "$(srcdir)/$(auxdir)/ltmain.in" "$...@t" "$@"; \
  echo $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
\> $(srcdir)/$(auxdir)/ltmain.in; \
- $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
-   > $(srcdir)/$(auxdir)/ltmain.in; \
- echo $(bootstrap_edit) \
-   $(srcdir)/$(auxdir)/ltmain.in "> $$target"; \
- $(bootstrap_edit) \
-   $(srcdir)/$(auxdir)/ltmain.in > $(srcdir)/$(auxdir)/ltmain.shT; 
\
+ $(LT_M4SH) "$(srcdir)/$(auxdir)/ltmain.m4sh" \
+   > "$(srcdir)/$(auxdir)/ltmain.in"; \
+ echo "$(bootstrap_edit) $(srcdir)/$(auxdir)/ltmain.in > $@"; \
+ $(bootstrap_edit) "$(srcdir)/$(auxdir)/ltmain.in" > "$...@t"; \
 

[PATCH v2 10/11] build: eliminate superfluous temporary files from `Makefile.am'.

2010-09-23 Thread Gary V. Vaughan
I'm half convinced this patch is wrong, but I'd like a second opinion.
Not creating these temporary files makes things quite a lot tidier, but
I suspect that the original idea was to change the target files atomically
to avoid races in parallel makes... if that's the case, then instead of
this patch I'll write another to apply that rule consistently, since
there are plenty of rules that happily append to a target file as the
bytes come down a pipe or out of a process.

Push or apply atomic target file creation consistently throughout in
a replacement patch?

* Makefile.am (CLEANFILES): Remove temporary file entries.
(libtoolize.in, libltdl/config/ltmain.sh, libltdl/m4/ltversion.m4)
(tests/defs, tests/testsuite): Factor away temporary files.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |5 +
 Makefile.am |   35 ++-
 2 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ba2c3a5..e478899 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: eliminate superfluous temporary files from `Makefile.am'.
+   * Makefile.am (CLEANFILES): Remove temporary file entries.
+   (libtoolize.in, libltdl/config/ltmain.sh, libltdl/m4/ltversion.m4)
+   (tests/defs, tests/testsuite): Factor away temporary files.
+
build: eliminate `ltmain.in' intermediate file.
* Makefile.am (libltdl/config/ltmain.sh): Pipe the output of
`$(LT_M4SH)' directly into `$(bootstrap_edit)' to avoid use
diff --git a/Makefile.am b/Makefile.am
index 16e1a69..5d84b2c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -74,9 +74,7 @@ EXTRA_DIST += bootstrap $(srcdir)/libtoolize.in 
$(auxdir)/ltmain.m4sh \
  ChangeLog.2002 ChangeLog.2003 ChangeLog.2004 \
  ChangeLog.2005 ChangeLog.2006 ChangeLog.2007 \
  ChangeLog.2008 ChangeLog.2009
-CLEANFILES += libtool libtoolize libtoolizeT \
- tests/defsT tests/testsuitT \
- $(auxdir)/ltmain.shT $(m4dir)/ltversion.m4T
+CLEANFILES += libtool libtoolize
 
 ## These are the replacements that need to be made at bootstrap time,
 ## because they must be static in distributed files, and not accidentally
@@ -117,13 +115,12 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
  case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- rm -f "$...@t"; \
+ rm -f "$@"; \
  in=`echo "$@" | sed 's:\.m4$$:.in:'`; \
  serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
  echo "$(bootstrap_edit) $$in > $@"; \
- $(bootstrap_edit) "$$in" > "$...@t"; \
- chmod a-w "$...@t"; \
- mv -f "$...@t" "$@"; \
+ $(bootstrap_edit) "$$in" > "$@"; \
+ chmod a-w "$@"; \
fi
 
 ## And for similar reasons, ltmain.sh can't be built from config.status.
@@ -148,11 +145,10 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
done; \
if $$rebuild; then \
  in=`echo "$@" | sed 's:\.sh$$:.m4sh:'`; \
- rm -f "$...@t" "$@"; \
+ rm -f "$@"; \
  echo "$(LT_M4SH) $$in | $(bootstrap_edit) > $@"; \
- $(LT_M4SH) "$$in" | $(bootstrap_edit) > "$...@t"; \
- chmod a-w "$...@t"; \
- mv -f "$...@t" "$@"; \
+ $(LT_M4SH) "$$in" | $(bootstrap_edit) > "$@"; \
+ chmod a-w "$@"; \
fi
 
 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
@@ -220,11 +216,10 @@ configure_edit = sed \
 bin_SCRIPTS = libtoolize libtool
 
 libtoolize: $(srcdir)/libtoolize.in $(top_builddir)/config.status
-   rm -f "$...@t" "$@"
-   $(configure_edit) $(srcdir)/libtoolize.in > "$...@t"
-   chmod a+x "$...@t"
-   chmod a-w "$...@t"
-   mv -f "$...@t" "$@"
+   rm -f "$@"
+   $(configure_edit) $(srcdir)/libtoolize.in > "$@"
+   chmod a+x "$@"
+   chmod a-w "$@"
 
 # We used to do this with a 'stamp-vcl' file, but non-gmake builds
 # would rerun configure on every invocation, so now we manually
@@ -529,8 +524,7 @@ INSTALLCHECK_ENVIRONMENT = \
 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
 # how `testsuite' appears in our dependencies.
 $(srcdir)/$(TESTSUITE): $(srcdir)/tests/package.m4 $(TESTSUITE_AT) Makefile.am
-   $(AUTOTEST) -I $(srcdir)/tests $(TESTSUITE_AT) -o "$...@t"
-   mv -f "$...@t" "$@"
+   $(AUTOTEST) -I $(srcdir)/tests $(TESTSUITE_AT) -o "$@"
 
 $(srcdir)/tests/package.m4: $(srcdir)/configure.ac Makefile.am
{ \
@@ -885,9 +879,8 @@ DIST_SUBDIRS   += $(CONF_SUBDIRS)
 # regenerated since the source tree can be read-only.
 check-recursive: tests/defs
 tests/defs: $(srcdir)/tests/defs.in
-   rm -f "$...@t" "$@"
-   $(configure_edit) "$^" > "$...@t"
-   mv -f "$...@t" "$@"
+   rm -f "$@"
+   $(configure_edit) "$^" > "$@"
 
 # Use `$(srcdir)/tests' for

[PATCH v2 09/11] build: eliminate `ltmain.in' intermediate file.

2010-09-23 Thread Gary V. Vaughan
Factored out of the origin 3/4 patch.

Okay to push?

* Makefile.am (libltdl/config/ltmain.sh): Pipe the output of
`$(LT_M4SH)' directly into `$(bootstrap_edit)' to avoid use
of superfluous intermediate file.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |5 +
 Makefile.am |   12 
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d923588..ba2c3a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: eliminate `ltmain.in' intermediate file.
+   * Makefile.am (libltdl/config/ltmain.sh): Pipe the output of
+   `$(LT_M4SH)' directly into `$(bootstrap_edit)' to avoid use
+   of superfluous intermediate file.
+
build: don't hardcode repeated long paths in Makefile rules.
* Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh):
Use sed to calculate input file names from "$@".
diff --git a/Makefile.am b/Makefile.am
index 90cd671..16e1a69 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -131,7 +131,7 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
 ## would rerun configure on every invocation, so now we manually
 ## check the version numbers from the build rule when necessary.
 ## !WARNING! If you edit this rule to change the contents of ltmain.sh,
-##   you must `touch $(srcdir)/$(auxdir)/ltmain.in' from the
+##   you must `touch $(srcdir)/$(auxdir)/ltmain.m4sh' from the
 ##   shell if you need ltmain.sh to be regenerated.  Ideally, we
 ##   should make this rule depend on Makefile but that will break
 ##   distcheck (at least) by rebuilding ltmain.sh in the source
@@ -148,13 +148,9 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
done; \
if $$rebuild; then \
  in=`echo "$@" | sed 's:\.sh$$:.m4sh:'`; \
- intermediate=`echo "$@" | sed 's:\.sh$$:.in'`; \
- rm -f "$$intermediate" "$...@t" "$@"; \
- echo "$(LT_M4SH) $$in > $$intermediate"; \
- $(LT_M4SH) "$$in" > "$$intermediate"; \
- echo "$(bootstrap_edit) $$intermediate > $@"; \
- $(bootstrap_edit) "$$intermediate" > "$...@t"; \
- rm -f "$$intermediate"; \
+ rm -f "$...@t" "$@"; \
+ echo "$(LT_M4SH) $$in | $(bootstrap_edit) > $@"; \
+ $(LT_M4SH) "$$in" | $(bootstrap_edit) > "$...@t"; \
  chmod a-w "$...@t"; \
  mv -f "$...@t" "$@"; \
fi
-- 
1.7.3




[PATCH v2 08/11] build: don't hardcode repeated long paths in Makefile rules.

2010-09-23 Thread Gary V. Vaughan
The few remaining cases where I would have liked to use "$<", instead
of writing it out long-hand relative to the build tree more than
once, I've stored it in a shell variable and referenced that.

There are another couple of instances that don't show in this patch
where there was only a single "$<" required, in which case I just
typed the path out longhand as you suggested.

Okay to push?

* Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh):
Use sed to calculate input file names from "$@".

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |4 
 Makefile.am |   21 +++--
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 85ac802..d923588 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: don't hardcode repeated long paths in Makefile rules.
+   * Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh):
+   Use sed to calculate input file names from "$@".
+
build: make better use of automatic variables in `Makefile.am'.
* Makefile.am (libtoolize, libtoolize.in, libltdl/Makefile.am)
(libltdl/config/mkstamp, libltdl/config/ltmain.m4sh)
diff --git a/Makefile.am b/Makefile.am
index 32b192c..90cd671 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -118,9 +118,10 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
done; \
if $$rebuild; then \
  rm -f "$...@t"; \
+ in=`echo "$@" | sed 's:\.m4$$:.in:'`; \
  serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
- echo "$(bootstrap_edit) $(srcdir)/$(m4dir)/ltversion.in > $@"; \
- $(bootstrap_edit) "$(srcdir)/$(m4dir)/ltversion.in" > "$...@t"; \
+ echo "$(bootstrap_edit) $$in > $@"; \
+ $(bootstrap_edit) "$$in" > "$...@t"; \
  chmod a-w "$...@t"; \
  mv -f "$...@t" "$@"; \
fi
@@ -146,14 +147,14 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
  case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- rm -f "$(srcdir)/$(auxdir)/ltmain.in" "$...@t" "$@"; \
- echo $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
-   \> $(srcdir)/$(auxdir)/ltmain.in; \
- $(LT_M4SH) "$(srcdir)/$(auxdir)/ltmain.m4sh" \
-   > "$(srcdir)/$(auxdir)/ltmain.in"; \
- echo "$(bootstrap_edit) $(srcdir)/$(auxdir)/ltmain.in > $@"; \
- $(bootstrap_edit) "$(srcdir)/$(auxdir)/ltmain.in" > "$...@t"; \
- rm -f $(srcdir)/$(auxdir)/ltmain.in; \
+ in=`echo "$@" | sed 's:\.sh$$:.m4sh:'`; \
+ intermediate=`echo "$@" | sed 's:\.sh$$:.in'`; \
+ rm -f "$$intermediate" "$...@t" "$@"; \
+ echo "$(LT_M4SH) $$in > $$intermediate"; \
+ $(LT_M4SH) "$$in" > "$$intermediate"; \
+ echo "$(bootstrap_edit) $$intermediate > $@"; \
+ $(bootstrap_edit) "$$intermediate" > "$...@t"; \
+ rm -f "$$intermediate"; \
  chmod a-w "$...@t"; \
  mv -f "$...@t" "$@"; \
fi
-- 
1.7.3




[PATCH v2 05/11] build: factor Makefile.am `m4sh' invocations to LT_M4SH.

2010-09-23 Thread Gary V. Vaughan
Another patch factored from the original 3/4.  This is the first
readability improvement to the rules that got lengthier in the
last patch... now that the groundwork is done.

I did run a build and minimal testing (as I described earlier in
this series) from a clean tree without problems at this stage.

Okay to push?

* Makefile.am (LT_M4SH): Now that all directories are listed as
fully qualified paths, the search path argument to M4SH is always
the same, so factor it out into a variable.  Adjust all callers.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |5 +
 Makefile.am |   10 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20599a6..f812d1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: factor Makefile.am `m4sh' invocations to LT_M4SH.
+   * Makefile.am (LT_M4SH): Now that all directories are listed as
+   fully qualified paths, the search path argument to M4SH is always
+   the same, so factor it out into a variable.  Adjust all callers.
+
build: avoid unnecessary directory changes in Makefile rules.
* Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.m4sh)
(libtoolize.in, libltdl/Makefile.am, libltdl/config/mkstamp)
diff --git a/Makefile.am b/Makefile.am
index 64db1b9..0f5cd52 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,6 +46,8 @@ EXTRA_LTLIBRARIES =
 auxdir = libltdl/config
 m4dir  = libltdl/m4
 
+LT_M4SH= $(M4SH) -B $(srcdir)/$(auxdir)
+
 # Using `cd' in backquotes may print the directory name, use this instead:
 lt__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 
@@ -147,9 +149,9 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
if $$rebuild; then \
  rm -f $(srcdir)/$(auxdir)/ltmain.in $(srcdir)/$(auxdir)/ltmain.tmp \
$(srcdir)/$(auxdir)/ltmain.sh; \
- echo $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/$(auxdir)/ltmain.m4sh \
+ echo $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
\> $(srcdir)/$(auxdir)/ltmain.in; \
- $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/$(auxdir)/ltmain.m4sh \
+ $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
> $(srcdir)/$(auxdir)/ltmain.in; \
  echo $(bootstrap_edit) \
$(srcdir)/$(auxdir)/ltmain.in "> $$target"; \
@@ -165,7 +167,7 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
 EXTRA_DIST += libtoolize.m4sh
 $(srcdir)/libtoolize.in: $(sh_files) libtoolize.m4sh Makefile.am
rm -f $(srcdir)/libtoolize.in
-   $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/libtoolize.m4sh > 
$(srcdir)/libtoolize.in
+   $(LT_M4SH) $(srcdir)/libtoolize.m4sh > $(srcdir)/libtoolize.in
 
 $(srcdir)/libltdl/Makefile.am: $(srcdir)/libltdl/Makefile.inc
in=$(srcdir)/libltdl/Makefile.inc; out=$(srcdir)/libltdl/Makefile.am; \
@@ -900,7 +902,7 @@ tests/defs: $(srcdir)/tests/defs.in
 # how defs.in appears in our dependencies.
 $(srcdir)/tests/defs.in: $(auxdir)/general.m4sh tests/defs.m4sh Makefile.am
rm -f $(srcdir)/tests/defs.in; \
-   $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/tests/defs.m4sh > 
$(srcdir)/tests/defs.in
+   $(LT_M4SH) $(srcdir)/tests/defs.m4sh > $(srcdir)/tests/defs.in
 
 # We need to remove any files that the above tests created.
 clean-local-legacy:
-- 
1.7.3




[PATCH v2 11/11] maint: simplify and improve safety of bootstrap process.

2010-09-23 Thread Gary V. Vaughan
This is the original 4/4 patch, unchanged from last time.  It still
passes `make distcheck' from a clean checkout and build on my mac.

> Assuming strongly that this patch depends upon the semantics of 3/4
> applied, I will review this patch after 3/4 is fixed

I haven't actually tried it separately, but I expect it will still
work even with the current master Makefile.am.  Even so, I'd rather
push these in the order I've tested them.

Okay to push?

* Makefile.am (bootstrap_files): List files that need to be
generated at bootstrap time before `./configure && make' can
work.  It turns out that this is considerably fewer files than we
had thought necessary previously.
(bootstrap-deps-prep): Ensure minimum set of required substitution
variables are non-empty.
(bootstrap-deps): Depend on `bootstrap' files.
* bootstrap (Generate bootstrap dependencies): Now that
`Makefile.am' is entirely responsible for rebuilding files at
bootstrap time, we need only specify the new `bootstrap-deps'
target, and supply values for the substitutions checked by
`bootstrap-deps-prep'.
* configure.ac (AC_CONFIG_SRCDIR): `libtoolize.in' is not here yet
right after running `bootstrap'.  So rely on the presence of
`libltdl/config/libtoolize.m4sh', which is always there.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog|   19 +++
 Makefile.am  |   41 +
 bootstrap|   17 -
 configure.ac |2 +-
 4 files changed, 65 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e478899..de9d2c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-30  Gary V. Vaughan  
+
+   maint: simplify and improve safety of bootstrap process.
+   * Makefile.am (bootstrap_files): List files that need to be
+   generated at bootstrap time before `./configure && make' can
+   work.  It turns out that this is considerably fewer files than we
+   had thought necessary previously.
+   (bootstrap-deps-prep): Ensure minimum set of required substitution
+   variables are non-empty.
+   (bootstrap-deps): Depend on `bootstrap' files.
+   * bootstrap (Generate bootstrap dependencies): Now that
+   `Makefile.am' is entirely responsible for rebuilding files at
+   bootstrap time, we need only specify the new `bootstrap-deps'
+   target, and supply values for the substitutions checked by 
+   `bootstrap-deps-prep'.
+   * configure.ac (AC_CONFIG_SRCDIR): `libtoolize.in' is not here yet
+   right after running `bootstrap'.  So rely on the presence of
+   `libtoolize.m4sh', which is always there.
+
 2010-08-31  Gary V. Vaughan  
 
build: eliminate superfluous temporary files from `Makefile.am'.
diff --git a/Makefile.am b/Makefile.am
index 5d84b2c..54d5674 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -182,6 +182,47 @@ $(srcdir)/libltdl/Makefile.am: 
$(srcdir)/libltdl/Makefile.inc
   -e '1s,^\(.. Makefile.\)inc.*,\1am -- Process this file with 
automake to produce Makefile.in,' > "$@"
chmod a-w "$@"
 
+## Document the make macros that are needed to build bootstrap-deps
+## dependencies when called from `bootstrap' (developer's machine),
+## where the Makefile.am is fed to make in its raw format before
+## `configure' has found the correct values (on the build machine).
+bootstrap_files = \
+$(auxdir)/ltmain.sh \
+$(m4dir)/ltversion.m4 \
+libltdl/Makefile.am
+
+.PHONY: bootstrap-deps bootstrap-deps-prep
+bootstrap-deps: bootstrap-deps-prep $(bootstrap_files)
+bootstrap-deps-prep:
+## The following variables are substituted by `bootstrap-dep-preps'
+   @exit_cmd=:; \
+   test -z "$(srcdir)" \
+   && echo "ERROR: don't call $(MAKE) with srcdir unset." \
+   && exit_cmd=exit; \
+   test -z "$(M4SH)" \
+   && echo "ERROR: don't call $(MAKE) with M4SH unset." \
+   && exit_cmd=exit; \
+   test -z "$(PACKAGE)" \
+   && echo "ERROR: don't call $(MAKE) with PACKAGE unset." \
+   && exit_cmd=exit; \
+   test -z "$(PACKAGE_BUGREPORT)" \
+   && echo "ERROR: don't call $(MAKE) with PACKAGE_BUGREPORT unset." \
+   && exit_cmd=exit; \
+   test -z "$(PACKAGE_NAME)" \
+   && echo "ERROR: don't call $(MAKE) with PACKAGE_NAME unset." \
+   && exit_cmd=exit; \
+   test -z "$(PACKAGE_URL)" \
+   && echo "ERROR: don't call $(MAKE) with PACKAGE_URL unset." \
+   && exit_cmd=exit; \
+   test -z "$(SED)" \
+   && echo "ERROR: don't call $(MAKE) with SED unset." \
+   && exit_cmd=exit; \
+   test -z "$(VERSION)" \
+   && echo "ERROR: don't call $(MAKE) with VERSION unset." \
+   && exit_cmd=exit; \
+   $$exit_cmd 1
+   rm -f $(bootstrap_files)
+
 
 ## Unfortunately, all this bogeyness means that we have to manually
 ## keep the generated files in libltdl up to date.
diff --git a/bootstrap b/bootstrap
index 78b4d30..e66b151 1

[PATCH v2 06/11] build: name temporary files in `Makefile.am' consistently.

2010-09-23 Thread Gary V. Vaughan
This is another silly patch that ends up being mostly edited away
by the next couple of patches in the series... but I think it's
useful to split it out so that you can see what I'm thinking at
each stage.  It was also a good exercise because after splitting,
I realised that the original 3/4 didn't apply this concept in all
the places it could have.

Okay to push?

* Makefile.am (libltdl/m4/ltversion.m4): Rename temporary file
to `ltversion.m4T'.
(libltdl/config/ltmain.sh): Rename temporary file to `ltmain.shT'.
(libtoolize): Rename temporary file to `libtoolizeT'.
(tests/defs): Rename temporary file to `defsT'
(tests/testsuite): Rename temporary file to `testsuiteT'.
(CLEANFILES): Adjust and add `tests/defsT' and `tests/testsuiteT'.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |9 +
 Makefile.am |   41 +
 2 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f812d1d..f26e65b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: name temporary files in `Makefile.am' consistently.
+   * Makefile.am (libltdl/m4/ltversion.m4): Rename temporary file
+   to `ltversion.m4T'.
+   (libltdl/config/ltmain.sh): Rename temporary file to `ltmain.shT'.
+   (libtoolize): Rename temporary file to `libtoolizeT'.
+   (tests/defs): Rename temporary file to `defsT'
+   (tests/testsuite): Rename temporary file to `testsuiteT'.
+   (CLEANFILES): Adjust and add `tests/defsT' and `tests/testsuiteT'.
+
build: factor Makefile.am `m4sh' invocations to LT_M4SH.
* Makefile.am (LT_M4SH): Now that all directories are listed as
fully qualified paths, the search path argument to M4SH is always
diff --git a/Makefile.am b/Makefile.am
index 0f5cd52..9143350 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -74,8 +74,9 @@ EXTRA_DIST += bootstrap $(srcdir)/libtoolize.in 
$(auxdir)/ltmain.m4sh \
  ChangeLog.2002 ChangeLog.2003 ChangeLog.2004 \
  ChangeLog.2005 ChangeLog.2006 ChangeLog.2007 \
  ChangeLog.2008 ChangeLog.2009
-CLEANFILES += libtool libtoolize libtoolize.tmp \
- $(auxdir)/ltmain.tmp $(m4dir)/ltversion.tmp
+CLEANFILES += libtool libtoolize libtoolizeT \
+ tests/defsT tests/testsuitT \
+ $(auxdir)/ltmain.shT $(m4dir)/ltversion.m4T
 
 ## These are the replacements that need to be made at bootstrap time,
 ## because they must be static in distributed files, and not accidentally
@@ -116,14 +117,14 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
  case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- rm -f $(srcdir)/$(m4dir)/ltversion.tmp; \
+ rm -f $(srcdir)/$(m4dir)/ltversion.m4T; \
  serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
  echo $(bootstrap_edit) \
$(srcdir)/$(m4dir)/ltversion.in \> $(srcdir)/$(m4dir)/ltversion.m4; 
\
  $(bootstrap_edit) \
- $(srcdir)/$(m4dir)/ltversion.in > 
$(srcdir)/$(m4dir)/ltversion.tmp; \
- chmod a-w $(srcdir)/$(m4dir)/ltversion.tmp; \
- mv -f $(srcdir)/$(m4dir)/ltversion.tmp 
$(srcdir)/$(m4dir)/ltversion.m4; \
+ $(srcdir)/$(m4dir)/ltversion.in > 
$(srcdir)/$(m4dir)/ltversion.m4T; \
+ chmod a-w $(srcdir)/$(m4dir)/ltversion.m4T; \
+ mv -f $(srcdir)/$(m4dir)/ltversion.m4T 
$(srcdir)/$(m4dir)/ltversion.m4; \
fi
 
 ## And for similar reasons, ltmain.sh can't be built from config.status.
@@ -147,7 +148,7 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
  case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- rm -f $(srcdir)/$(auxdir)/ltmain.in $(srcdir)/$(auxdir)/ltmain.tmp \
+ rm -f $(srcdir)/$(auxdir)/ltmain.in $(srcdir)/$(auxdir)/ltmain.shT \
$(srcdir)/$(auxdir)/ltmain.sh; \
  echo $(LT_M4SH) $(srcdir)/$(auxdir)/ltmain.m4sh \
\> $(srcdir)/$(auxdir)/ltmain.in; \
@@ -156,10 +157,10 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
  echo $(bootstrap_edit) \
$(srcdir)/$(auxdir)/ltmain.in "> $$target"; \
  $(bootstrap_edit) \
-   $(srcdir)/$(auxdir)/ltmain.in > $(srcdir)/$(auxdir)/ltmain.tmp; 
\
+   $(srcdir)/$(auxdir)/ltmain.in > $(srcdir)/$(auxdir)/ltmain.shT; 
\
  rm -f $(srcdir)/$(auxdir)/ltmain.in; \
- chmod a-w $(srcdir)/$(auxdir)/ltmain.tmp; \
- mv -f $(srcdir)/$(auxdir)/ltmain.tmp $(srcdir)/$(auxdir)/ltmain.sh; \
+ chmod a-w $(srcdir)/$(auxdir)/ltmain.shT; \
+ mv -f $(srcdir)/$(auxdir)/ltmain.shT $(srcdir)/$(auxdir)/ltmain.sh; \
fi
 
 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
@@ -228,12 +229,12 

[PATCH v2 04/11] build: avoid unnecessary directory changes in Makefile rules.

2010-09-23 Thread Gary V. Vaughan
The vast majority of this patch gets thrown away further in the
series.  It's only really here to show separately how each of the
affected rules can be run perfectly well from the build tree... IIRC
I only wrote them this way originally as a short hand for retyping
all those long paths... but they are whittled away by the next few
patches anyway.

Okay to push?

* Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.m4sh)
(libtoolize.in, libltdl/Makefile.am, libltdl/config/mkstamp)
(tests/testsuite, tests/defs.in): Avoid unnecessary `cd' commands
by using fully qualified paths to files outside of current
directory.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |7 +++
 Makefile.am |   53 +++--
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a04ef73..20599a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: avoid unnecessary directory changes in Makefile rules.
+   * Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.m4sh)
+   (libtoolize.in, libltdl/Makefile.am, libltdl/config/mkstamp)
+   (tests/testsuite, tests/defs.in): Avoid unnecessary `cd' commands
+   by using fully qualified paths to files outside of current
+   directory.
+
build: compare `revision' rather than `correctver' in Makefile.am.
* Makefile.am (rebuild): Set the shell variable `revision' rather
than `correctver' for clarity of purpose.
diff --git a/Makefile.am b/Makefile.am
index abfd208..64db1b9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -114,15 +114,14 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
  case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- cd $(srcdir); \
- rm -f $(m4dir)/ltversion.tmp; \
+ rm -f $(srcdir)/$(m4dir)/ltversion.tmp; \
  serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
  echo $(bootstrap_edit) \
$(srcdir)/$(m4dir)/ltversion.in \> $(srcdir)/$(m4dir)/ltversion.m4; 
\
  $(bootstrap_edit) \
- $(m4dir)/ltversion.in > $(m4dir)/ltversion.tmp; \
- chmod a-w $(m4dir)/ltversion.tmp; \
- mv -f $(m4dir)/ltversion.tmp $(m4dir)/ltversion.m4; \
+ $(srcdir)/$(m4dir)/ltversion.in > 
$(srcdir)/$(m4dir)/ltversion.tmp; \
+ chmod a-w $(srcdir)/$(m4dir)/ltversion.tmp; \
+ mv -f $(srcdir)/$(m4dir)/ltversion.tmp 
$(srcdir)/$(m4dir)/ltversion.m4; \
fi
 
 ## And for similar reasons, ltmain.sh can't be built from config.status.
@@ -146,33 +145,30 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
  case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
done; \
if $$rebuild; then \
- cd $(srcdir); \
- rm -f $(auxdir)/ltmain.in $(auxdir)/ltmain.tmp \
-   $(auxdir)/ltmain.sh; \
- echo $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \
-   \> $(auxdir)/ltmain.in; \
- $(M4SH) -B $(auxdir) $(auxdir)/ltmain.m4sh \
-   > $(auxdir)/ltmain.in; \
+ rm -f $(srcdir)/$(auxdir)/ltmain.in $(srcdir)/$(auxdir)/ltmain.tmp \
+   $(srcdir)/$(auxdir)/ltmain.sh; \
+ echo $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/$(auxdir)/ltmain.m4sh \
+   \> $(srcdir)/$(auxdir)/ltmain.in; \
+ $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/$(auxdir)/ltmain.m4sh \
+   > $(srcdir)/$(auxdir)/ltmain.in; \
  echo $(bootstrap_edit) \
$(srcdir)/$(auxdir)/ltmain.in "> $$target"; \
  $(bootstrap_edit) \
-   $(auxdir)/ltmain.in > $(auxdir)/ltmain.tmp; \
- rm -f $(auxdir)/ltmain.in; \
- chmod a-w $(auxdir)/ltmain.tmp; \
- mv -f $(auxdir)/ltmain.tmp $(auxdir)/ltmain.sh; \
+   $(srcdir)/$(auxdir)/ltmain.in > $(srcdir)/$(auxdir)/ltmain.tmp; 
\
+ rm -f $(srcdir)/$(auxdir)/ltmain.in; \
+ chmod a-w $(srcdir)/$(auxdir)/ltmain.tmp; \
+ mv -f $(srcdir)/$(auxdir)/ltmain.tmp $(srcdir)/$(auxdir)/ltmain.sh; \
fi
 
 # Use `$(srcdir)' for the benefit of non-GNU makes: this is
 # how libtoolize.in appears in our dependencies.
 EXTRA_DIST += libtoolize.m4sh
 $(srcdir)/libtoolize.in: $(sh_files) libtoolize.m4sh Makefile.am
-   cd $(srcdir); \
-   rm -f libtoolize.in; \
-   $(M4SH) -B $(auxdir) libtoolize.m4sh > libtoolize.in
+   rm -f $(srcdir)/libtoolize.in
+   $(M4SH) -B $(srcdir)/$(auxdir) $(srcdir)/libtoolize.m4sh > 
$(srcdir)/libtoolize.in
 
 $(srcdir)/libltdl/Makefile.am: $(srcdir)/libltdl/Makefile.inc
-   cd $(srcdir); \
-   in=libltdl/Makefile.inc; out=libltdl/Makefile.am; \
+   in=$(srcdir)/libltdl/Makefile.inc; out=$(srcdir)/libltdl/Makefile.am; \
rm -f $$out; \
( $(SED) -n '1,/^.. DO NOT REMOVE THIS LINE -- /p' $$in; \
{ echo 'ACLOCAL_

[PATCH v2 03/11] build: compare `revision' rather than `correctver' in Makefile.am.

2010-09-23 Thread Gary V. Vaughan
Split out of the original 3/4 patch.  Not tested separately, but
3/4 passed make distcheck originally, and so does this series as
a whole.

Okay to push?

* Makefile.am (rebuild): Set the shell variable `revision' rather
than `correctver' for clarity of purpose.
(bootstrap_edit, libltdl/config/ltmain.sh): Adjust.
(libltdl/m4/ltversion.m4): Likewise, and alse, instead of munging
the serial number comment line with set, extract `macro_version'
from this file, and compare it directly with `revision'.
(libtool): Likewise for `package_revision'.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |9 +
 Makefile.am |   20 +---
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d9f5cbd..a04ef73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2010-08-31  Gary V. Vaughan  
 
+   build: compare `revision' rather than `correctver' in Makefile.am.
+   * Makefile.am (rebuild): Set the shell variable `revision' rather
+   than `correctver' for clarity of purpose.
+   (bootstrap_edit, libltdl/config/ltmain.sh): Adjust.
+   (libltdl/m4/ltversion.m4): Likewise, and alse, instead of munging
+   the serial number comment line with set, extract `macro_version'
+   from this file, and compare it directly with `revision'.
+   (libtool): Likewise for `package_revision'.
+
maint: don't leak developer GREP, SED etc into distribution file.
* Makefile.am: Having rearranged the file, now apply the actual
changes to follow-up.
diff --git a/Makefile.am b/Makefile.am
index 89189f1..abfd208 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,7 +57,7 @@ timestamp = set dummy `$(MKSTAMP) $(srcdir)`; shift; \
  *) TIMESTAMP="" ;; \
esac
 
-rebuild = rebuild=:; $(timestamp); correctver=$$1
+rebuild = rebuild=:; $(timestamp); revision=$$1
 
 
 # -- #
@@ -80,13 +80,13 @@ CLEANFILES += libtool libtoolize libtoolize.tmp \
 ## changed by configure running on the build machine.
 bootstrap_edit  = sed \
  -e 's,@MACRO_VERSION\@,$(VERSION),g' \
- -e "s,@MACRO_REVISION\@,$$correctver,g" \
+ -e "s,@MACRO_REVISION\@,$$revision,g" \
  -e "s,@MACRO_SERIAL\@,$$serial,g" \
  -e 's,@PACKAGE\@,$(PACKAGE),g' \
  -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
  -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' \
  -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
- -e "s,@package_revision\@,$$correctver,g" \
+ -e "s,@package_revision\@,$$revision,g" \
  -e 's,@PACKAGE_STRING\@,$(PACKAGE_NAME) $(VERSION),g' \
  -e 's,@PACKAGE_TARNAME\@,$(PACKAGE),g' \
  -e 's,@PACKAGE_VERSION\@,$(VERSION),g' \
@@ -107,9 +107,8 @@ EXTRA_DIST += $(m4dir)/ltversion.in 
$(srcdir)/$(m4dir)/ltversion.m4
 $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in configure.ac ChangeLog
@target='$(srcdir)/$(m4dir)/ltversion.m4'; $(rebuild); \
if test -f "$$target"; then \
- set dummy `sed -n '/^# serial /p' "$$target"`; shift; \
- actualver=1.$$3; \
- test "$$actualver" = "$$correctver" && rebuild=false; \
+ eval `sed -n '/^macro_revision=/p' $(srcdir)/$(m4dir)/ltversion.m4`; \
+ test "$$macro_revision" = "$$revision" && rebuild=false; \
fi; \
for prereq in $?; do \
  case $$prereq in *ChangeLog | *configure.ac);; *) rebuild=:;; esac; \
@@ -117,7 +116,7 @@ $(srcdir)/$(m4dir)/ltversion.m4: $(m4dir)/ltversion.in 
configure.ac ChangeLog
if $$rebuild; then \
  cd $(srcdir); \
  rm -f $(m4dir)/ltversion.tmp; \
- serial=`echo "$$correctver" | sed 's,^1[.],,g'`; \
+ serial=`echo "$$revision" | sed 's,^1[.],,g'`; \
  echo $(bootstrap_edit) \
$(srcdir)/$(m4dir)/ltversion.in \> $(srcdir)/$(m4dir)/ltversion.m4; 
\
  $(bootstrap_edit) \
@@ -141,8 +140,7 @@ $(srcdir)/$(auxdir)/ltmain.sh: $(sh_files) 
$(auxdir)/ltmain.m4sh configure.ac Ch
@target='$(srcdir)/$(auxdir)/ltmain.sh'; $(rebuild); \
if test -f "$$target"; then \
  eval `sed -n '/^package_revision=/p' "$$target"`; \
- actualver=$$package_revision; \
- test "$$actualver" = "$$correctver" && rebuild=false; \
+ test "$$package_revision" = "$$revision" && rebuild=false; \
fi; \
for prereq in $?; do \
  case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
@@ -245,8 +243,8 @@ libtoolize: $(srcdir)/libtoolize.in 
$(top_builddir)/config.status
 libtool: $(top_builddir)/config.status $(srcdir)/$(auxdir)/ltmain.sh ChangeLog
@target=libtool; $(rebuild); \
if test -f "$$target"; then \
- set dummy `./$$target --version | sed 1q`; actualver="$$5"; \
- test "$$actualver" = "$$correctver" && rebuild=false; \
+ eval `sed -n '/^package_revision=/p' "$$targ

[PATCH v2 02/11] maint: don't leak developer GREP, SED etc into distribution file.

2010-09-23 Thread Gary V. Vaughan
I've pared this down to the absolute minimum necessary to fix the
bug it is targetting.  I did run this through `make distcheck' (and
it passed), but most of the others following only got a cursory
`git clean -x -d -f && ./bootstrap && ./configure && ./make all
check TESTS=tests/sh.test TESTSUITEFLAGS=1' unless noted otherwise.

> With this patch applied, the generated libtool script still contains
> the following lines:
> 
> : ${EGREP="@EGREP@"}
> : ${FGREP="@FGREP@"}
> : ${GREP="@GREP@"}
> : ${LN_S="@LN_S@"}
> [...]
> : ${SED="@SED@"}
> 
> Now, the lines are all ineffective, because the tag variables (which
> will be expanded before these lines) will set all of these variables.
> Kind of ugly, but alright if you prefer to clean that up later.

Oh!  I'd forgotten that AC_INIT_COMMANDS don't get run through the
AC_SUBST machinery :(

I'd like to tackle that separately.  Unfortunately those settings
come from general.m4sh boilerplate and are required by libtoolize, so
it's not entirely straight forward.  I'm torn between running our
own minimal substitution to fill the values in from libtool.m4, or
having the make rule for libtool just edit them out.  Thoughts?

Okay to push this one now?

* Makefile.am: Having rearranged the file, now apply the actual
changes to follow-up.
(edit): Split into two parts...
(bootstrap_edit): ...substitutions that should happen at bootstrap
time...
(configure_edit): ...and substitutions that should not happen until
configure time.
* Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh)
(libtoolize.in): Use bootstrap_edit.
(libtoolize, tests/package.m4): Use configure_edit.
* HACKING (Release Procedure): Remove the note to workaround the
bug fixed by this changeset.
* NEWS (Bug fixes): Mention that this bug is now fixed.
Reported by Joerg Sonnenberger.
---
 ChangeLog   |   16 
 HACKING |9 ---
 Makefile.am |   74 +++
 NEWS|2 +
 4 files changed, 57 insertions(+), 44 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 818229f..d9f5cbd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
 2010-08-31  Gary V. Vaughan  
 
+   maint: don't leak developer GREP, SED etc into distribution file.
+   * Makefile.am: Having rearranged the file, now apply the actual
+   changes to follow-up.
+   (edit): Split into two parts...
+   (bootstrap_edit): ...substitutions that should happen at bootstrap
+   time...
+   (configure_edit): ...and substitutions that should not happen until
+   configure time.
+   * Makefile.am (libltdl/m4/ltversion.m4, libltdl/config/ltmain.sh)
+   (libtoolize.in): Use bootstrap_edit.
+   (libtoolize, tests/package.m4): Use configure_edit.
+   * HACKING (Release Procedure): Remove the note to workaround the
+   bug fixed by this changeset.
+   * NEWS (Bug fixes): Mention that this bug is now fixed.
+   Reported by Joerg Sonnenberger.
+
maint: rearrange Makefile.am in preparation for a follow-up patch.
* Makefile.am (Libtool scripts.): Move this section below the
`Bootstrap.' section...
diff --git a/HACKING b/HACKING
index 977be10..b17de29 100644
--- a/HACKING
+++ b/HACKING
@@ -619,15 +619,6 @@ or obtained by writing to the Free Software Foundation, 
Inc.,
 
 * Update NEWS, ChangeLog.
 
-* Until the bug that leaks developer tool paths into the release tarballs
-  from ./bootstrap is fixed, make sure the right tools are first in your
-  PATH and then:
-   export EGREP=egrep
-   export FGREP=fgrep
-   export GREP=grep
-   export MAKE=make
-   export SED=sed
-
 * Run ./bootstrap.
 
 * Run ./configure (or create a build directory first and run configure
diff --git a/Makefile.am b/Makefile.am
index dcb6d0d..89189f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -75,26 +75,23 @@ EXTRA_DIST += bootstrap $(srcdir)/libtoolize.in 
$(auxdir)/ltmain.m4sh \
 CLEANFILES += libtool libtoolize libtoolize.tmp \
  $(auxdir)/ltmain.tmp $(m4dir)/ltversion.tmp
 
-edit = sed \
-   -e 's,@EGREP\@,$(EGREP),g' \
-   -e 's,@FGREP\@,$(FGREP),g' \
-   -e 's,@GREP\@,$(GREP),g' \
-   -e 's,@LN_S\@,$(LN_S),g' \
-   -e 's,@MACRO_VERSION\@,$(VERSION),g' \
-   -e 's,@PACKAGE\@,$(PACKAGE),g' \
-   -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' \
-   -e 's,@PACKAGE_URL\@,$(PACKAGE_URL),g' \
-   -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \
-   -e 's,@PACKAGE_STRING\@,$(PACKAGE_NAME) $(VERSION),g' \
-   -e 's,@PACKAGE_TARNAME\@,$(PACKAGE),g' \
-   -e 's,@PACKAGE_VERSION\@,$(VERSION),g' \
-   -e 's,@SED\@,$(SED),g' \
-   -e 's,@VERSION\@,$(VERSION),g' \
-   -e 's,@aclocaldir\@,$(aclocaldir),g' \
-   -e 's,@datadir\@,$(datadir),g' \
-   -e 's,@pkgdatadir\@,$(pkgdatadir),g' \
-   -e 's,@host_triplet\@,$(host_triplet),g' \
-   -e 's,@prefix\@,$(prefix),g'
+## These are the replacements that need to be mad

[PATCH v2 01/11] maint: rearrange Makefile.am in preparation for a follow-up patch.

2010-09-23 Thread Gary V. Vaughan
> In case of doubt it might be easier to not try to change the actual
> dependency graph at all, but merely the rules, which should be enough
> to fix the problem you are targeting.

Rather than try to build debians freebsd-buildutils on my mac, I decided
to take the route of leaving the dependency graph alone.

I also took the liberty of splitting the series up into much smaller
pieces for easier review.  The original 1/4 is off the table for now,
2/4 has been approved already, but it's still here below for completeness'
sake.

The original 4/4 is still the last patch in the series, so 3/4 is now
spread out over the remainder, with commentary in each as appropriate.

* Makefile.am (Libtool scripts.): Move this section below the
`Bootstrap.' section...
(libtoolize.in): ...except this one which is generated at
bootstrap time, and was added into the `Bootstrap.' section.
(Libltdl.): Move this section below the `Libtool scripts.'
section.

Signed-off-by: Gary V. Vaughan 
---
 ChangeLog   |   10 
 Makefile.am |  142 +-
 2 files changed, 81 insertions(+), 71 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 647c151..818229f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-31  Gary V. Vaughan  
+
+   maint: rearrange Makefile.am in preparation for a follow-up patch.
+   * Makefile.am (Libtool scripts.): Move this section below the
+   `Bootstrap.' section...
+   (libtoolize.in): ...except this one which is generated at
+   bootstrap time, and was added into the `Bootstrap.' section.
+   (Libltdl.): Move this section below the `Libtool scripts.'
+   section.
+
 2010-09-22  Ralf Wildenhues  
 
Fix regression in command-line length computation.
diff --git a/Makefile.am b/Makefile.am
index 6e29a29..dcb6d0d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -60,63 +60,21 @@ timestamp = set dummy `$(MKSTAMP) $(srcdir)`; shift; \
 rebuild = rebuild=:; $(timestamp); correctver=$$1
 
 
-##  ##
-## Libtool scripts. ##
-##  ##
-
-# The libtool distributor and the standalone libtool script.
-bin_SCRIPTS = libtoolize libtool
-
-libtoolize: $(srcdir)/libtoolize.in $(top_builddir)/config.status
-   rm -f libtoolize.tmp libtoolize
-   $(timestamp); \
-   $(edit) -e "s,@TIMESTAMP\@,$$TIMESTAMP,g" \
-   -e 's,@aclocal_DATA\@,$(aclocalfiles),g' \
-   -e "s,@pkgltdl_files\@,$(ltdldatafiles),g" \
-   -e "s,@pkgconfig_files\@,$(auxfiles),g" \
-   $(srcdir)/libtoolize.in > libtoolize.tmp
-   chmod a+x libtoolize.tmp
-   chmod a-w libtoolize.tmp
-   mv -f libtoolize.tmp libtoolize
-
-# Use `$(srcdir)' for the benefit of non-GNU makes: this is
-# how libtoolize.in appears in our dependencies.
-EXTRA_DIST += libtoolize.m4sh
-$(srcdir)/libtoolize.in: $(sh_files) libtoolize.m4sh Makefile.am
-   cd $(srcdir); \
-   rm -f libtoolize.in; \
-   $(M4SH) -B $(auxdir) libtoolize.m4sh > libtoolize.in
-
-# We used to do this with a 'stamp-vcl' file, but non-gmake builds
-# would rerun configure on every invocation, so now we manually
-# check the version numbers from the build rule when necessary.
-libtool: $(top_builddir)/config.status $(srcdir)/$(auxdir)/ltmain.sh ChangeLog
-   @target=libtool; $(rebuild); \
-   if test -f "$$target"; then \
- set dummy `./$$target --version | sed 1q`; actualver="$$5"; \
- test "$$actualver" = "$$correctver" && rebuild=false; \
-   fi; \
-   for prereq in $?; do \
- case $$prereq in *ChangeLog);; *) rebuild=:;; esac; \
-   done; \
-   if $$rebuild; then \
- echo $(SHELL) ./config.status $$target; \
- cd $(top_builddir) && $(SHELL) ./config.status $$target; \
-   fi
-
-.PHONY: configure-subdirs
-configure-subdirs distdir: $(DIST_MAKEFILE_LIST)
-...@dist_makefile_list@:
-   dir=`echo $@ | sed 's,^[^/]*$$,.,;s,/[^/]*$$,,'`; \
-   test -d $$dir || mkdir $$dir || exit 1; \
-   abs_srcdir=`$(lt__cd) $(srcdir) && pwd`; \
-   (cd $$dir && $$abs_srcdir/$$dir/configure --with-dist) || exit 1
-
-
 # -- #
 # Bootstrap. #
 # -- #
 
+sh_files   = $(auxdir)/general.m4sh $(auxdir)/getopt.m4sh
+EXTRA_DIST += bootstrap $(srcdir)/libtoolize.in $(auxdir)/ltmain.m4sh \
+ $(auxdir)/mkstamp $(sh_files) \
+ ChangeLog.1996 ChangeLog.1997 ChangeLog.1998 \
+ ChangeLog.1999 ChangeLog.2000 ChangeLog.2001 \
+ ChangeLog.2002 ChangeLog.2003 ChangeLog.2004 \
+ ChangeLog.2005 ChangeLog.2006 ChangeLog.2007 \
+ ChangeLog.2008 ChangeLog.2009
+CLEANFILES += libtool libtoolize libtoolize.tmp \
+ $(auxdir)/ltmain.tmp $(m4dir)/ltversion.tmp
+
 edit = sed \
-e 's,@EGREP\@,$(EGREP),g' \
-e 's,@FGREP\@,$(FGREP),g' \
@@ -138,17 +96,6 @@ edit = sed \
-e 's,@host_triplet\@,$(host_triplet),g' 

Re: w32 pending?

2010-09-23 Thread Vincent Torri


Hey,

Now that libtool is released, i reply the questions below


This is the "Warning: linker path does not have real file for library
-lole32." problem, right?

libole32.a and friends are all part of the Win32 API, and are installed
by a proper mingw64 native non-multilib toolchain in ${prefix}/lib IIRC
-- and that dir is included in the compiler/linker's search path
automatically.

What would really help is if you could look at your (failing) libtool
script, and see what 'sys_lib_search_path_spec' is set to


# Compile-time system search path for libraries.
sys_lib_search_path_spec="/home/torri/local/opt/mingw64/lib/gcc 
/home/torri/local/opt/mingw64/x86_64-w64-mingw32/lib64 "


-- AND (a)
where libole32.a actually lives in your setup,


/home/torri/local/opt/mingw64/x86_64-w64-mingw32/lib/libole32.a


plus (b) what 'gcc
-print-search-dirs' reports (where, 'gcc' is the actual compiler,
whatever it is called, that you are using).


install: /home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/
programs: 
=/home/torri/local/opt/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.5.2/:/home/torri/local/opt/mingw64/bin/../libexec/gcc/:/home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/../../../../x86_64-w64-mingw32/bin/x86_64-w64-mingw32/4.5.2/:/home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/../../../../x86_64-w64-mingw32/bin/
libraries: 
=/home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/:/home/torri/local/opt/mingw64/bin/../lib/gcc/:/home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/../../../../x86_64-w64-mingw32/lib/x86_64-w64-mingw32/4.5.2/:/home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/../../../../x86_64-w64-mingw32/lib/../lib64/:/buildslaves/mingw-w64/linux-x86-x86_64/build/build/root/mingw/lib/x86_64-w64-mingw32/4.5.2/:/buildslaves/mingw-w64/linux-x86-x86_64/build/build/root/mingw/lib/../lib64/:/home/torri/local/opt/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.5.2/../../../../x86_64-w64-mingw32/lib/:/buildslaves/mingw-w64/linux-x86-x86_64/build/build/root/mingw/lib/


(*) I assume you're using a native non-multilib toolchain (you didn't
specify).


It's native (I use the linux version of the mingw-w64 toolchain). But I 
don't know what multilib means :-)


thank you

Vincent Torri