Re: Uppercasing files

2001-01-31 Thread Emiliano

Tom Tromey wrote:
 
  "Emile" == Emiliano  [EMAIL PROTECTED] writes:
 
 Emile I'm trying to create an automake file that has rules to
 Emile uppercase files.  For example I have something.ext and I want
 Emile it to create a copy SOMETHING.EXT. I tried with this:
 
 Emile pkgdata_DATA = SOMETHING.EXT OTHER.EXT
 Emile CLEANFILES = $(pkgdata_DATA)
 Emile %.EXT : %.ext
 Emile  cp -f $ `echo $ | tr a-z A-Z`
 
 Emile but that doesn't work since no file SOMETHING.ext exists. How
 Emile so I go about this?
 
 Write explicit rules.
 
 SOMETHING.EXT: something.ext

Yes, but I'd rather not if it can be avoided. There are quite a number
of them
and it impacts readability, plus there's more to keep consistent
manually (after
the uppercasing other ops are done on the files.

At the moment I've used a default rule, which works, but doesn't handle
dependancy:

.DEFAULT:
   cp -f `echo $(basename $@) | tr [:upper:] [:lower:]`.m $(basename
$@).m
   ../mumps/mumps $(basename $@).m 21

Emile




Re: Uppercasing files

2001-01-31 Thread Alexandre Oliva

On Jan 31, 2001, Emiliano [EMAIL PROTECTED] wrote:

 Tom Tromey wrote:
 Write explicit rules.

 SOMETHING.EXT: something.ext

 Yes, but I'd rather not if it can be avoided.

I'm afraid it can't.  Unix is case-sensitive, why shouldn't `make' be?

Well...  I suppose you could do something about it if you were willing
to get your Makefiles non-portable and use GNU make only, by using
$(shell ) magic.  Or you could write a script to generate the rules
and get them included in the Makefile with AC_SUBST_FILE or automake's
include feature.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicampoliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist*Please* write to mailing lists, not to me




Re: Uppercasing files

2001-01-31 Thread Emiliano

Alexandre Oliva wrote:
 
 On Jan 31, 2001, Emiliano [EMAIL PROTECTED] wrote:
 
  Tom Tromey wrote:
  Write explicit rules.
 
  SOMETHING.EXT: something.ext
 
  Yes, but I'd rather not if it can be avoided.
 
 I'm afraid it can't.  Unix is case-sensitive, why shouldn't `make' be?

But that's the whole issue. If unix weren't case sensitive we wouldn't
be having this discussion.

 Well...  I suppose you could do something about it if you were willing
 to get your Makefiles non-portable and use GNU make only, by using

Totally acceptable.

 $(shell ) magic.  Or you could write a script to generate the rules
 and get them included in the Makefile with AC_SUBST_FILE or automake's
 include feature.

I'd appreciate pointers on how to accomplish this. I've not been using
automake very long and learning to abuse it would take some time :)

Emile




[patch 2/2] support AC_SUBST'able automake rules

2001-01-31 Thread Lars J. Aas

This patch makes it possible to have AC_SUBST keywords in for instance
library names, allowing for much greater flexibility.  It depends on
patch 1/2, of course.

2001-02-01  Lars J. Aas  [EMAIL PROTECTED]

* automake.in ($quote_ats): New.
($MACRO_PATTERN, $CANONICALS): Allow '@'s in automake macro names.
(am_install_var): Use quote_ats to escape '@'s in transform rules
given to file_contents_with_transform.

--- automake.in Mon Jan 29 21:17:31 2001
+++ automake.in Wed Jan 31 03:51:41 2001
@@ -45,7 +45,7 @@
 # Only recognize leading spaces, not leading tabs.  If we recognize
 # leading tabs here then we need to make the reader smarter, because
 # otherwise it will think rules like `foo=bar; \' are errors.
-$MACRO_PATTERN = "^ *([A-Za-z0-9_]+)[ \t]*([:+]?)=[ \t]*(.*)\$";
+$MACRO_PATTERN = "^ *([A-Za-z0-9_\@]+)[ \t]*([:+]?)=[ \t]*(.*)\$";
 $BOGUS_MACRO_PATTERN = "^ *([^ \t]*)[ \t]*([:+]?)=[ \t]*(.*)\$";
 $GNITS_VERSION_PATTERN = "[0-9]+\\.[0-9]+([a-z]|\\.[0-9]+)?";
 $IF_PATTERN = "^if[ \t]+\([A-Za-z][A-Za-z0-9_]*\)[ \t]*\(#.*\)?\$";
@@ -54,7 +54,7 @@
 $PATH_PATTERN='(\\w|[/.-])+';
 # This will pass through anything not of the prescribed form.
 $INCLUDE_PATTERN = "^include[ 
\t]+((\\\$\\\(top_srcdir\\\)/${PATH_PATTERN})|(\\\$\\\(srcdir\\\)/${PATH_PATTERN})|([^/\\\$]${PATH_PATTERN}))[
 \t]*(#.*)?\$";
-$CANONICALS = "A-Za-z0-9_";
+$CANONICALS = "A-Za-z0-9_\@";
 
 # Some regular expressions.  One reason to put them here is that it
 # makes indentation work better in Emacs.
@@ -5626,6 +5627,15 @@
 return $val;
 }
 
