m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cygwin vs. --disable-static


From: Eric Blake
Subject: Re: cygwin vs. --disable-static
Date: Tue, 03 Oct 2006 21:56:16 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.7) Gecko/20060909 Thunderbird/1.5.0.7 Mnenhy/0.7.4.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 10/3/2006 6:44 AM:
> Compilation of CVS m4 currently fails on cygwin when configured with
> --disable-static, due to global variables referenced in the library export
> lists.  If nothing else, this is yet another example of why global
> variables in libraries are bad.

So with that, I removed all the global variable exports from libm4, which
allowed --disable-static to work on cygwin again.  It would be nice to see
libtool patched, but at least this breaks the dependency on that.  This
patch also allows the tests from m4.texinfo to use files from the examples
directory, as the branch was able to do.  With that capability, I should
now be able to make a better merge of the sections of the documentation
that use 'forloop'.

2006-10-03  Eric Blake  <address@hidden>

        Avoid all global variables in modules, so that --disable-static
        can work on cygwin.
        * examples/incl.m4: New file, from branch.
        * Makefile.am (dist_pkgdata_DATA): Distribute it.
        * doc/m4.texinfo (Location): Merge this section from branch.
        (Include): Update the test.
        * tests/generate.awk (new_test): Allow for VPATH build
        pre-processing of expected __program__ output.
        * m4/m4module.h (m4_current_diversion, m4_output_current_line):
        Avoid global variables.
        (m4_context_field_table): Add current_diversion, output_line.
        (m4_output_init, m4_make_diversion): Add parameter.
        (m4_get_program_name, m4_set_program_name): New accessors.
        * m4/m4private.h (m4_get_current_diversion),
        (m4_set_current_diversion, m4_get_output_line)
        (m4_set_output_line): New accessors.
        * m4/utility.c (m4_get_program_name, m4_set_program_name): New
        methods.
        * modules/m4.c (divnum, divert): Adjust callers.
        * modules/gnu.c (__program__): Likewise.
        * m4/output.c (m4_output_init, m4_make_diversion)
        (m4_freeze_diversions, m4_shipout_text, m4_make_diversion)
        (m4_insert_diversion): Likewise.
        * m4/input.c (file_clean, m4_push_file): Likewise.
        * src/freeze.c (reload_frozen_state): Likewise.
        * src/main.c (main, usage): Likewise.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFIzDf84KuGfSFAYARAhQxAJ48Tpw3ac5FMfj07AwGltVk/6AaiQCfdZ23
rd0JGqoRNQO63VzjD8u5MUw=
=rb8/
-----END PGP SIGNATURE-----
Index: Makefile.am
===================================================================
RCS file: /sources/m4/m4/Makefile.am,v
retrieving revision 1.47
diff -u -p -r1.47 Makefile.am
--- Makefile.am 26 Sep 2006 13:19:26 -0000      1.47
+++ Makefile.am 4 Oct 2006 03:51:20 -0000
@@ -337,6 +337,7 @@ dist_pkgdata_DATA = \
                  examples/fstab.m4 \
                  examples/hanoi.m4 \
                  examples/incl-test.m4 \
