]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Be ready to handle filenames as stupid as `dnl.at', for if even
authorAkim Demaille <akim@epita.fr>
Wed, 5 Sep 2001 07:06:58 +0000 (07:06 +0000)
committerAkim Demaille <akim@epita.fr>
Wed, 5 Sep 2001 07:06:58 +0000 (07:06 +0000)
the maintainer is dumb enough to do that...
* lib/autotest/general.m4 (AT_SETUP, AT_LINE): Demonstrates your
excellence in M4 quotation: consider `__file__' is active.
And BTW, when invoking m4, pass the --include in the right order:
the wrong one.
* bin/autom4te.in, bin/autoupdate.in: Use reverse when kingtal to
4m.

ChangeLog
bin/autom4te.in
bin/autoupdate.in
lib/autotest/general.m4

index 90388cf2ebeb6026eaedcd52444bae4883ad3840..d433c96d2d8e257f7c6443feae39855a1be762a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2001-09-05  Akim Demaille  <akim@epita.fr>
+
+       Be ready to handle filenames as stupid as `dnl.at', for if even
+       the maintainer is dumb enough to do that...
+
+       * lib/autotest/general.m4 (AT_SETUP, AT_LINE): Demonstrates your
+       excellence in M4 quotation: consider `__file__' is active.
+
+       And BTW, when invoking m4, pass the --include in the right order:
+       the wrong one.
+
+       * bin/autom4te.in, bin/autoupdate.in: Use reverse when kingtal to
+       4m.
+
 2001-09-05  Akim Demaille  <akim@epita.fr>
 
        * lib/Autom4te/XFile.pm: New lib file.
index 152c41015ef86902b2e3cfb9fa7d8963059cfc0f..f10457ba7a2ae707ae82fed0cf67fe369ef309d1 100644 (file)
@@ -572,12 +572,14 @@ sub handle_m4 ($@)
   unlink ($tcache . $req->id);
 
   # Run m4.
+  # Be extremely cautious to reverse the includes when talking to M4:
+  # it doesn't speak the same --include as we do.
   my $command = ("$m4"
-                . " --define m4_warnings=$m4_warnings"
+                . join (' --include=', '', reverse @include)
+                . " --define=m4_warnings=$m4_warnings"
                 . ' --debug=aflq'
                 . " --error-output=$tcache" . $req->id
                 . join (' --trace=',   '', sort @macro)
-                . join (' --include=', '', @include)
                 . $files
                 . " >$ocache" . $req->id);
   verbose "running: $command";
index fc21a7eed82f4db3856c7637b6d81f1c23041c6a..5bbf97973b71ba08ae3705a36df5dea38bdc1036 100644 (file)
@@ -380,8 +380,9 @@ EOF
        or die "$me: cannot close $tmp/input.m4: $!\n";
 
     # Now ask m4 to perform the update.
+    # M4 and I don't agree on the associativity of `--include': reverse!
     xsystem ("$m4"
-            . join (' --include=', '', @include, $tmp)
+            . join (' --include=', '', reverse (@include, $tmp))
             . " $tmp/input.m4 >$tmp/updated");
     update_file ("$tmp/updated",
                 "$file" eq "$tmp/stdin" ? '-' : "$file");
index 08e367ad5b96912bc537d3154d1e0e74a42c0357..3a96202e92958436046bf2d3eeb4ac127bb5c17d 100644 (file)
@@ -71,9 +71,23 @@ m4_define([_m4_divert(TAIL)],         60)
 
 # AT_LINE
 # -------
-# Return the current file sans directory, a colon, and the current line.
+# Return the current file sans directory, a colon, and the current
+# line.  Be sure to return a _quoted_ filename, so if, for instance,
+# the user is lunatic enough to have a file named `dnl' (and I, for
+# one, love to be brainless and stubborn sometimes), then we return a
+# quoted name.
+#
+# Gee, we can't use simply
+#
+#  m4_patsubst(__file__, [^.*/\(.*\)], [[\1]])
+#
+# since then, since `dnl' doesn't match the pattern, it is returned
+# with once quotation level less, so you lose, dammit!  And since GNU M4
+# is one of the biggest junk in the whole universe wrt regexp, don't
+# even think about using `?' or `\?'.  Bah, `*' will do.
+# Pleeeeeeeease, Gary, provide us with dirname and ERE!
 m4_define([AT_LINE],
-[m4_patsubst(__file__, ^.*/\(.*\), \1):__line__])
+[m4_patsubst(__file__, [^\(.*/\)*\(.*\)], [[\2]]):__line__])
 
 
 # AT_INIT(PROGRAM)
@@ -496,12 +510,12 @@ m4_define([AT_SETUP],
 [m4_define([AT_ordinal], m4_incr(AT_ordinal))
 m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal]))
 m4_divert_text([HELP],
-               [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])])
+               [m4_format([[ %3d: %-15s %s]], AT_ordinal, AT_LINE, [$1])])
 m4_divert_push([TESTS])dnl
-  AT_ordinal ) [#] AT_ordinal. AT_LINE: $1
+  AT_ordinal ) @%:@ AT_ordinal. AT_LINE: $1
     at_setup_line='AT_LINE'
     $at_verbose "AT_ordinal. $srcdir/AT_LINE: testing $1..."
-    $at_quiet $at_n "m4_format([%3d: %-18s], AT_ordinal, AT_LINE)[]$at_c"
+    $at_quiet $at_n "m4_format([[%3d: %-18s]], AT_ordinal, AT_LINE)[]$at_c"
     (
       $at_traceon
 ])