+# Quote 'at' (@) instances with backslash escapes so they don't evaluate as
+# arrays.
+sub quote_ats
+{
+local ($val) = @_;
+$val =~ s/\@/\\\@/og;
+return $val;
+}
+   
 # Return the set of conditions for which a variable is defined.
 
 # If the variable is not defined conditionally, and is not defined in
@@ -7435,11 +7445,11 @@
}
 
$output_rules .=
-   file_contents_with_transform ('s/\@DIR\@/' . $X . '/g;'
-  . 's/\@NDIR\@/' . $nodir_name . '/go;'
-  . $ltxform . $cygxform
-  . $subdir_xform,
-  $file);
+   file_contents_with_transform (
+   quote_ats ('s/@DIR@/' . $X . '/g;'
+   . 's/@NDIR@/' . $nodir_name . '/go;'
+   . $ltxform . $cygxform . $subdir_xform),
+   $file);
 
push (@uninstall, 'uninstall-' . $X . $primary);
push (@phony, 'uninstall-' . $X . $primary);




Re: 10-check-am.patch

2001-01-31 Thread Akim Demaille

 "Tom" == Tom Tromey [EMAIL PROTECTED] writes:

 "Akim" == Akim Demaille [EMAIL PROTECTED] writes:
Akim It means that for instance we could have

Akim a b c: d e f

Akim in a .am file, and have file_contents_with_transform (provided
Akim we taught it that a, b and c are special targets) push @a, @b,
Akim @c the list of d, e and f.

Tom Do you mean something like doing this for install, uninstall
Tom targets, and the like?

Tom That would be fine with me.  However for non-trivial targets
Tom sometimes weird special handling is required.

Akim Now my patch is only an approximation of this, since it catches
Akim specifically just .PHONY.  How to extend it?

Tom Or do it by matching against the names of the targets.  There are
Tom probably a small number of targets like this, so we could handle
Tom it via a list of regexps.

Tom Or do I misunderstand?  Your explanation is a bit abstract.
Tom Maybe some more concrete examples would help.

My `plan' is what I implemented in the patch named
factored-dependencies.

Basically, here is how subdirs.am looks now:

| .PHONY: all-recursive install-data-recursive install-exec-recursive \
| installdirs-recursive install-recursive uninstall-recursive \
| @INSTALLINFO@ check-recursive installcheck-recursive info-recursive \
| dvi-recursive
| 
| all-recursive install-data-recursive install-exec-recursive \
| installdirs-recursive install-recursive uninstall-recursive @INSTALLINFO@ \
| check-recursive installcheck-recursive info-recursive dvi-recursive:
| @set fnord $(MAKEFLAGS); amf=$$2; \
| dot_seen=no; \
| target=`echo $@ | sed s/-recursive//`; \
| list='$(SUBDIRS)'; for subdir in $$list; do \
| ...