+                 examples/incl.m4 \
                  examples/include.m4 \
                  examples/indir.m4 \
                  examples/misc.m4 \
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.57
diff -u -p -r1.57 m4.texinfo
--- doc/m4.texinfo      29 Sep 2006 18:20:12 -0000      1.57
+++ doc/m4.texinfo      4 Oct 2006 03:51:21 -0000
@@ -3790,19 +3790,24 @@ sinclude(`n')
 @result{}
 @end example
 
-Assume in the following that the file @file{incl.m4} contains the lines:
address@hidden file: incl.m4
+This section assumes that the current directory is
address@hidden@value{VERSION}/@/tests}, and uses the file
address@hidden@value{VERSION}/@/examples/@/incl.m4} included in the
address@hidden M4 package.  The file @file{incl.m4} contains the lines:
address@hidden ignore
 @example
 Include file start
 foo
 Include file end
 @end example
address@hidden
+
 Normally file inclusion is used to insert the contents of a file
 into the input stream.  The contents of the file will be read by
 @code{m4} and macro calls in the file will be expanded:
 
address@hidden options: -I"$abs_top_srcdir"/examples
 @example
+$ @kbd{m4 -I ../examples}
 define(`foo', `FOO')
 @result{}
 include(`incl.m4')
@@ -3817,7 +3822,9 @@ of the file can be used to define macros
 Here is an example, which defines @samp{bar} to expand to the contents
 of @file{incl.m4}:
 
address@hidden options: -I"$abs_top_srcdir"/examples
 @example
+$ @kbd{m4 -I ../examples}
 define(`bar', include(`incl.m4'))
 @result{}
 This is `bar':  >>bar<<
@@ -5050,21 +5057,68 @@ supplied as part of the argument, as in 
 @node Location
 @section Printing current location
 
-To make it possible to specify the location of the error, two
+To make it possible to specify the location of the error, three
 utility builtins exist:
 
 @deffn {Builtin (gnu)} __file__
 @deffnx {Builtin (gnu)} __line__
-These expand to the @emph{quoted} name of the current input file, and
-the current input line number in that file.
address@hidden {Builtin (gnu)} __program__
+Expand to the quoted name of the current input file, the
+current input line number in that file, and the quoted name of the
+current invocation of @code{m4}.
address@hidden deffn
 
 @example
-errprint(`m4:'__file__:__line__: `Input error
+errprint(__program__:__file__:__line__: `input error
 ')
address@hidden:stdin:1: Input error
address@hidden:stdin:1: input error
 @result{}
 @end example
address@hidden deffn
+
+Line numbers start at 1 for each file.  If the file was found due to the
address@hidden option or @env{M4PATH} environment variable, that is
+reflected in the file name.  Synclines, via @code{syncoutput}
+(@pxref{Syncoutput}) or the command line option @option{--synclines}
+(or @option{-s}, @pxref{Invoking m4}), and the
address@hidden and @samp{l} flags of @code{debugmode} (@pxref{Debug Levels}),
+also use this notion of current file and line.  Redefining the three
+location macros has no effect on syncline, debug, warning, or error
+message output.
+
+This example assumes that the current directory is
address@hidden@value{VERSION}/@/tests}, and reuses the file
address@hidden@value{VERSION}/@/examples/@/incl.m4} mentioned earlier
+(@pxref{Include}):
+
address@hidden options: -I"$abs_top_srcdir"/examples
address@hidden
+$ @kbd{m4 -I ../examples}
+define(`foo', ``$0' called at __file__:__line__')
address@hidden
+foo
address@hidden called at stdin:2
+include(`incl.m4')
address@hidden file start
address@hidden called at ../examples/incl.m4:2
address@hidden file end
address@hidden
address@hidden example
+
+Currently, all text wrapped with @code{m4wrap} (@pxref{M4wrap}) behaves
+as though it came from line 0 of the file ``''.  It is hoped that a
+future release of @code{m4} can overcome this limitation and remember
+which file invoked the call to @code{m4wrap}.
address@hidden FIXME - make m4wrap remember line locations.
+
+The @code{__program__} macro behaves like @samp{$0} in shell
+terminology.  If you invoke @code{m4} through an absolute path or a link
+with a different spelling, rather than by relying on a @env{PATH} search
+for plain @samp{m4}, it will affect how @code{__program__} expands.  The
+intent is that you can use it to produce error messages with the same
+formatting that @code{m4} produces internally.  It can also be used
+within @code{syscmd} (@pxref{Syscmd}) to pick the same version of
address@hidden that is currently running, rather than whatever version of
address@hidden happens to be first in @env{PATH}.
 
 @node M4exit
 @section Exiting from @code{m4}
Index: examples/incl.m4
===================================================================
RCS file: examples/incl.m4
diff -N examples/incl.m4
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ examples/incl.m4    4 Oct 2006 03:51:21 -0000
@@ -0,0 +1,3 @@
+Include file start
+foo
+Include file end
Index: m4/input.c
===================================================================
RCS file: /sources/m4/m4/m4/input.c,v
retrieving revision 1.48
diff -u -p -r1.48 input.c
--- m4/input.c  29 Sep 2006 13:33:13 -0000      1.48
+++ m4/input.c  4 Oct 2006 03:51:22 -0000
@@ -243,10 +243,10 @@ file_clean (m4 *context)
              m4_get_current_file (context));
   m4_set_current_file (context, isp->u.u_f.name);
   m4_set_current_line (context, isp->u.u_f.lineno);
-  m4_output_current_line = isp->u.u_f.out_lineno;
+  m4_set_output_line (context, isp->u.u_f.out_lineno);
   start_of_input_line = isp->u.u_f.advance_line;
   if (isp->prev != NULL)
-    m4_output_current_line = -1;
+    m4_set_output_line (context, -1);
 }
 
 static struct input_funcs file_funcs = {
@@ -285,13 +285,13 @@ m4_push_file (m4 *context, FILE *fp, con
   i->u.u_f.end = false;
   i->u.u_f.name = m4_get_current_file (context);
   i->u.u_f.lineno = m4_get_current_line (context);
-  i->u.u_f.out_lineno = m4_output_current_line;
+  i->u.u_f.out_lineno = m4_get_output_line (context);
   i->u.u_f.advance_line = start_of_input_line;
 
   m4_set_current_file (context, obstack_copy0 (current_input, title,
                                               strlen (title)));
   m4_set_current_line (context, 1);
-  m4_output_current_line = -1;
+  m4_set_output_line (context, -1);
 
   i->prev = isp;
   isp = i;
Index: m4/m4module.h
===================================================================
RCS file: /sources/m4/m4/m4/m4module.h,v
retrieving revision 1.90
diff -u -p -r1.90 m4module.h
--- m4/m4module.h       29 Sep 2006 13:33:13 -0000      1.90
+++ m4/m4module.h       4 Oct 2006 03:51:22 -0000
@@ -118,6 +118,9 @@ extern void m4_warn  (m4 *, int, const c
 extern void m4_warn_at_line  (m4 *, int, const char *, int,
                              const char *, ...)         M4_GNUC_PRINTF (5, 6);
 
+extern const char *    m4_get_program_name (void);
+extern void            m4_set_program_name (const char *);
+
 
 /* --- CONTEXT MANAGEMENT --- */
 
@@ -133,9 +136,11 @@ extern void                m4_delete       (m4 *);
        M4FIELD(m4_syntax_table *, syntax_table,   syntax)              \
        M4FIELD(const char *,      current_file,   current_file)        \
        M4FIELD(int,               current_line,   current_line)        \
+       M4FIELD(int,               output_line,    output_line)         \
        M4FIELD(FILE *,            debug_file,     debug_file)          \
        M4FIELD(m4_obstack,        trace_messages, trace_messages)      \
        M4FIELD(int,               exit_status,    exit_status)         \
+       M4FIELD(int,    current_diversion,         current_diversion)   \
        M4FIELD(bool,   no_gnu_extensions_opt,     no_gnu_extensions)   \
        M4FIELD(size_t, nesting_limit_opt,         nesting_limit)       \
        M4FIELD(int,    debug_level_opt,           debug_level)         \
@@ -402,17 +407,14 @@ extern    bool    m4_pop_wrapup   (void);
 
 /* --- OUTPUT MANAGEMENT --- */
 
-extern int m4_current_diversion;
-extern int m4_output_current_line;
-
-extern void    m4_output_init    (void);
+extern void    m4_output_init    (m4 *);
 extern void    m4_output_exit    (void);
 extern void    m4_shipout_text   (m4 *, m4_obstack *, const char *, int);
 extern void    m4_shipout_int    (m4_obstack *, int);
 extern void    m4_shipout_string (m4 *, m4_obstack *, const char *,
                                   int, bool);
 
-extern void    m4_make_diversion    (int);
+extern void    m4_make_diversion    (m4 *, int);
 extern void    m4_insert_diversion  (m4 *, int);
 extern void    m4_insert_file       (m4 *, FILE *);
 extern void    m4_freeze_diversions (m4 *, FILE *);
Index: m4/m4private.h
===================================================================
RCS file: /sources/m4/m4/m4/m4private.h,v
retrieving revision 1.64
diff -u -p -r1.64 m4private.h
--- m4/m4private.h      27 Sep 2006 13:21:05 -0000      1.64
+++ m4/m4private.h      4 Oct 2006 03:51:22 -0000
@@ -56,10 +56,12 @@ struct m4 {
 
   const char *         current_file;   /* Current input file.  */
   int                  current_line;   /* Current input line.  */
+  int                  output_line;    /* Current output line.  */
 
-  FILE *               debug_file;     /* File for debugging output.  */
-  m4_obstack           trace_messages;
-  int                  exit_status;    /* Cumulative exit status.  */
+  FILE *       debug_file;             /* File for debugging output.  */
+  m4_obstack   trace_messages;
+  int          exit_status;            /* Cumulative exit status.  */
+  int          current_diversion;      /* Current output diversion.  */
 
   /* Option flags  (set in src/main.c).  */
   bool         no_gnu_extensions;              /* -G */
@@ -93,12 +95,16 @@ struct m4 {
 #  define m4_set_current_file(C, V)            ((C)->current_file = (V))
 #  define m4_get_current_line(C)               ((C)->current_line)
 #  define m4_set_current_line(C, V)            ((C)->current_line = (V))
+#  define m4_get_output_line(C)                        ((C)->output_line)
+#  define m4_set_output_line(C, V)             ((C)->output_line = (V))
 #  define m4_get_debug_file(C)                 ((C)->debug_file)
 #  define m4_set_debug_file(C, V)              ((C)->debug_file = (V))
 #  define m4_get_trace_messages(C)             ((C)->trace_messages)
 #  define m4_set_trace_messages(C, V)          ((C)->trace_messages = (V))
 #  define m4_get_exit_status(C)                        ((C)->exit_status)
 #  define m4_set_exit_status(C, V)             ((C)->exit_status = (V))
+#  define m4_get_current_diversion(C)          ((C)->current_diversion)
+#  define m4_set_current_diversion(C, V)       ((C)->current_diversion = (V))
 #  define m4_get_no_gnu_extensions_opt(C)      ((C)->no_gnu_extensions)
 #  define m4_set_no_gnu_extensions_opt(C, V)   ((C)->no_gnu_extensions = (V))
 #  define m4_get_nesting_limit_opt(C)          ((C)->nesting_limit)
Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.29
diff -u -p -r1.29 output.c
--- m4/output.c 26 Sep 2006 13:19:26 -0000      1.29
+++ m4/output.c 4 Oct 2006 03:51:22 -0000
@@ -77,10 +77,6 @@ static int diversions;
 /* Total size of all in-memory buffer sizes.  */
 static int total_buffer_size;
 
-/* The number of the currently active diversion.  This variable is
-   maintained for the `divnum' builtin function.  */
-int m4_current_diversion;
-
 /* Current output diversion, NULL if output is being currently discarded.  */
 static struct diversion *output_diversion;
 
@@ -89,16 +85,12 @@ static FILE *output_file;   /* current val
 static char *output_cursor;    /* current value of (buffer + used) */
 static int output_unused;      /* current value of (size - used) */
 
-/* Number of input line we are generating output for.  */
-int m4_output_current_line;
-
-
 
 
-/* --- OUTPUT INITIALISATION --- */
+/* --- OUTPUT INITIALIZATION --- */
 
 void
-m4_output_init (void)
+m4_output_init (m4 *context)
 {
   diversion_table = xmalloc (sizeof *diversion_table);
   diversions = 1;
@@ -108,7 +100,7 @@ m4_output_init (void)
   diversion_table[0].used = 0;
 
   total_buffer_size = 0;
-  m4_current_diversion = 0;
+  m4_set_current_diversion (context, 0);
   output_diversion = diversion_table;
   output_file = stdout;
   output_cursor = NULL;
@@ -360,23 +352,24 @@ m4_shipout_text (m4 *context, m4_obstack
        if (start_of_output_line)
          {
            start_of_output_line = false;
-           m4_output_current_line++;
+           m4_set_output_line (context, m4_get_output_line (context) + 1);
 
 #ifdef DEBUG_OUTPUT
-           printf ("DEBUG: cur %d, cur out %d\n",
-                   m4_get_current_line (context), m4_output_current_line);
+           fprintf (stderr, "DEBUG: cur %d, cur out %d\n",
+                     m4_get_current_line (context),
+                     m4_get_output_line (context));
 #endif
 
-           /* Output a `#line NUM' synchronisation directive if needed.
-              If output_current_line was previously given a negative
-              value (invalidated), rather output `#line NUM "FILE"'.  */
+           /* Output a `#line NUM' synchronization directive if needed.
+              If output_line was previously given a negative
+              value (invalidated), then output `#line NUM "FILE"'.  */
 
-           if (m4_output_current_line != m4_get_current_line (context))
+           if (m4_get_output_line (context) != m4_get_current_line (context))
              {
                sprintf (line, "#line %d", m4_get_current_line (context));
                for (cursor = line; *cursor; cursor++)
                  OUTPUT_CHARACTER (*cursor);
-               if (m4_output_current_line < 1
+               if (m4_get_output_line (context) < 1
                    && m4_get_current_file (context)[0] != '\0')
                  {
                    OUTPUT_CHARACTER (' ');
@@ -389,7 +382,7 @@ m4_shipout_text (m4 *context, m4_obstack
                    OUTPUT_CHARACTER ('"');
                  }
                OUTPUT_CHARACTER ('\n');
-               m4_output_current_line = m4_get_current_line (context);
+               m4_set_output_line (context, m4_get_current_line (context));
              }
          }
        OUTPUT_CHARACTER (*text);
@@ -439,7 +432,7 @@ m4_shipout_string (m4 *context, m4_obsta
    available file descriptors (each overflowing diversion uses one).  */
 
 void
-m4_make_diversion (int divnum)
+m4_make_diversion (m4 *context, int divnum)
 {
   struct diversion *diversion;
 
@@ -453,7 +446,7 @@ m4_make_diversion (int divnum)
       output_unused = 0;
     }
 
-  m4_current_diversion = divnum;
+  m4_set_current_diversion (context, divnum);
 
   if (divnum < 0)
     return;
@@ -478,7 +471,7 @@ m4_make_diversion (int divnum)
   output_file = output_diversion->file;
   output_cursor = output_diversion->buffer + output_diversion->used;
   output_unused = output_diversion->size - output_diversion->used;
-  m4_output_current_line = -1;
+  m4_set_output_line (context, -1);
 }
 
 /* Insert a FILE into the current output file, in the same manner
@@ -538,7 +531,7 @@ m4_insert_diversion (m4 *context, int di
       else if (diversion->buffer)
        output_text (context, diversion->buffer, diversion->used);
 
-      m4_output_current_line = -1;
+      m4_set_output_line (context, -1);
     }
 
   /* Return all space used by the diversion.  */
@@ -578,9 +571,9 @@ m4_freeze_diversions (m4 *context, FILE 
   struct diversion *diversion;
   struct stat file_stat;
 
-  saved_number = m4_current_diversion;
+  saved_number = m4_get_current_diversion (context);
   last_inserted = 0;
-  m4_make_diversion (0);
+  m4_make_diversion (context, 0);
   output_file = file;          /* kludge in the frozen file */
 
   for (divnum = 1; divnum < diversions; divnum++)
Index: m4/utility.c
===================================================================
RCS file: /sources/m4/m4/m4/utility.c,v
retrieving revision 1.49
diff -u -p -r1.49 utility.c
--- m4/utility.c        26 Sep 2006 13:19:26 -0000      1.49
+++ m4/utility.c        4 Oct 2006 03:51:22 -0000
@@ -21,10 +21,10 @@
 #include <config.h>
 
 #include "m4private.h"
+#include "progname.h"
 #include "verror.h"
 #include "xvasprintf.h"
 
-
 static const char * skip_space (m4 *, const char *);
 
 
@@ -198,3 +198,22 @@ m4_warn_at_line (m4 *context, int errnum
       free (full_format);
     }
 }
+
+
+/* Wrap the gnulib progname module, to avoid exporting a global
+   variable from a library.  Retrieve the program name for use in
+   error messages and the __program__ macro.  */
+const char *
+m4_get_program_name (void)
+{
+  return program_name;
+}
+
+/* Wrap the gnulib progname module, to avoid exporting a global
+   variable from a library.  Set the program name for use in error
+   messages and the __program__ macro to argv[0].  */
+void
+m4_set_program_name (const char *name)
+{
+  set_program_name (name);
+}
Index: modules/gnu.c
===================================================================
RCS file: /sources/m4/m4/modules/gnu.c,v
retrieving revision 1.60
diff -u -p -r1.60 gnu.c
--- modules/gnu.c       3 Oct 2006 12:57:18 -0000       1.60
+++ modules/gnu.c       4 Oct 2006 03:51:23 -0000
@@ -315,7 +315,7 @@ M4BUILTIN_HANDLER (__line__)
  **/
 M4BUILTIN_HANDLER (__program__)
 {
-  m4_shipout_string (context, obs, program_name, 0, true);
+  m4_shipout_string (context, obs, m4_get_program_name (), 0, true);
 }
 
 
Index: modules/m4.c
===================================================================
RCS file: /sources/m4/m4/modules/m4.c,v
retrieving revision 1.77
diff -u -p -r1.77 m4.c
--- modules/m4.c        29 Sep 2006 13:33:13 -0000      1.77
+++ modules/m4.c        4 Oct 2006 03:51:23 -0000
@@ -543,13 +543,13 @@ M4BUILTIN_HANDLER (divert)
   if (argc == 2 && !m4_numeric_arg (context, argc, argv, 1, &i))
     return;
 
-  m4_make_diversion (i);
+  m4_make_diversion (context, i);
 }
 
 /* Expand to the current diversion number, -1 if none.  */
 M4BUILTIN_HANDLER (divnum)
 {
-  m4_shipout_int (obs, m4_current_diversion);
+  m4_shipout_int (obs, m4_get_current_diversion (context));
 }
 
 /* Bring back the diversion given by the argument list.  If none is
Index: src/freeze.c
===================================================================
RCS file: /sources/m4/m4/src/freeze.c,v
retrieving revision 1.51
diff -u -p -r1.51 freeze.c
--- src/freeze.c        27 Sep 2006 12:24:53 -0000      1.51
+++ src/freeze.c        4 Oct 2006 03:51:23 -0000
@@ -694,7 +694,7 @@ ill-formed frozen file, version 2 direct
 
              /* Select a diversion and add a string to it.  */
 
-             m4_make_diversion (number[0]);
+             m4_make_diversion (context, number[0]);
              if (number[1] > 0)
                m4_shipout_text (context, NULL, string[1], number[1]);
              break;
Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.91
diff -u -p -r1.91 main.c
--- src/main.c  29 Sep 2006 18:20:13 -0000      1.91
+++ src/main.c  4 Oct 2006 03:51:23 -0000
@@ -23,7 +23,6 @@
 #include "m4private.h"
 #include "getopt.h"
 #include "version-etc.h"
-#include "gnu/progname.h"
 #include "pathconf.h"
 #include "xstrtol.h"
 
@@ -64,10 +63,10 @@ usage (int status)
 {
   if (status != EXIT_SUCCESS)
     fprintf (stderr, _("Try `%s --help' for more information.\n"),
-            program_name);
+            m4_get_program_name ());
   else
     {
-      printf (_("Usage: %s [OPTION]... [FILE]...\n"), program_name);
+      printf (_("Usage: %s [OPTION]... [FILE]...\n"), m4_get_program_name ());
       fputs (_("\
 Process macros in FILEs.\n\
 If no FILE or if FILE is `-', standard input is read.  With no FILE and both\n\
@@ -276,7 +275,7 @@ main (int argc, char *const *argv, char 
   int exit_status;
 
   /* Initialize gnulib error module.  */
-  set_program_name (argv[0]);
+  m4_set_program_name (argv[0]);
 
   setlocale (LC_ALL, "");
 #ifdef ENABLE_NLS
@@ -504,7 +503,7 @@ main (int argc, char *const *argv, char 
   if (debugfile && !m4_debug_set_output (context, debugfile))
     m4_error (context, 0, errno, _("cannot set debug file `%s'"), debugfile);
   m4_input_init (context);
-  m4_output_init ();
+  m4_output_init (context);
   m4_include_env_init (context);
 
   if (frozen_file_to_read)
@@ -650,7 +649,7 @@ main (int argc, char *const *argv, char 
     produce_frozen_state (context, frozen_file_to_write);
   else
     {
-      m4_make_diversion (0);
+      m4_make_diversion (context, 0);
       m4_undivert_all (context);
     }
 
Index: tests/generate.awk
===================================================================
RCS file: /sources/m4/m4/tests/generate.awk,v
retrieving revision 1.19
diff -u -p -r1.19 generate.awk
--- tests/generate.awk  20 Sep 2006 04:04:29 -0000      1.19
+++ tests/generate.awk  4 Oct 2006 03:51:23 -0000
@@ -172,10 +172,19 @@ function new_test(input, status, output,
   if (xfail == 1)
     printf ("AT_XFAIL_IF([:])\n");
 
+  if (options ~ /-I/)
+    {
+      printf ("AT_DATA([expout1],\n[[%s]])\n", output);
+      printf ("sed -e \"s|\\.\\./examples|$abs_top_srcdir/examples|g\" \\\n");
+      printf ("  < expout1 > expout\n\n");
+    }
+
   printf ("AT_DATA([[input.m4]],\n[[%s]])\n\n", input);
   # Some of these tests `include' files from tests/.
   printf ("AT_CHECK_M4([[%s input.m4]], %s,", options, status);
-  if (output)
+  if (options ~ /-I/)
+    printf ("\n[expout]");
+  else if (output)
     printf ("\n[[%s]]", output);
   else
     printf (" []");

reply via email to

[Prev in Thread] Current Thread [Next in Thread]