the first part being what's now possible.  We could have added other
targets than `.PHONY'.  My goal was trying to have *.am files behaves
like actual Makefiles, obeying the same rules, instead of having to
code into automake.in.




Re: New bugs

2001-01-31 Thread Akim Demaille

 "Tom" == Tom Tromey [EMAIL PROTECTED] writes:

Tom The reason is only historical.  Feel free to change it.

I'm applying this.  Sure, more clarification is needed in this area.
I find it especially hard to track failures of substitution since
Automake uses @FOO@ just like AC_SUBST :(  Can't we move to something
else, say %FOO%?


2001-01-31  Akim Demaille  [EMAIL PROTECTED]

* depend2.am: Instead of replacing @PFX@ in $(@PFX@COMPILE), and
then replacing `$(@PFX@COMPILE)' for the files that need some
special flags, use only @COMPILE@.  Similarly for @LTCOMPILE@.
Try to document this file.
* automake.in (add_depend2): Adjust to these changes.

Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.843
diff -u -u -r1.843 automake.in
--- automake.in 2001/01/31 14:36:21 1.843
+++ automake.in 2001/01/31 16:44:49
@@ -2956,12 +2956,13 @@
 {
 local ($lang) = @_;
 
+# Get information on $LANG.
+my $pfx = $language_map{"$lang-autodep"};
+my $fpfx = ($pfx eq '') ? 'CC' : $pfx;
+my $flag = $language_map{"$lang-flags"};
+
 # First include code for ordinary objects.
-local ($key) = $lang . '-autodep';
 local ($xform, $ext);
-
-local ($pfx) = $language_map{$key};
-local ($fpfx) = ($pfx eq '') ? 'CC' : $pfx;
 $xform = transform ('PFX'  = $pfx,
 'FPFX' = $fpfx);
 $xform .= $seen_objext  ? 's/^OBJEXT//;'  : 's/^OBJEXT.*$//;';
@@ -2972,12 +2973,16 @@
 # target.  In this case we don't want to include the generic code.
 if ($use_dependencies)
 {
-   local ($xform1) = ($xform
-  . transform ('BASE'   = '$*',
-'SOURCE' = '$',
-'OBJ'= '$@',
-'LTOBJ'  = '$@',
-'OBJOBJ' = '$@'));
+my $compile = '$(' . $pfx . 'COMPILE)';
+   my $ltcompile = '$(LT' . $pfx . 'COMPILE)';
+   my $xform1 = ($xform
+ . transform ('BASE'  = '$*',
+   'SOURCE'= '$',
+   'OBJ'   = '$@',
+   'LTOBJ' = '$@',
+   'OBJOBJ'= '$@',
+   'COMPILE'   = $compile,
+   'LTCOMPILE' = $ltcompile));
 
foreach $ext (lang_extensions ($lang))
{
@@ -3007,11 +3012,12 @@
$source = $list[$i + 1];
$obj = $list[$i + 2];
$i += 3;
+
+   my $val = "${derived}_${flag}";
 
-   local ($flag) = $language_map{$lang . '-flags'};
-   local ($val) = "(${derived}_${flag}";
-   ($rule = $language_map{$lang . '-compile'}) =~
-   s/\(AM_$flag/$val/;
+   my $obj_compile = $language_map{"$lang-compile"};
+   $obj_compile =~ s/\(AM_$flag/\($val/;
+   my $obj_ltcompile = '$(LIBTOOL) --mode=compile ' . $obj_compile;
 
# Generate a transform which will turn suffix targets in
# depend2.am into real targets for the particular objects we
@@ -3020,16 +3026,14 @@
file_contents
('depend2',
 $xform
-. transform ('$(' . $pfx . 'COMPILE)'
-  = $rule,
-  '$(LT' . $pfx . 'COMPILE)'
-  = '$(LIBTOOL) --mode=compile ' . $rule,
+. transform ('COMPILE'   = $obj_compile,
+  'LTCOMPILE' = $obj_ltcompile,
   # Handle source and obj transforms.
-  'OBJ'= $obj . '.o',
-  'OBJOBJ' = $obj . '.obj',
-  'LTOBJ'  = $obj . '.lo',
-  'BASE'   = $obj,
-  'SOURCE' = $source)
+  'OBJ'   = $obj . '.o',
+  'OBJOBJ'= $obj . '.obj',
+  'LTOBJ' = $obj . '.lo',
+  'BASE'  = $obj,
+  'SOURCE'= $source)
 # Generate rule for `.o'.
 . 's/^\@EXT\@\.o:/' . $obj . '.o: ' . $source . '/g;'
 # Maybe generate rule for `.lo'.  Might be eliminated
Index: depend2.am
===
RCS file: /cvs/automake/automake/depend2.am,v
retrieving revision 1.26
diff -u -u -r1.26 depend2.am
--- depend2.am 2000/10/16 09:01:36 1.26
+++ depend2.am 2001/01/31 16:44:49
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000
+## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
 ## Free Software Foundation, Inc.
 
 ## This program is free 

Re: New bugs

2001-01-31 Thread Akim Demaille

 "Tom" == Tom Tromey [EMAIL PROTECTED] writes:

Tom Later we see:

Tom # Generate rule for `.o'.  . 's/^\@EXT\@\.o:/' . $obj
Tom . '.o: ' . $source . '/g;'

Tom I think we need to quote $obj and $source here; this was handled
Tom in the old code.

I did not change anything in the area, I'd like first to understand
the failure you are describing.  It's related to special characters in
source file names which have special flags right?

First I want to write/enhance a test that fails on this.


If would be *wonderful* if someone had the courage to convert
Automake's test suite to Autotest :(




Re: New bugs

2001-01-31 Thread Akim Demaille

 "Akim" == Akim Demaille [EMAIL PROTECTED] writes:

Akim First I want to write/enhance a test that fails on this.

Sorry for being that dumb.  I finally understood the problem.  Here is
what I'm applying:


Index: ChangeLog
from  Akim Demaille  [EMAIL PROTECTED]
* automake.in (add_depend2): Quote properly $obj and $source.

Index: automake.in
===
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.844
diff -u -u -r1.844 automake.in
--- automake.in 2001/01/31 16:50:01 1.844
+++ automake.in 2001/01/31 17:31:52
@@ -3035,13 +3035,13 @@
   'BASE'  = $obj,
   'SOURCE'= $source)
 # Generate rule for `.o'.
-. 's/^\@EXT\@\.o:/' . $obj . '.o: ' . $source . '/g;'
+. 's/^\@EXT\@\.o:/' . "\Q$obj.o: $source\E" . '/g;'
 # Maybe generate rule for `.lo'.  Might be eliminated
 # by $XFORM.
-. 's/^\@EXT\@\.lo:/' . $obj . '.lo: ' . $source . '/g;'
+. 's/^\@EXT\@\.lo:/' . "\Q$obj.lo: $source\E" . '/g;'
 # Maybe generate rule for `.obj'.  Might be
 # eliminated by $XFORM.
-. 's/^\@EXT\@\.obj:/' . $obj . '.obj: ' . $source . '/g;');
+. 's/^\@EXT\@\.obj:/' . "\Q$obj.obj: $source\E" . '/g;');
 }
 }



Alternatively we could use a better scheme in depend2.am (to tell the
truth, I'd like to have *only* @FOO@ substitutions).




Re: 15-file-contents-paragraph.patch

2001-01-31 Thread Tom Tromey

 "Akim" == Akim Demaille [EMAIL PROTECTED] writes:

Akim   * automake.in (file_contents): Rewrite: instead of trying to parse
Akim   it line by line, first swallow it completely into $CONTENTS,
Akim   *then*, parse it *paragraph* by paragraph.

I see this went in.
What is the rationale for this patch?

I'm very leery of changing file reading.  For file_contents it isn't
too worrisome, since we have complete control over the inputs.  For
the other file reader it is scarier.

Also, the patch that went in has some unconditional prints to STDERR.
This is wrong.

Tom




Re: 17-factored-dependencies.patch

2001-01-31 Thread Tom Tromey

 "Akim" == Akim Demaille [EMAIL PROTECTED] writes:

Akim   * automake.in (%factored_dependencies): New.
Akim   (file_contents): Use it.
Akim   (handle_phony): Rename as...
Akim   (handle_factored_dependencies): this.
Akim   * subdirs.am: No need for convolved syntax to declare .PHONY.

Akim +# Holds the dependencies of target which dependencies are factored.
Akim +# Typically, `.PHONY' will appear in plenty of *.am files, but must
Akim +# be output once.  Arguably all pure dependencies could be subject
Akim +# to this factorization, but it is not unpleasant to have paragraphs
Akim +# in Makefile: keeping related stuff altogether.
Akim +%dependencies =
Akim +(
Akim +".PHONY" = []
Akim +);

Shouldn't this processing be done on a per-Makefile basis?
I think so.  That means this should be initialized in
initialize_per_input, not globally.

Tom




Re: 10-check-am.patch

2001-01-31 Thread Tom Tromey

 "Akim" == Akim Demaille [EMAIL PROTECTED] writes:

Akim My `plan' is what I implemented in the patch named
Akim factored-dependencies.

Thanks.  I missed some patches in my inbox last night.

BTW subdirs.am doesn't have .PHONY entries for the *clean-recursive
rules.  Is this intentional?

Tom




Re: New bugs

2001-01-31 Thread Tom Tromey

 "Akim" == Akim Demaille [EMAIL PROTECTED] writes:

Akim First I want to write/enhance a test that fails on this.

Try `make TESTS=subobj4.test VERBOSE=t check'.
That will tell you all about the problem.

Tom




Re: [revised patch 1/1] support AC_SUBST'able automake rules

2001-01-31 Thread Lars J. Aas

On Wed, Jan 31, 2001 at 05:02:06PM +0100, Lars J. Aas wrote:
: I've revised the patch to include the latest changes from CVS Autoconf,
: which made the complate patch somewhat simpler than before.  I even corrected
 complete

My fingers are slippy today.

Anyways, are the people that count looking into this patch?  I'd prefer
it if it was applied or rejected as soon as possible instead of waiting
in the dark...

  Lars J
-- 
Innovation is one percent inspiration and ninetynine percent perspiration,
and in my case; twice that...  -- Norville Barnes, `The Hudsucker Proxy'




Re: 17-factored-dependencies.patch

2001-01-31 Thread akim

On Wed, Jan 31, 2001 at 11:22:15AM -0700, Tom Tromey wrote:
  "Akim" == Akim Demaille [EMAIL PROTECTED] writes:
 
 Akim * automake.in (%factored_dependencies): New.
 Akim (file_contents): Use it.
 Akim (handle_phony): Rename as...
 Akim (handle_factored_dependencies): this.
 Akim * subdirs.am: No need for convolved syntax to declare .PHONY.
 
 Akim +# Holds the dependencies of target which dependencies are factored.
 Akim +# Typically, `.PHONY' will appear in plenty of *.am files, but must
 Akim +# be output once.  Arguably all pure dependencies could be subject
 Akim +# to this factorization, but it is not unpleasant to have paragraphs
 Akim +# in Makefile: keeping related stuff altogether.
 Akim +%dependencies =
 Akim +(
 Akim +".PHONY" = []
 Akim +);
 
 Shouldn't this processing be done on a per-Makefile basis?
 I think so.  That means this should be initialized in
 initialize_per_input, not globally.

Definitely!  Thanks, there are important things I have not caught yet.




Re: 15-file-contents-paragraph.patch

2001-01-31 Thread akim

On Wed, Jan 31, 2001 at 11:19:37AM -0700, Tom Tromey wrote:
  "Akim" == Akim Demaille [EMAIL PROTECTED] writes:
 
 Akim * automake.in (file_contents): Rewrite: instead of trying to parse
 Akim it line by line, first swallow it completely into $CONTENTS,
 Akim *then*, parse it *paragraph* by paragraph.
 
 I see this went in.
 What is the rationale for this patch?

To make it easier to handle special paragraphs such as .PHONY.

My goal was to follow strictly the syntax of Make so that people don't
have several syntaxes to learn, and more than one way to shoot in their
foot.

I apologize if I've been too fast on this patch.  I was under pressure
for cleaning up the mess I had left with maek check, and had all this
in front of me.  Fell free to ask me to revert these.

Still, back to the point.  My gaol was primarily to catch paragraphes
such as the .PHONY ones.  At the beginning I was looping on result_rules,
but it quickly became exactly what I applied to the whole file_contents:
reading by paragraphs (to make it short, but in practice I first tried
some hairy elsif with the other, and them tried to parse line by line
$result_rules, and fell on situations where Perl'RE engine was going
nuts).

It struck me that when you read in paragraph you no longer have the horrible
$saw_bk, $was_rule and $ignoring hacks.

 I'm very leery of changing file reading.  For file_contents it isn't
 too worrisome, since we have complete control over the inputs.  For
 the other file reader it is scarier.

Hm, you saw me coming up :)

Frankly, the more I look at this loop, the more I think this is the right
way to do it.  But I can understand your fears.  I'm sure Jim will agree
to give a try to some experiments :)  I'm sure we can drastically shorten
and simplify the code using this technique.

 Also, the patch that went in has some unconditional prints to STDERR.
 This is wrong.

Well, I left some in comment, which is not clean, agreed.  I will remove
those comments tomorrow then, sorry.




Re: 10-check-am.patch

2001-01-31 Thread akim

On Wed, Jan 31, 2001 at 11:27:05AM -0700, Tom Tromey wrote:
  "Akim" == Akim Demaille [EMAIL PROTECTED] writes:
 
 Akim My `plan' is what I implemented in the patch named
 Akim factored-dependencies.
 
 Thanks.  I missed some patches in my inbox last night.
 
 BTW subdirs.am doesn't have .PHONY entries for the *clean-recursive
 rules.  Is this intentional?

huh?  Well, automake.in still has hard coded .PHONY targets, I've not
finished spreading this.  But if the code does not add them, then I
must have done something wrong at some point.  I'll check this into
the details tomorrow.

I kept comparing Makefile.in from previous automake with my patched
versions, and didn't notice this problem.




patch: stamp-h? files in subdirs

2001-01-31 Thread Derek R. Price

stamp-h? files in subdirs are still being created in the wrong locations
by an automake configure script.  The problem was in AM_CONFIG_HEADERS.
I fixed it, but is dependent on the autoconf beta.  Patch attached.

I was thinking of attempting to eliminate the need for the recreation of
stamp-h? files in the Makefile.in targets, but it looked like a hassle
to get the quotes right in an m4 macro.  If there's interest in this,
let me know and I'll spend some more time on it.

* m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to
occur in
the correct locations
(_AM_DIRNAME): helper function which basically implements an sh
`dirname` in m4
* automake.in (scan_one_autoconf_file): change the warning
exception
for AC_CONFIG_HEADERS to match the new m4/header.m4
* stamph2.test: new
* dirname.test: new

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
The cafeteria deep fryer is not a toy.
The cafeteria deep fryer is not a toy.
The cafeteria deep fryer is not a toy...

  - Bart Simpson on chalkboard, _The Simpsons_




? automake-1.4c-stamph.diff
? m4/acheader.m4.sav
? tests/stamph2.test
? tests/dirname.test
Index: ChangeLog
===
RCS file: /cvs/automake/ChangeLog,v
retrieving revision 1.963
diff -u -r1.963 ChangeLog
--- ChangeLog   2001/01/31 04:05:43 1.963
+++ ChangeLog   2001/01/31 19:10:27
@@ -1,3 +1,12 @@
+2001-01-31  Derek Price  [EMAIL PROTECTED]
+
+   * m4/header.m4 (AM_CONFIG_HEADERS): fix stamp-h creation to occur in
+   the correct locations
+   (_AM_DIRNAME): helper function which basically implements an sh
+   `dirname` in m4
+   * automake.in (scan_one_autoconf_file): change the warning exception
+   for AC_CONFIG_HEADERS to match the new m4/header.m4
+
 2001-01-30  Tom Tromey  [EMAIL PROTECTED]
 
* automake.in (scan_one_autoconf_file): Don't mention
Index: automake.in
===
RCS file: /cvs/automake/automake.in,v
retrieving revision 1.839
diff -u -r1.839 automake.in
--- automake.in 2001/01/31 04:00:45 1.839
+++ automake.in 2001/01/31 19:10:31
@@ -4576,7 +4576,7 @@
# means we are actually scanning AM_CONFIG_HEADER from
# aclocal.m4.
if (/A([CM])_CONFIG_HEADERS?\s*\((.*)\)/
-$2 ne '[$1]')
+$2 !~ /^_AM_File,/)
{
am_conf_line_error
($filename, $., "\`automake requires \`AM_CONFIG_HEADER', not 
\`AC_CONFIG_HEADER'")
Index: m4/header.m4
===
RCS file: /cvs/automake/m4/header.m4,v
retrieving revision 1.7
diff -u -r1.7 header.m4
--- m4/header.m42000/08/06 12:36:53 1.7
+++ m4/header.m42001/01/31 19:10:31
@@ -1,3 +1,5 @@
+# AM_CONFIG_HEADER(HEADERS..., [COMMANDS], [INIT-CMDS])
+# -
 # Like AC_CONFIG_HEADER, but automatically create stamp file.
 
 # serial 3
@@ -7,22 +9,33 @@
 # that is generated.  We must strip everything past the first ":",
 # and everything past the last "/".
 
-AC_PREREQ([2.12])
+AC_PREREQ([2.49c])
 
 AC_DEFUN([AM_CONFIG_HEADER],
-[AC_CONFIG_HEADER([$1])
-  AC_OUTPUT_COMMANDS(
-   ifelse(patsubst([$1], [[^ ]], []),
- [],
- [test -z "$CONFIG_HEADERS" || echo timestamp dnl
-  patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),
-  [am_indx=1
-  for am_file in $1; do
-case " $CONFIG_HEADERS " in
-*" $am_file "*)
-  echo timestamp  `echo $am_file | sed 's%:.*%%;s%[^/]*$%%'`stamp-h$am_indx
-  ;;
-esac
-am_indx=\`expr \$am_indx + 1\`
-  done])
-])
+[dnl init our file count if it isn't already
+m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], 
+[0]))
+dnl prepare to store our destination file list for use in config.status
+AC_FOREACH([_AM_File], [$1],
+   [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*]))
+   m4_define([_AM_Config_Header_Index], 
+m4_incr(_AM_Config_Header_Index))
+   dnl and add it to the list of files AC keeps track of, along
+   dnl with our hook
+   AC_CONFIG_HEADERS(_AM_File,
+dnl COMMANDS, [, INIT-CMDS]
+[# update the timestamp
+echo timestamp "AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index["
+][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS
+   m4_popdef([_AM_Dest])])
+]) # AM_CONFIG_HEADER
+
+# _AM_DIRNAME(PATH)
+# -
+# Like AS_DIRNAME, only do it during macro expansion
+AC_DEFUN([_AM_DIRNAME],
+[m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1,
+m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1,
+  m4_if(m4_regexp([$1], [^/.*]), -1,
+

RE: patch: stamp-h? files in subdirs

2001-01-31 Thread Tim Van Holder

(_AM_DIRNAME): helper function which basically implements an sh
`dirname` in m4
Only have 1 problem with it: no support for DOS-style paths (and this is
conveniently not tested in your dirname.test either :-P).
It's bad enough working on patches for proper DOS/Win support when people
AREN'T adding new incompatible macros :-)
Having said that, I haven't sent in a patch for autoconf's AS_DIRNAME yet,
so I suppose it's my fault. I'll just have to make a patch for both
incarnations now.





amtraces functionality

2001-01-31 Thread Derek R. Price

The amtraces functionality for AC_CONFIG_FILES is totally broken.
Anyone mind if I spend a few minutes on it?

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
I don't suffer from stress.  I'm a carrier.
- Scott Adam's _Dilbert_







18-depend.patch

2001-01-31 Thread Akim Demaille

This patch gets rid of @phony, using only %dependencies.  depend
makes it somewhat more digest.  It also fixes the problem Tom spotted,
where my version of @phony was improperly initialized globally.

There are other targets that can take advantage of this: clean etc.,
in fact, those which are initialized where @phony was.

And of course, a significant part of the remaining work consists in
spreading the adhoc code into the corresponding */am files.

Akim

PS/ This patch includes the diff of Automake's Makefile.ins, i.e.,
there are no diffs at all.


Index: ChangeLog
from  Akim Demaille  [EMAIL PROTECTED]
* automake.in (%dependencies): Don't be initialize globally for
all the files, but in...
(initialize_per_input): here.
(depend): New.
(@phony): Replace all occurrences with the corresponding depend
invocation.

Index: automake.in
--- automake.in Wed, 31 Jan 2001 02:47:38 +0100 akim (am/f/39_automake.i 1.23 755)
+++ automake.in Wed, 31 Jan 2001 20:39:11 +0100 akim (am/f/39_automake.i 1.23 755)
@@ -324,16 +324,6 @@
 # discovered while scanning configure.ac.  We might distribute these
 # in the top-level Makefile.in.
 %configure_dist_common = ();
-
-# Holds the dependencies of target which dependencies are factored.
-# Typically, `.PHONY' will appear in plenty of *.am files, but must
-# be output once.  Arguably all pure dependencies could be subject
-# to this factorization, but it is not unpleasant to have paragraphs
-# in Makefile: keeping related stuff altogether.
-%dependencies =
-(
-".PHONY" = []
-);
 

 # Initialize global constants and our list of languages that are
@@ -2522,12 +2512,12 @@ sub handle_man_pages
 $output_rules .= ("install-man: \$(MANS)\n"
  . "\t\@\$(NORMAL_INSTALL)\n");
 pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);
-push (@phony, 'install-man');
+depend ('.PHONY', 'install-man');

 $output_rules .= "uninstall-man:\n\t\@\$(NORMAL_UNINSTALL)\n";
 grep ($_ = 'un' . $_, @namelist);
 pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @namelist);
-push (@phony, 'uninstall-man');
+depend ('.PHONY', 'uninstall-man');

 $output_vars .= file_contents ('mans-vars');

@@ -2561,7 +2551,7 @@ sub handle_tags
  . "  \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n"
  . "\tdone\n");
push (@tag_deps, 'tags-recursive');
-   push (@phony, 'tags-recursive');
+   depend ('.PHONY', 'tags-recursive');
 }

 if (saw_sources_p (1)
@@ -2792,7 +2782,7 @@ sub handle_dist_worker
  . " distdir=\"\$(distdir)\" $targ\n");
 }

-push (@phony, 'distdir');
+depend ('.PHONY', 'distdir');
 }

 # Handle 'dist' target.
@@ -3709,13 +3699,13 @@ sub handle_installdirs
# rule will work correctly.
$output_rules .= ("installdirs: installdirs-recursive\n"
  . "installdirs-am:\n");
-   push (@phony, 'installdirs-am');
+   depend ('.PHONY', 'installdirs-am');
 }
 else
 {
$output_rules .= "installdirs:\n";
 }
-push (@phony, 'installdirs');
+depend ('.PHONY', 'installdirs');
 if (@installdirs)
 {
pretty_print_rule ("\t" . '$(mkinstalldirs) ', "\t\t",
@@ -3814,7 +3804,7 @@ sub handle_merge_targets
  . " all-recursive"
  . "\n\n");
$all_target = 'all-recursive-am';
-   push (@phony, 'all-recursive-am');
+   depend ('.PHONY', 'all-recursive-am');
}
 }

@@ -3840,7 +3830,7 @@ sub handle_merge_targets
 $output_rules .= ("install-strip:\n\t"
  . '$(MAKE) $(AM_MAKEFLAGS) INSTALL_STRIP_FLAG=-s install'
  . "\n");
-push (@phony, 'install-strip');
+depend ('.PHONY', 'install-strip');
 }

 # Helper for handle_merge_targets.  Note that handle_merge_targets
@@ -3853,7 +3843,7 @@ sub do_one_merge_target
 {
# User defined local form of target.  So include it.
push (@values, $name . '-local');
-   push (@phony, $name . '-local');
+   depend ('.PHONY', $name . '-local');
 }

 pretty_print_rule ($name . "-am:", "\t\t", @values);
@@ -3884,11 +3874,11 @@ sub do_one_merge_target
 {
$tname = 'all-redirect';
$lname = $all_target if $recursive_install;
-   push (@phony, 'all-redirect');
+   depend ('.PHONY', 'all-redirect');
$output_all = "all: all-redirect\n";
 }
 pretty_print_rule ($tname . ":", "\t\t", $lname);
-push (@phony, $name . '-am', $name);
+depend ('.PHONY', $name . '-am', $name);
 }

 # Handle check merge target specially.
@@ -3898,7 +3888,7 @@ sub do_check_merge_target
 {
# User defined local form of target.  So include it.
push (@check_tests, 'check-local');
-   push (@phony, 'check-local');
+   depend ('.PHONY', 'check-local');
 }

   

20-distdir-am.patch

2001-01-31 Thread Akim Demaille

Actually, it seems to me there is not enough paragraph rules at all in
automake.  Instead of the attrocious

@SUBDIRS@   for subdir in $(@DIST_SUBDIR_NAME@); do \
@SUBDIRS@ if test "$$subdir" = .; then :; else \
@SUBDIRS@   test -d $(distdir)/$$subdir \
@SUBDIRS@   || mkdir $(distdir)/$$subdir \
@SUBDIRS@   || exit 1; \
@SUBDIRS@   (cd $$subdir  \
@SUBDIRS@ $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(@TOP_DISTDIR@) 
distdir=../$(distdir)/$$subdir distdir) \
@SUBDIRS@ || exit 1; \
@SUBDIRS@ fi; \
@SUBDIRS@   done

one would want some for of conditional, such as

@if HAS_SUBDIRS@
for subdir in $(@DIST_SUBDIR_NAME@); do \
  if test "$$subdir" = .; then :; else \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
(cd $$subdir  \
  $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(@TOP_DISTDIR@) 
distdir=../$(distdir)/$$subdir distdir) \
  || exit 1; \
  fi; \
done
@fi HAS_SUBDIRS@

or whatever the actual syntax.  This means that we want to run the
COMMAND of file_contents on the *whole* file.  Given that we have a
paragraph reading afterwards, it is absolutely possible.

Just my $0.002.  Tell me what you think about it.


So the point of this patch is (unofficially, that I continue learning
and feeling about Automake to get an idea of what could be done to
make it easier to understand/extend/migrate to another language) is to
externalize the handling of the dist target.  Because it was on my way
to use even more %dependencies.

I'm sorry for the size, one can't do less IMHO.

Note that aside from the new file to distribute (distdir.am), the
changes of the Makefile.ins are limited to a new empty line (of which
we can get rid of but eliminating the leading empty lines in
distdir.am, or, alternatively, decide that file_contents should
always get rid of leading lines).

Akim

Index: ChangeLog
from  Akim Demaille  [EMAIL PROTECTED]
* distdir.am (distdir): New file, extracted from...
* automake.in (handle_dist_worker): here.
Adjust.

Index: automake.in
--- automake.in Wed, 31 Jan 2001 21:12:00 +0100 akim (am/f/39_automake.i 1.26 755)
+++ automake.in Wed, 31 Jan 2001 22:25:04 +0100 akim (am/f/39_automake.i 1.26 755)
@@ -2613,28 +2613,26 @@ sub handle_multilib
 # Worker for handle_dist.
 sub handle_dist_worker
 {
-local ($makefile) = @_;
-
-$output_rules .= 'distdir: $(DISTFILES)' . "\n";
+my $makefile = @_;
+my $xform = '';

 # Initialization; only at top level.
 if ($relative_dir eq '.')
 {
-   if (defined $options{'check-news'})
-   {
-   # For Gnits users, this is pretty handy.  Look at 15 lines
-   # in case some explanatory text is desirable.
-   $output_rules .= '  @if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)"  
/dev/null; then :; else \\
- echo "NEWS not updated; not releasing" 12; \\
- exit 1; \\
-   fi
-';
-   }
-
+$xform .= 's/\@TOPDIR\@//g;';
+}
+else
+{
+$xform .= 's/\@TOPDIR\@.*//g;';
+}

-   # Create dist directory.
-   $output_rules .= ("\t-chmod -R a+w \$(distdir)  /dev/null 21; rm -rf 
\$(distdir)\n"
- . "\tmkdir \$(distdir)\n");
+if (defined $options{'check-news'})
+{
+$xform .= 's/\@CK-NEWS\@//g;';
+}
+else
+{
+$xform .= 's/\@CK-NEWS\@.*//g;';
 }

 # Scan EXTRA_DIST to see if we need to distribute anything from a
@@ -2674,39 +2672,23 @@ sub handle_dist_worker
# hash lets us ensure that each directory is used only once.
local (%dhash);
grep ($dhash{'$(distdir)/' . $_} = 1, @dist_dirs);
-   $output_rules .= "\t";
-   pretty_print_rule ('$(mkinstalldirs)', "\t   ", sort keys %dhash);
+   $xform .= transform ('DISTDIRS', join (' ', sort keys %dhash));
+}
+else
+{
+$xform .= 's/.*\@DISTDIRS\@.*//g;';
 }

-# In loop, test for file existence because sometimes a file gets
-# included in DISTFILES twice.  For example this happens when a
-# single source file is used in building more than one program.
-# Also, there are situations in which "ln" can fail.  For instance
-# a file to distribute could actually be a cross-filesystem
-# symlink -- this can easily happen if "gettextize" was run on the
-# distribution.
-$output_rules .= "\t\@for file in \$(DISTFILES); do \\\n";
 if ($cygnus_mode)
 {
-   $output_rules .= "\t  if test -f \$\$file; then d=.; else d=\$(srcdir); fi; 
\\\n";
+$xform .= 's/\@CYGNUS\@\t*/\t/g;';
+$xform .= 's/.*\@NCYGNUS\@.*//g;';
 }
 else
 {
-   $output_rules .= "\t  d=\$(srcdir); \\\n";
+$xform .= 's/\@NCYGNUS\@\t*/\t/g;';
+$xform .= 's/.*\@CYGNUS\@.*//g;';
 }
-$output_rules .= ("\t  if test -d \$\$d/\$\$file; 

Re: patch: stamp-h? files in subdirs

2001-01-31 Thread Tom Tromey

 "Derek" == Derek R Price [EMAIL PROTECTED] writes:

Derek by an automake configure script.  The problem was in
Derek AM_CONFIG_HEADERS.  I fixed it, but is dependent on the
Derek autoconf beta.

The next automake must be compatible with the old autoconf.  So this
patch can't go in as-is.

Tom




Re: patch: stamp-h? files in subdirs

2001-01-31 Thread Derek R. Price

Tim Van Holder wrote:

 (_AM_DIRNAME): helper function which basically implements an sh
 `dirname` in m4
 Only have 1 problem with it: no support for DOS-style paths (and this is
 conveniently not tested in your dirname.test either :-P).

Yeah, sorry.  I noticed that, but I decided that if it was good enough for
AS_DIRNAME it was good enough for _AM_DIRNAME.  I stripped the regex verbatim
from AS_DIRNAME and figured if anyone ever updated AS_DIRNAME someone would
catch _AM_DIRNAME eventually.

Derek

--
Derek Price  CVS Solutions Architect ( http://CVSHome.org )
mailto:[EMAIL PROTECTED] OpenAvenue ( http://OpenAvenue.com )
--
I will not drive the principal's car.
I will not drive the principal's car.
I will not drive the principal's car...

  - Bart Simpson on chalkboard, _The Simpsons_