m4-commit
[Top][All Lists]
Advanced

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

[SCM] GNU M4 source repository branch, include-dso, updated. cvs-readonl


From: Gary V. Vaughan
Subject: [SCM] GNU M4 source repository branch, include-dso, updated. cvs-readonly-109-gcceb922
Date: Tue, 06 May 2008 19:45:33 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=cceb922d0670c2f93a0cd0ae79c64b376c7351b2

The branch, include-dso has been updated
       via  cceb922d0670c2f93a0cd0ae79c64b376c7351b2 (commit)
      from  c2a2811a8b81dac7b090dcd6f584742fed6dd085 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit cceb922d0670c2f93a0cd0ae79c64b376c7351b2
Author: Gary V. Vaughan <address@hidden>
Date:   Tue May 6 14:34:08 2008 -0400

    Factor load functionality into include builtin.
    
    * m4/module.c (m4__module_open): Instead of calling lt_dlopenext
    right away, use the preload hint first incase path searching has
    been disabled by POSIXLY_CORRECT.  Otherwise fallback to a
    manual path search to override libltdl's algorithm.
    * m4/m4module.h: Adjust.
    * m4/path.c (FILE_SUFFIXES): Order to try suffixes in our path
    search algorithm.
    (NO_SUFFIXES): Alternatively, how to to search a path without
    adding file suffixes.
    (m4_path_search): Add a new suffixes parameter defaulting to
    NO_SUFFIXES.  Adjust all callers.
    (m4_load_filename): New generic load function that tries to
    open a matched file first as a module, and if that fails fall
    back to as (possibly frozen) m4 input.
    (m4_fopen): New function with close on exec functionality.
    * modules/m4.c (include, sinclude): Use m4_load_filename to
    overload these builtins to work with modules too.
    * modules/load.c (load): Removed this builtin.
    * src/main.c: Remove Dynamic loading features section, and
    M4MODPATH support.
    (long_options): Remove "load-module", "unload-module" and
    "module-directory" options.
    (OPTSTRING): Remove 'M' and 'm' options.
    (process_file): Use m4_load_filename to support module names
    on the command line.
    * Makefile.am (TESTS_ENVIRONMENT): No need for abs_top_builddir
    any more.
    * doc/m4.texinfo: Update examples.
    (Dynamic loading features, Load): Removed.
    (Command line files): Describe how non-option arguments are
    treated to try to find a matching macro file or dso.
    (Include): Describe additional dso loading features if a
    suitable text file cannot be found.
    (Modules): Updated.
    * tests/builtins.at, tests/m4.in, tests/modules.at,
    tests/options.at: Adjust test cases and calling conventions
    to new semantics.
    * NEWS: Updated.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   42 ++++++++++++
 Makefile.am       |    1 -
 NEWS              |   22 +++++-
 doc/m4.texinfo    |  184 ++++++++++++++++++++------------------------------
 m4/m4module.h     |    5 +-
 m4/module.c       |   22 ++++++-
 m4/path.c         |  191 ++++++++++++++++++++++++++++++++++++++++++-----------
 modules/load.c    |   11 ---
 modules/m4.c      |   32 ++-------
 src/freeze.c      |    6 +-
 src/main.c        |  116 ++++++++++----------------------
 tests/builtins.at |    6 +-
 tests/m4.in       |    7 +-
 tests/modules.at  |   79 ++++++++++------------
 tests/options.at  |    2 +-
 15 files changed, 399 insertions(+), 327 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3470af1..536b3d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,45 @@
+2008-05-05  Gary V. Vaughan  <address@hidden>
+
+       Factor load functionality into include builtin.
+       * m4/module.c (m4__module_open): Instead of calling lt_dlopenext
+       right away, use the preload hint first incase path searching has
+       been disabled by POSIXLY_CORRECT.  Otherwise fallback to a
+       manual path search to override libltdl's algorithm.
+       * m4/m4module.h: Adjust.
+       * m4/path.c (FILE_SUFFIXES): Order to try suffixes in our path
+       search algorithm.
+       (NO_SUFFIXES): Alternatively, how to to search a path without
+       adding file suffixes.
+       (m4_path_search): Add a new suffixes parameter defaulting to
+       NO_SUFFIXES.  Adjust all callers.
+       (m4_load_filename): New generic load function that tries to
+       open a matched file first as a module, and if that fails fall
+       back to as (possibly frozen) m4 input.
+       (m4_fopen): New function with close on exec functionality.
+       * modules/m4.c (include, sinclude): Use m4_load_filename to
+       overload these builtins to work with modules too.
+       * modules/load.c (load): Removed this builtin.
+       * src/main.c: Remove Dynamic loading features section, and
+       M4MODPATH support.
+       (long_options): Remove "load-module", "unload-module" and
+       "module-directory" options.
+       (OPTSTRING): Remove 'M' and 'm' options.
+       (process_file): Use m4_load_filename to support module names
+       on the command line.
+       * Makefile.am (TESTS_ENVIRONMENT): No need for abs_top_builddir
+       any more.
+       * doc/m4.texinfo: Update examples.
+       (Dynamic loading features, Load): Removed.
+       (Command line files): Describe how non-option arguments are
+       treated to try to find a matching macro file or dso.
+       (Include): Describe additional dso loading features if a
+       suitable text file cannot be found.
+       (Modules): Updated.
+       * tests/builtins.at, tests/m4.in, tests/modules.at,
+       tests/options.at: Adjust test cases and calling conventions
+       to new semantics.
+       * NEWS: Updated.
+
 2008-05-05  Eric Blake  <address@hidden>
 
        Stage 22: allow builtin token concatenation outside address@hidden
diff --git a/Makefile.am b/Makefile.am
index 7606802..e47bdd1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -376,7 +376,6 @@ TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" 
CFLAGS="$(CFLAGS)" \
        CPP="$(CPP)" CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
        LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
        OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" CONFIG_SHELL="$(SHELL)" \
-       abs_top_builddir="$(abs_top_builddir)" \
        CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)" CXXCPP="$(CXXCPP)" \
        F77="$(F77)" FFLAGS="$(FFLAGS)" \
        GCJ="$(GCJ)" GCJFLAGS="$(GCJFLAGS)"
diff --git a/NEWS b/NEWS
index 35440ee..ce30bbd 100644
--- a/NEWS
+++ b/NEWS
@@ -76,13 +76,18 @@ promoted to 2.0.
     `--trace', allow more control over macro tracing from the command line
     between input files.
 
-*** New `--unload-module' command-line option allows more control over
-    dynamic modules from the command line.  Also, `-m'/`--load-module' now
-    acts between input files.
-
 *** New `--warnings' command-line option re-enables warnings, overriding
     `-Q'/`--quiet'/`--silent', allowing warnings even when POSIXLY_CORRECT.
 
+*** When GNU extensions are enabled, any command line arguments that wauld
+    have been interpreted as input file names with previous releases are
+    still searched for as before, but will first attempt to be loaded as
+    compiled modules before falling back on loading as m4 input.  In
+    POSIXLY_CORRECT mode, only m4 input files in the current directory can
+    be loaded.
+
+*** Any command line arguments that previously had to name input files
+
 ** POSIX conformance
 
 *** The `defn' builtin now allows any number of arguments, as POSIX requires.
@@ -96,6 +101,9 @@ promoted to 2.0.
 *** The experimental `epatsubst' and `eregexp' builtins have been removed
     in favor of a new `changeresyntax' builtin.
 
+*** The `load' builtin, introduced in previous betas has been removed in
+    lieu of richer `include' and `sinclude' functionality.
+
 ** New builtins
 
 *** New `changeresyntax' builtin allows programmatic setting of the default
@@ -175,6 +183,12 @@ promoted to 2.0.
 *** The `eval' and `mpeval' builtins now support the following new
     operators: `>>>', `\', `?:', and  `,'.
 
+*** When GNU extensions are enabled, the `include' and `sinclude' builtins
+    continue to search directories one at a time, but will first attempt to
+    load arguments as compiled modules and then as m4 input before moving
+    to the next directory in the search path.  In POSIXLY_CORRECT mode,
+    only m4 input in the current directory can be loaded.
+
 *** The `maketemp' builtin now always warns that it is obsolete, even in GNU
     mode where it uses the same secure algorithm as `mkstemp', because of
     the recommendation of POSIX to obsolete `maketemp' as inherently
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index e446765..d651c24 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -156,7 +156,6 @@ Introduction and preliminaries
 Invoking @code{m4}
 
 * Operation modes::             Command line options for operation modes
-* Dynamic loading features::    Command line options for dynamic loading
 * Preprocessor features::       Command line options for preprocessor features
 * Limits control::              Command line options for limits control
 * Frozen state::                Command line options for frozen state
@@ -234,7 +233,6 @@ Diverting and undiverting output
 Extending M4 with dynamic runtime modules
 
 * M4modules::                   Listing loaded modules
-* Load::                        Loading additional modules
 * Unload::                      Removing loaded modules
 * Refcount::                    Tracking module references
 * Standard Modules::            Standard bundled modules
@@ -591,7 +589,6 @@ version of @code{m4} introduces an option named 
@option{--default}).
 
 @menu
 * Operation modes::             Command line options for operation modes
-* Dynamic loading features::    Command line options for dynamic loading
 * Preprocessor features::       Command line options for preprocessor features
 * Limits control::              Command line options for limits control
 * Frozen state::                Command line options for frozen state
@@ -705,36 +702,6 @@ allow overriding @option{--silent}.
 @comment -Wno-category...?
 @end table
 
address@hidden Dynamic loading features
address@hidden Command line options for dynamic loading
-
-On platforms that support dynamic libraries, there are some options
-that affect dynamic loading.
-
address@hidden @code
address@hidden -M @var{DIRECTORY}
address@hidden address@hidden
-Specify an alternate @var{DIRECTORY} to search for modules.  This option
-can be used multiple times to add several different directories to the
-module search path.  @xref{Modules}, for more details.
-
address@hidden -m @var{MODULE}
address@hidden address@hidden
-Load @var{MODULE} before parsing more input files.  @var{MODULE} is
-searched for in each directory of the module search path, until the
-first match is found or the list is exhausted.  @xref{Modules}, for more
-details.  By default, the modules @samp{m4}, @samp{traditional}, and
address@hidden are preloaded, although this can be controlled during
-configuration with the @option{--with-modules} option to
address@hidden@value{VERSION}/@/configure}.  This option may be given more
-than once, and order with respect to file names is significant.
-
address@hidden address@hidden
-Unload @var{MODULE} before parsing more input files.  @xref{Modules},
-for more details.  This option may be given more than once, and order
-with respect to file names is significant.
address@hidden table
-
 @node Preprocessor features
 @section Command line options for preprocessor features
 
@@ -1003,16 +970,19 @@ respect to file names.  @xref{Trace}, for more details.
 @cindex command line, file names on the
 @cindex file names, on the command line
 The remaining arguments on the command line are taken to be input file
-names.  If no names are present, standard input is read.  A file
-name of @file{-} is taken to mean standard input.  It is
-conventional, but not required, for input files to end in @samp{.m4}.
-
-The input files are read in the sequence given.  Standard input can be
-read more than once, so the file name @file{-} may appear multiple times
-on the command line; this makes a difference when input is from a
-terminal or other special file type.  It is an error if an input file
-ends in the middle of argument collection, a comment, or a quoted
-string.
+names or module names (@pxref{Modules}).  Whether or not any modules
+are loaded from command line arguments, when no actual input file names
+are given, then standard input is read.  A file name of @file{-} can be
+used to denote standard input.  It is conventional, but not required,
+for input file names to end in @samp{.m4} and for module names to end
+in @samp{.la}.  The input files and modules are attended to in the
+sequence given.
+
+Standard input can be read more than once, so the file name @file{-}
+may appear multiple times on the command line; this makes a difference
+when input is from a terminal or other special file type.  It is an
+error if an input file ends in the middle of argument collection, a
+comment, or a quoted string.
 @comment FIXME - it would be nicer if we let these three things
 @comment continue across file boundaries, provided that we warn in
 @comment interactive use when switching to stdin in a non-default parse
@@ -1020,10 +990,9 @@ string.
 
 Various options, such as @option{--define} (@option{-D}), @option{--undefine}
 (@option{-U}), @option{--synclines} (@option{-s}), @option{--trace}
-(@option{-t}), @option{--regexp-syntax} (@option{-r}), and
address@hidden (@option{-m}), only take effect after processing
-input from any file names that occur earlier on the command line.  For
-example, assume the file @file{foo} contains:
+(@option{-t}), and @option{--regexp-syntax} (@option{-r}), only take
+effect after processing input from any file names that occur earlier
+on the command line.  For example, assume the file @file{foo} contains:
 
 @comment file: foo
 @example
@@ -1041,6 +1010,14 @@ $ @kbd{m4 -Dbar=hello foo -Dbar=world foo}
 @result{}world
 @end example
 
address@hidden command line, module names on the
address@hidden module names, on the command line
+The use of loadable runtime modules in any sense is a @acronym{GNU} M4
+extension, so if @option{-G} is also passed or if the @env{POSIXLY_CORRECT}
+environment variable is set, even otherwise valid module names will be
+treated as though they were input file names (and no doubt cause havoc as
+M4 tries to scan and expand the contents as if it were written in @code{m4}).
+
 If none of the input files invoked @code{m4exit} (@pxref{M4exit}), the
 exit status of @code{m4} will be 0 for success, 1 for general failure
 (such as problems with reading an input file), and 63 for version
@@ -5490,12 +5467,12 @@ m4wrap(`define(`bar', 
')m4wrap(defn(`divnum'))m4wrap(`)bar
 @code{m4} allows you to include named files at any point in the input.
 
 @menu
-* Include::                     Including named files
+* Include::                     Including named files and modules
 * Search Path::                 Searching for include files
 @end menu
 
 @node Include
address@hidden Including named files
address@hidden Including named files and modules
 
 There are two builtin macros in @code{m4} for including files:
 
@@ -5519,10 +5496,10 @@ parameters.
 @comment status: 1
 @example
 include(`n')
address@hidden:stdin:1: include: cannot open `n': No such file or directory
address@hidden:stdin:1: include: cannot open file `n': No such file or directory
 @result{}
 include()
address@hidden:stdin:2: include: cannot open `': No such file or directory
address@hidden:stdin:2: include: cannot open file `': No such file or directory
 @result{}
 sinclude(`n')
 @result{}
@@ -5580,15 +5557,32 @@ This is `bar':  >>bar<<
 
 This use of @code{include} is not trivial, though, as files can contain
 quotes, commas, and parentheses, which can interfere with the way the
address@hidden parser works.  @acronym{GNU} @code{m4} seamlessly concatenates
address@hidden parser works.  @acronym{GNU} M4 seamlessly concatenates
 the file contents with the next character, even if the included file
 ended in the middle of a comment, string, or macro call.  These
 conditions are only treated as end of file errors if specified as input
 files on the command line.
 
-In @acronym{GNU} @code{m4}, an alternative method of reading files is
+In @acronym{GNU} M4, an alternative method of reading files is
 using @code{undivert} (@pxref{Undivert}) on a named file.
 
+In addition, as a @acronym{GNU} M4 extension, if the included file can
+not be found exactly as given, various standard suffixes are appended.
+If the included file name is absolute (a full path from the root directory
+is given) then additional search directories are not examined, although
+suffixes will be tried if the file is not found exactly as given.
+For each directory that is searched (according to the absolute directory
+give in the file name, or else by directories listed in @env{M4PATH} and
+given with the @option{-I} and @option{-B} options), first the unchanged
+file name is tried, and then again with the suffixes @samp{.m4f} and
address@hidden
+
+Furthermore, if no matching file has yet been found, before moving on to
+the next directory, @samp{.la} and the usual binary module suffix for
+the host platform (usually @samp{.so}) are also tried.  Matching with one
+of those suffixes will attempt to load the matched file as a dynamic
+module. @xref{Modules}, for more details.
+
 @node Search Path
 @section Searching for include files
 
@@ -6013,10 +6007,11 @@ Starting with release 2.0, M4 uses Libtool's 
@code{libltdl} facilities
 to move all of M4's builtins out to pluggable modules.  Unless compile
 time options are set to change the default build, the installed M4 2.0
 binary is virtually identical to 1.4.x, supporting the same builtins.
-However, an optional module can be loaded into the running M4 interpreter
-to provide a new @code{load} builtin.  This facilitates runtime
-extension of the M4 builtin macro list using compiled C code linked
-against a new shared library, typically named @file{libm4.so}.
+However, additional modules can be loaded into the running M4 interpreter
+as it is started up at the command line, or during normal expansion of
+macros.  This facilitates runtime extension of the M4 builtin macro
+list using compiled C code linked against a new shared library,
+typically named @file{libm4.so}.
 
 For example, you might want to add a @code{setenv} builtin to M4, to
 use before invoking @code{esyscmd}.  We might write a @file{setenv.c}
@@ -6056,7 +6051,7 @@ M4 code:
 
 @comment ignore
 @example
-$ @kbd{M4MODPATH=`pwd` m4 --load-module=setenv}
+$ @kbd{m4 setenv}
 setenv(`PATH', `/sbin:/bin:/usr/sbin:/usr/bin')
 @result{}
 esyscmd(`ifconfig -a')dnl
@@ -6064,12 +6059,12 @@ esyscmd(`ifconfig -a')dnl
 @end example
 
 Or instead of loading the module from the M4 invocation, you can use
-the new @code{load} builtin:
+the @code{include} builtin:
 
 @comment ignore
 @example
-$ @kbd{M4MODPATH=`pwd` m4 --load-module=load}
-load(`setenv')
+$ @kbd{m4}
+include(`setenv')
 @result{}
 setenv(`PATH', `/sbin:/bin:/usr/sbin:/usr/bin')
 @result{}
@@ -6078,7 +6073,7 @@ setenv(`PATH', `/sbin:/bin:/usr/sbin:/usr/bin')
 Also, at build time, you can choose which modules to build into
 the core (so that they will be available without dynamic loading).
 SUSv3 M4 functionality is contained in the module @samp{m4}, @acronym{GNU}
-extensions in the module @samp{gnu}, the @code{load} builtin in the
+extensions in the module @samp{gnu}, additional module builtins in the
 module @samp{load} and so on.
 
 We hinted earlier that the @code{m4} and @code{gnu} modules are
@@ -6086,10 +6081,10 @@ preloaded into the installed M4 binary, but it is 
possible to install
 a @emph{thinner} binary; for example, omitting the @acronym{GNU}
 extensions by configuring the distribution with @kbd{./configure
 --with-modules=m4}.  For a binary built with that option to understand
-code that uses @acronym{GNU} extensions, you must then run @kbd{m4
---load-module=gnu}.  It is also possible to build a @emph{fatter}
-binary with additional modules preloaded: adding, say, the @code{load}
-builtin using @kbd{./configure --with-modules="m4 gnu load"}.
+code that uses @acronym{GNU} extensions, you must then run @kbd{m4 gnu}.
+It is also possible to build a @emph{fatter} binary with additional
+modules preloaded: adding, say, the @code{load} module usingr
+ @kbd{./configure --with-modules="m4 gnu load"}.
 
 @acronym{GNU} M4 now has a facility for defining additional builtins without
 recompiling the sources.  In actual fact, all of the builtins provided
@@ -6105,7 +6100,6 @@ two modes of startup.
 
 @menu
 * M4modules::                   Listing loaded modules
-* Load::                        Loading additional modules
 * Unload::                      Removing loaded modules
 * Refcount::                    Tracking module references
 * Standard Modules::            Standard bundled modules
@@ -6122,43 +6116,13 @@ position depends on when the module was @emph{first} 
loaded.
 @end deffn
 
 For example, if @acronym{GNU} @code{m4} is started with the
address@hidden load} option to load the module @samp{load} and make this
-builtin available, @code{m4modules} will yield the following:
-
address@hidden options: -m load
address@hidden
-$ @kbd{m4 -m load}
-m4modules
address@hidden,gnu,m4
address@hidden example
-
address@hidden Load
address@hidden Loading additional modules
-
address@hidden {Builtin (load)} load (@var{module-name})
address@hidden will be searched for along the module search path
-(@pxref{Standard Modules}) and loaded if found.  Loading a module
-consists of running its initialization function (if any) and then adding
-any macros it provides to the internal table.
address@hidden module, @code{m4modules} will yield the following:
 
-The macro @code{load} is recognized only with parameters.
address@hidden deffn
-
-Once the @code{load} module has successfully loaded, use of the
address@hidden macro is entirely equivalent to the @option{-m} command line
-option.
-
address@hidden The -mmpeval/--unload=mpeval pair allows the testsuite to skip 
this
address@hidden test if mpeval was not configured for usage.
address@hidden options: -m load -m mpeval --unload-module=mpeval
address@hidden options: load
 @example
-$ @kbd{m4 -m load}
+$ @kbd{m4 load}
 m4modules
 @result{}load,gnu,m4
-load(`mpeval')
address@hidden
-m4modules
address@hidden,load,gnu,m4
 @end example
 
 @node Unload
@@ -6174,9 +6138,9 @@ running the module's finalization method (if any).
 The macro @code{unload} is recognized only with parameters.
 @end deffn
 
address@hidden options: -m mpeval -m load
address@hidden options: mpeval load
 @example
-$ @kbd{m4 -m mpeval -m load}
+$ @kbd{m4 mpeval load}
 m4modules
 @result{}load,mpeval,gnu,m4
 unload(`mpeval')
@@ -6199,16 +6163,16 @@ The macro @code{refcount} is recognized only with 
parameters.
 This example demonstrates tracking the reference count of the gnu
 module.
 
address@hidden options: -m load
address@hidden options: load
 @example
-$ @kbd{m4 -m load}
+$ @kbd{m4 load}
 m4modules
 @result{}load,gnu,m4
 refcount(`gnu')
 @result{}1
 m4modules
 @result{}load,gnu,m4
-load(`gnu')
+include(`gnu')
 @result{}
 refcount(`gnu')
 @result{}2
@@ -6273,7 +6237,7 @@ Expands to the empty string, as an indication that the
 @end deffn
 
 @item load
-This module supplies the builtins required to use modules from within a
+This module supplies the builtins for advanced use of modules from within a
 @acronym{GNU} @code{m4} program.  @xref{Modules}, for more details.  The
 module also defines the following macro:
 
@@ -7232,9 +7196,9 @@ The macro @code{mpeval} is recognized only with 
parameters.
 
 For the most part, using @code{mpeval} is similar to using @code{eval}:
 
address@hidden options: -m mpeval
address@hidden options: mpeval
 @example
-$ @kbd{m4 -m mpeval}
+$ @kbd{m4 mpeval}
 mpeval(`(1 << 70) + 2 ** 68 * 3', `16')
 @result{}700000000000000000
 `0r24:'mpeval(`0r36:zYx', `24', `5')
@@ -7259,9 +7223,9 @@ value of the argument that ended evaluation, rather than 
collapsing to
 even in @acronym{POSIX} mode, since @code{mpeval} does not have to
 conform to the @acronym{POSIX} rules for @code{eval}.
 
address@hidden options: -m mpeval
address@hidden options: mpeval
 @example
-$ @kbd{m4 -m mpeval}
+$ @kbd{m4 mpeval}
 mpeval(`2 / 4')
 @result{}0
 mpeval(`2 \ 4')
diff --git a/m4/m4module.h b/m4/m4module.h
index 21a8339..e086041 100644
--- a/m4/m4module.h
+++ b/m4/m4module.h
@@ -527,7 +527,10 @@ extern void        m4_undivert_all      (m4 *);
 
 extern void    m4_include_env_init      (m4 *);
 extern void    m4_add_include_directory (m4 *, const char *, bool);
-extern FILE *   m4_path_search          (m4 *, const char *, char **);
+extern bool    m4_load_filename         (m4 *, const char *, const char *,
+                                         m4_obstack *, bool);
+extern char *   m4_path_search          (m4 *, const char *, const char **);
+extern FILE *  m4_fopen                 (m4 *, const char *);
 
 
 
diff --git a/m4/module.c b/m4/module.c
index 2bda5f6..f1556f2 100644
--- a/m4/module.c
+++ b/m4/module.c
@@ -390,13 +390,33 @@ compare_builtin_CB (const void *a, const void *b)
 m4_module *
 m4__module_open (m4 *context, const char *name, m4_obstack *obs)
 {
-  lt_dlhandle          handle          = lt_dlopenext (name);
+  static const char *  suffixes[]      = { "", ".la", LT_MODULE_EXT, NULL };
+  char *               filepath        = NULL;
+  lt_dlhandle          handle          = NULL;
+  lt_dladvise          advise          = NULL;
   m4_module *          module          = NULL;
   m4_module_init_func *        init_func       = NULL;
 
   assert (context);
   assert (iface_id);           /* need to have called m4__module_init */
 
+  /* Try opening as a preloaded module initially incase path searching
+     has been disabled by POSIXLY_CORRECT... */
+  if (!lt_dladvise_init (&advise) && !lt_dladvise_preload (&advise))
+    handle = lt_dlopenadvise (name, advise);
+  lt_dladvise_destroy (&advise);
+
+  /* ...otherwise resort to a path search anyway.  */
+  if (!handle)
+    {
+      filepath = m4_path_search (context, name, suffixes);
+      if (filepath)
+        {
+          handle = lt_dlopenext (filepath);
+          free (filepath);
+        }
+    }
+
   if (handle)
     {
       const lt_dlinfo *info = lt_dlgetinfo (handle);
diff --git a/m4/path.c b/m4/path.c
index 91991e0..50d7d6e 100644
--- a/m4/path.c
+++ b/m4/path.c
@@ -33,6 +33,17 @@
 /* Define this to see runtime debug info.  Implied by DEBUG.  */
 /*#define DEBUG_INCL */
 
+static const char *FILE_SUFFIXES[] = {
+  "",
+  ".m4f",
+  ".m4",
+  ".la",
+  LT_MODULE_EXT,
+  NULL
+};
+
+static const char *NO_SUFFIXES[] = { "", NULL };
+
 static void search_path_add (m4__search_path_info *, const char *, bool);
 static void search_path_env_init (m4__search_path_info *, char *, bool);
 
@@ -123,83 +134,183 @@ m4_add_include_directory (m4 *context, const char *dir, 
bool prepend)
 #endif
 }
 
-/* Search for FILE according to -B options, `.', -I options, then
-   M4PATH environment.  If successful, return the open file, and if
-   RESULT is not NULL, set *RESULT to a malloc'd string that
-   represents the file found with respect to the current working
-   directory.  Otherwise, return NULL, and errno reflects the failure
-   from searching `.' (regardless of what else was searched).  */
 
-FILE *
-m4_path_search (m4 *context, const char *file, char **expanded_name)
+/* Search for FILE according to -B options, `.', -I options, then
+   M4PATH environment.  If any SUFFIXES are given, then in each
+   searched directory, if an exact match is not found then try
+   appending each suffix and rematching before moving on to the
+   next directory.
+
+   The full path of the first matching file discovered is
+   returned in a freshly malloced string.  Otherwise, return NULL,
+   and if no file was found errno will represent the failure from
+   searching `.' (regardless of what else was searched).  */
+char *
+m4_path_search (m4 *context, const char *filename, const char **suffixes)
 {
-  FILE *fp;
   m4__search_path *incl;
-  char *name;                  /* buffer for constructed name */
-  int e = 0;
-
-  if (expanded_name != NULL)
-    *expanded_name = NULL;
+  char *filepath;              /* buffer for constructed name */
+  size_t max_suffix_len = 0;
+  int i, e = 0;
 
   /* Reject empty file.  */
-  if (*file == '\0')
+  if (*filename == '\0')
     {
       errno = ENOENT;
       return NULL;
     }
 
+  /* Use no suffixes by default.  */
+  if (suffixes == NULL)
+    suffixes = NO_SUFFIXES;
+
+  /* Find the longest suffix, so that we will always allocate enough
+     memory for a filename with suffix.  */
+  for (i = 0; suffixes && suffixes[i]; ++i)
+    {
+      size_t len = strlen (suffixes[i]);
+      if (len > max_suffix_len)
+        max_suffix_len = len;
+    }
+
   /* If file is absolute, or if we are not searching a path, a single
      lookup will do the trick.  */
-  if (IS_ABSOLUTE_FILE_NAME (file) || m4_get_posixly_correct_opt (context))
+  if (IS_ABSOLUTE_FILE_NAME (filename))
     {
-      fp = fopen (file, "r");
-      if (fp != NULL)
-       {
-         if (set_cloexec_flag (fileno (fp), true) != 0)
-           m4_error (context, 0, errno, NULL,
-                     _("cannot protect input file across forks"));
-         if (expanded_name != NULL)
-           *expanded_name = xstrdup (file);
-         return fp;
-       }
+      size_t mem = strlen (filename);
+
+      /* Try appending each of the suffixes we were given.  */
+      filepath = strncpy (xmalloc (mem + max_suffix_len +1), filename, mem);
+      for (i = 0; suffixes && suffixes[i]; ++i)
+        {
+          strcpy (filepath + mem, suffixes[i]);
+         if (access (filepath, R_OK) == 0)
+           return filepath;
+
+          /* If search fails, we'll use the error we got from the first
+            access (usually with no suffix).  */
+         if (i == 0)
+           e = errno;
+        }
+      free (filepath);
+
+      /* No such file.  */
+      errno = e;
       return NULL;
     }
 
   for (incl = m4__get_search_path (context)->list;
        incl != NULL; incl = incl->next)
     {
-      name = file_name_concat (incl->dir, file, NULL);
+      char *name = file_name_concat (incl->dir, filename, NULL);
+      size_t mem = strlen (name);
 
 #ifdef DEBUG_INCL
-      xfprintf (stderr, "path_search (%s) -- trying %s\n", file, name);
+      xfprintf (stderr, "path_search (%s) -- trying %s\n", filename, name);
 #endif
 
-      fp = fopen (name, "r");
-      if (fp != NULL)
+      if (access (name, R_OK) == 0)
        {
          m4_debug_message (context, M4_DEBUG_TRACE_PATH,
                            _("path search for `%s' found `%s'"),
-                           file, name);
-         if (set_cloexec_flag (fileno (fp), true) != 0)
-           m4_error (context, 0, errno, NULL,
-                     _("cannot protect input file across forks"));
-
-         if (expanded_name != NULL)
-           *expanded_name = name;
-         else
-           free (name);
-         return fp;
+                           filename, name);
+         return name;
        }
       else if (!incl->len)
        /* Capture errno only when searching `.'.  */
        e = errno;
+
+      filepath = strncpy (xmalloc (mem + max_suffix_len +1), name, mem);
       free (name);
+
+      for (i = 0; suffixes && suffixes[i]; ++i)
+        {
+          strcpy (filepath + mem, suffixes[i]);
+          if (access (filepath, R_OK) == 0)
+            return filepath;
+        }
+      free (filepath);
     }
 
   errno = e;
   return NULL;
 }
 
+
+FILE *
+m4_fopen (m4 *context, const char *filepath)
+{
+  FILE *fp = NULL;
+
+  if (filepath)
+    {
+      fp  = fopen (filepath, "r");
+
+      if (fp != NULL)
+        {
+          if (set_cloexec_flag (fileno (fp), true) != 0)
+            m4_error (context, 0, errno, NULL,
+                      _("cannot protect input file across forks"));
+        }
+    }
+
+  return fp;
+}
+
+
+/* Generic load function.  Push the input file or load the module named
+   FILENAME, if it can be found in the search path.  Complain
+   about inaccesible files iff SILENT is false.  */
+bool
+m4_load_filename (m4 *context, const char *macro, const char *filename,
+                 m4_obstack *obs, bool silent)
+{
+  char *filepath = NULL;
+  char *suffix   = NULL;
+  bool new_input = false;
+
+  if (m4_get_posixly_correct_opt (context))
+    {
+      if (access (filename, R_OK) == 0)
+        filepath = xstrdup (filename);
+    }
+  else
+    filepath = m4_path_search (context, filename, FILE_SUFFIXES);
+
+  if (filepath)
+    suffix = strrchr (filepath, '.');
+
+  if (!m4_get_posixly_correct_opt (context)
+      && suffix
+      && (!strcmp (suffix, LT_MODULE_EXT) || !strcmp (suffix, ".la")))
+    {
+      m4_module_load (context, filepath, obs);
+    }
+  else
+    {
+      FILE *fp = NULL;
+
+      if (filepath)
+        fp = m4_fopen (context, filepath);
+
+      if (fp == NULL)
+        {
+          if (!silent)
+           m4_error (context, 0, errno, macro, _("cannot open file `%s'"),
+                     filename);
+          free (filepath);
+          return;
+        }
+
+      m4_push_file (context, fp, filepath, true);
+      new_input = true;
+    }
+  free (filepath);
+
+  return new_input;
+}
+
+
 void
 m4__include_init (m4 *context)
 {
diff --git a/modules/load.c b/modules/load.c
index e169796..d92f3de 100644
--- a/modules/load.c
+++ b/modules/load.c
@@ -35,7 +35,6 @@
 
           function     macros  blind   side    minargs maxargs */
 #define builtin_functions                                      \
-  BUILTIN (load,       false,  true,   false,  1,      1  )    \
   BUILTIN (m4modules,  false,  false,  false,  0,      0  )    \
   BUILTIN (refcount,   false,  true,   false,  1,      1  )    \
   BUILTIN (unload,     false,  true,   false,  1,      1  )    \
@@ -117,16 +116,6 @@ M4BUILTIN_HANDLER (refcount)
 }
 
 /**
- * load(MODULE-NAME)
- **/
-M4BUILTIN_HANDLER (load)
-{
-  /* Load the named module and install the builtins and macros
-     exported by that module.  */
-  m4_module_load (context, M4ARG(1), obs);
-}
-
-/**
  * unload(MODULE-NAME)
  **/
 M4BUILTIN_HANDLER (unload)
diff --git a/modules/m4.c b/modules/m4.c
index 5cb6d11..f1dbb6c 100644
--- a/modules/m4.c
+++ b/modules/m4.c
@@ -98,8 +98,6 @@ extern void m4_make_temp     (m4 *context, m4_obstack *obs, 
const char *macro,
 typedef intmax_t number;
 typedef uintmax_t unumber;
 
-static void    include         (m4 *context, int argc, m4_macro_args *argv,
-                                bool silent);
 static int     dumpdef_cmp_CB  (const void *s1, const void *s2);
 static void *  dump_symbol_CB  (m4_symbol_table *ignored, const char *name,
                                 m4_symbol *symbol, void *userdata);
@@ -573,7 +571,10 @@ M4BUILTIN_HANDLER (undivert)
          m4_numeric_arg (context, me, str, &diversion);
        else
          {
-           FILE *fp = m4_path_search (context, str, NULL);
+           char *filepath = m4_path_search (context, str, NULL);
+           FILE *fp = m4_fopen (context, filepath);
+
+           free (filepath);
            if (fp != NULL)
              {
                m4_insert_file (context, fp);
@@ -629,37 +630,16 @@ M4BUILTIN_HANDLER (changecom)
    and "sinclude".  This differs from bringing back diversions, in that
    the input is scanned before being copied to the output.  */
 
-/* Generic include function.  Include the file given by the first argument,
-   if it exists.  Complain about inaccesible files iff SILENT is false.  */
-static void
-include (m4 *context, int argc, m4_macro_args *argv, bool silent)
-{
-  FILE *fp;
-  char *name = NULL;
-
-  fp = m4_path_search (context, M4ARG (1), &name);
-  if (fp == NULL)
-    {
-      if (!silent)
-       m4_error (context, 0, errno, M4ARG (0), _("cannot open `%s'"),
-                 M4ARG (1));
-      return;
-    }
-
-  m4_push_file (context, fp, name, true);
-  free (name);
-}
-
 /* Include a file, complaining in case of errors.  */
 M4BUILTIN_HANDLER (include)
 {
-  include (context, argc, argv, false);
+  m4_load_filename (context, M4ARG (0), M4ARG (1), obs, false);
 }
 
 /* Include a file, ignoring errors.  */
 M4BUILTIN_HANDLER (sinclude)
 {
-  include (context, argc, argv, true);
+  m4_load_filename (context, M4ARG (0), M4ARG (1), obs, true);
 }
 
 
diff --git a/src/freeze.c b/src/freeze.c
index 8df64ce..29b3729 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -370,7 +370,8 @@ decode_char (FILE *in)
 void
 reload_frozen_state (m4 *context, const char *name)
 {
-  FILE *file;
+  FILE *file = NULL;
+  char *filepath;
   int version;
   int character;
   int operation;
@@ -450,7 +451,8 @@ reload_frozen_state (m4 *context, const char *name)
     }                                                          \
   while (character == '\n')
 
-  file = m4_path_search (context, name, (char **)NULL);
+  filepath = m4_path_search (context, name, NULL);
+  file = m4_fopen (context, filepath);
   if (file == NULL)
     m4_error (context, EXIT_FAILURE, errno, NULL, _("cannot open `%s'"), name);
 
diff --git a/src/main.c b/src/main.c
index 7c3b9cc..48add6b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -105,14 +105,6 @@ SPEC is any one of:\n\
   GREP, POSIX_AWK, POSIX_EGREP, MINIMAL, MINIMAL_BASIC, SED.\n\
 "), stdout);
       puts ("");
-      xprintf (_("\
-Dynamic loading features:\n\
-  -M, --module-directory=DIR   add DIR to module search path before\n\
-                               `%s'\n\
-  -m, --load-module=MODULE     load dynamic MODULE\n\
-      --unload-module=MODULE   unload dynamic MODULE\n\
-"), PKGLIBEXECDIR);
-      puts ("");
       fputs (_("\
 Preprocessor features:\n\
   -B, --prepend-include=DIR    add DIR to include path before `.'\n\
@@ -174,10 +166,9 @@ FLAGS is any of:\n\
       puts ("");
       fputs (_("\
 If defined, the environment variable `M4PATH' is a colon-separated list\n\
-of directories included after any specified by `-I', and the variable\n\
-`M4MODPATH' is a colon-separated list of directories searched before any\n\
-specified by `-M'.  The environment variable `POSIXLY_CORRECT' implies\n\
--G -Q; otherwise GNU extensions are enabled by default.\n\
+of directories included after any specified by `-I' or `-B'.  The\n\
+environment variable `POSIXLY_CORRECT' implies -G -Q; otherwise GNU\n\
+extensions are enabled by default.\n\
 "), stdout);
       puts ("");
       fputs (_("\
@@ -210,7 +201,6 @@ enum
   SAFER_OPTION,                                /* -S still has old no-op 
semantics */
   SYNCOUTPUT_OPTION,                   /* not quite -s, because of opt arg */
   TRACEOFF_OPTION,                     /* no short opt */
-  UNLOAD_MODULE_OPTION,                        /* no short opt */
   WORD_REGEXP_OPTION,                  /* deprecated, used to be -W */
 
   HELP_OPTION,                         /* no short opt */
@@ -231,8 +221,6 @@ static const struct option long_options[] =
   {"gnu", no_argument, NULL, 'g'},
   {"include", required_argument, NULL, 'I'},
   {"interactive", no_argument, NULL, 'i'},
-  {"load-module", required_argument, NULL, 'm'},
-  {"module-directory", required_argument, NULL, 'M'},
   {"nesting-limit", required_argument, NULL, 'L'},
   {"posix", no_argument, NULL, 'G'},
   {"prefix-builtins", no_argument, NULL, 'P'},
@@ -259,7 +247,6 @@ static const struct option long_options[] =
   {"safer", no_argument, NULL, SAFER_OPTION},
   {"syncoutput", optional_argument, NULL, SYNCOUTPUT_OPTION},
   {"traceoff", required_argument, NULL, TRACEOFF_OPTION},
-  {"unload-module", required_argument, NULL, UNLOAD_MODULE_OPTION},
   {"word-regexp", required_argument, NULL, WORD_REGEXP_OPTION},
 
   {"help", no_argument, NULL, HELP_OPTION},
@@ -273,7 +260,7 @@ static const struct option long_options[] =
    behavior also handles -s between files.  Starting OPTSTRING with
    '-' forces getopt_long to hand back file names as arguments to opt
    '\1', rather than reordering the command line.  */
-#define OPTSTRING "-B:D:EF:GH:I:L:M:N:PQR:S:T:U:Wbcd::egil:m:o:p:r::st:"
+#define OPTSTRING "-B:D:EF:GH:I:L:N:PQR:S:T:U:Wbcd::egil:o:p:r::st:"
 
 /* For determining whether to be interactive.  */
 enum interactive_choice
@@ -297,26 +284,21 @@ size_opt (char const *opt, int oi, int optchar)
   return size;
 }
 
-/* Process a command line file NAME, and return true only if it was
-   stdin.  */
-static void
+/* Process a command line file NAME.  */
+static bool
 process_file (m4 *context, const char *name)
 {
+  bool new_input = true;
+
   if (strcmp (name, "-") == 0)
     m4_push_file (context, stdin, "stdin", false);
   else
-    {
-      char *full_name;
-      FILE *fp = m4_path_search (context, name, &full_name);
-      if (fp == NULL)
-       {
-         m4_error (context, 0, errno, NULL, _("cannot open file `%s'"), name);
-         return;
-       }
-      m4_push_file (context, fp, full_name, true);
-      free (full_name);
-    }
-  m4_macro_expand_input (context);
+    new_input = m4_load_filename (context, NULL, name, NULL, false);
+
+  if (new_input)
+    m4_macro_expand_input (context);
+
+  return new_input;
 }
 
 
@@ -419,7 +401,6 @@ main (int argc, char *const *argv, char *const *envp)
          /* fall through */
        case 'D':
        case 'U':
-       case 'm':
        case 'p':
        case 'r':
        case 't':
@@ -427,7 +408,6 @@ main (int argc, char *const *argv, char *const *envp)
        case POPDEF_OPTION:
        case SYNCOUTPUT_OPTION:
        case TRACEOFF_OPTION:
-       case UNLOAD_MODULE_OPTION:
          /* Arguments that cannot be handled until later are accumulated.  */
 
          defn = (deferred *) xmalloc (sizeof *defn);
@@ -441,9 +421,6 @@ main (int argc, char *const *argv, char *const *envp)
            tail->next = defn;
          tail = defn;
 
-         if (optchar == '\1')
-           seen_file = true;
-
          break;
 
        case 'B':
@@ -490,21 +467,6 @@ main (int argc, char *const *argv, char *const *envp)
          m4_set_nesting_limit_opt (context, size);
          break;
 
-       case 'M':
-         if (lt_dlinsertsearchdir (lt_dlgetsearchpath (), optarg) != 0)
-           {
-             const char *dlerr = lt_dlerror ();
-             if (dlerr == NULL)
-               m4_error (context, EXIT_FAILURE, 0, NULL,
-                         _("failed to add search directory `%s'"),
-                         optarg);
-             else
-               m4_error (context, EXIT_FAILURE, 0, NULL,
-                         _("failed to add search directory `%s': %s"),
-                         optarg, dlerr);
-           }
-         break;
-
        case 'P':
          m4_set_prefix_builtins_opt (context, true);
          break;
@@ -602,24 +564,6 @@ main (int argc, char *const *argv, char *const *envp)
        }
     }
 
-  /* Interactive if specified, or if no input files and stdin and
-     stderr are terminals, to match sh behavior.  Interactive mode
-     means unbuffered output, and interrupts ignored.  */
-
-  m4_set_interactive_opt (context, (interactive == INTERACTIVE_YES
-                                   || (interactive == INTERACTIVE_UNKNOWN
-                                       && optind == argc && !seen_file
-                                       && isatty (STDIN_FILENO)
-                                       && isatty (STDERR_FILENO))));
-  if (m4_get_interactive_opt (context))
-    {
-      signal (SIGINT, SIG_IGN);
-      setbuf (stdout, NULL);
-    }
-  else
-    signal (SIGPIPE, SIG_DFL);
-
-
   /* Do the basic initializations.  */
   if (debugfile && !m4_debug_set_output (context, NULL, debugfile))
     m4_error (context, 0, errno, NULL, _("cannot set debug file `%s'"),
@@ -698,11 +642,6 @@ main (int argc, char *const *argv, char *const *envp)
          m4_symbol_delete (M4SYMTAB, arg);
          break;
 
-       case 'm':
-         /* FIXME - should loading a module result in output?  */
-         m4_module_load (context, arg, NULL);
-         break;
-
        case 'r':
          m4_set_regexp_syntax_opt (context, m4_regexp_syntax_encode (arg));
          if (m4_get_regexp_syntax_opt (context) < 0)
@@ -715,7 +654,8 @@ main (int argc, char *const *argv, char *const *envp)
          break;
 
        case '\1':
-         process_file (context, arg);
+         if (process_file (context, arg))
+           seen_file = true;
          break;
 
        case POPDEF_OPTION:
@@ -737,11 +677,6 @@ main (int argc, char *const *argv, char *const *envp)
          m4_set_symbol_name_traced (M4SYMTAB, arg, false);
          break;
 
-       case UNLOAD_MODULE_OPTION:
-         /* FIXME - should unloading a module result in output?  */
-         m4_module_unload (context, arg, NULL);
-         break;
-
        default:
          assert (!"INTERNAL ERROR: bad code in deferred arguments");
          abort ();
@@ -752,6 +687,25 @@ main (int argc, char *const *argv, char *const *envp)
       defn = next;
     }
 
+
+  /* Interactive if specified, or if no input files and stdin and
+     stderr are terminals, to match sh behavior.  Interactive mode
+     means unbuffered output, and interrupts ignored.  */
+
+  m4_set_interactive_opt (context, (interactive == INTERACTIVE_YES
+                                   || (interactive == INTERACTIVE_UNKNOWN
+                                       && optind == argc && !seen_file
+                                       && isatty (STDIN_FILENO)
+                                       && isatty (STDERR_FILENO))));
+  if (m4_get_interactive_opt (context))
+    {
+      signal (SIGINT, SIG_IGN);
+      setbuf (stdout, NULL);
+    }
+  else
+    signal (SIGPIPE, SIG_DFL);
+
+
   /* Handle remaining input files.  Each file is pushed on the input,
      and the input read.  */
 
diff --git a/tests/builtins.at b/tests/builtins.at
index 3f67c2c..00aa393 100644
--- a/tests/builtins.at
+++ b/tests/builtins.at
@@ -568,8 +568,8 @@ very late
 ]])
 
 AT_DATA([[experr]],
-[[m4:include.m4:2: include: cannot open `NOFILE': No such file or directory
-m4:include.m4:6: include: cannot open `NOFILE': No such file or directory
+[[m4:include.m4:2: include: cannot open file `NOFILE': No such file or 
directory
+m4:include.m4:6: include: cannot open file `NOFILE': No such file or directory
 ]])
 
 AT_CHECK_M4([include.m4], 1, expout, experr)
@@ -883,7 +883,7 @@ AT_DATA([[expout]],
 
 ]])
 
-AT_CHECK_M4([-m mpeval in], 0, expout)
+AT_CHECK_M4([mpeval in], 0, expout)
 
 AT_CLEANUP
 
diff --git a/tests/m4.in b/tests/m4.in
index 34b9604..3efcc73 100644
--- a/tests/m4.in
+++ b/tests/m4.in
@@ -33,8 +33,7 @@ else
   case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
 fi
 
-M4MODPATH="@abs_top_builddir@/modules${M4MODPATH+:$M4MODPATH}"
-export M4MODPATH
-
-exec "@abs_top_builddir@/src/m4" ${1+"$@"}
+exec "@abs_top_builddir@/src/m4" \
+      --include="@abs_top_builddir@/modules" \
+      ${1+"$@"}
 exit 1
diff --git a/tests/modules.at b/tests/modules.at
index 0d81848..a2a24e2 100644
--- a/tests/modules.at
+++ b/tests/modules.at
@@ -33,10 +33,10 @@ AT_DATA([[frozen.m4]],
 define(`test', `local::`test'')dnl
 define(`test1', defn(`test'))dnl
 ->test
-load(`modtest')
+include(`modtest')
 define(`test2', defn(`test'))dnl
 ->test
-load(`shadow')
+include(`shadow')
 define(`test3', defn(`test'))dnl
 ->test
 ]])
@@ -50,18 +50,18 @@ test3
 
 # First generate the `expout' ouput by running over the sources before
 # freezing.
-AT_CHECK_M4([-M "$abs_builddir" -m load frozen.m4 unfrozen.m4],
+AT_CHECK_M4([-I "$abs_builddir" load frozen.m4 unfrozen.m4],
            [0], [stdout], [stderr])
 
 mv stdout expout
 mv stderr experr
 
 # Now freeze the first source file.
-AT_CHECK_M4([-M "$abs_builddir" -m load -F frozen.m4f frozen.m4],
+AT_CHECK_M4([-I "$abs_builddir" load -F frozen.m4f frozen.m4],
            [0], [], [ignore])
 
 # Now rerun the original sequence, but using the frozen file.
-AT_CHECK_M4([-M "$abs_builddir" -R frozen.m4f unfrozen.m4],
+AT_CHECK_M4([-I "$abs_builddir" -R frozen.m4f unfrozen.m4],
            [0], [expout], [experr])
 
 AT_CLEANUP([frozen.m4f])
@@ -75,7 +75,7 @@ AT_SETUP([module test macros])
 AT_CHECK_DYNAMIC_MODULE
 AT_CHECK_GMP
 
-AT_DATA([in], [[load(`mpeval')
+AT_DATA([in], [[include(`mpeval')
 -__load__-__mpeval__-
 unload(`mpeval')
 -__load__-__mpeval__-
@@ -83,7 +83,7 @@ unload(`load')
 -__load__-__mpeval__-
 ]])
 
-AT_CHECK_M4([-m load in], [0], [[
+AT_CHECK_M4([load in], [0], [[
 ---
 
 --__mpeval__-
@@ -107,7 +107,7 @@ m4_define([AT_CHECK_M4_MODTEST],
 AT_CHECK_DYNAMIC_MODULE
 
 AT_DATA([input.m4],
-[[load(`modtest')
+[[include(`modtest')
 test
 Dumpdef: dumpdef(`test').
 unload(`modtest')
@@ -121,7 +121,7 @@ dnl carry over to the next AT_SETUP.
 m4_ifval([$2], [$2
 export m4_substr([$2], [0], m4_index([$2], [=]))])
 
-AT_CHECK_M4([-m load $3 input.m4], [0],
+AT_CHECK_M4([load $3 input.m4], [0],
 [[
 Test module called.
 Dumpdef: .
@@ -140,24 +140,17 @@ AT_CLEANUP
 
 
 
-AT_CHECK_M4_MODTEST([--module-directory: absolute path],
-                   [], [-M "$abs_builddir"])
+AT_CHECK_M4_MODTEST([--include: absolute path],
+                   [], [-I "$abs_builddir"])
 
-AT_CHECK_M4_MODTEST([--module-directory: relative path],
-                   [], [-M "$top_build_prefix/tests"])
+AT_CHECK_M4_MODTEST([--include: relative path],
+                   [], [-I "$top_build_prefix/tests"])
 
-AT_CHECK_M4_MODTEST([M4MODPATH: absolute path],
-                   [M4MODPATH="$abs_builddir"], [])
-
-AT_CHECK_M4_MODTEST([M4MODPATH: relative path],
-                   [M4MODPATH="$top_build_prefix/tests"], [])
-
-AT_CHECK_M4_MODTEST([LTDL_LIBRARY_PATH: absolute path],
-                   [LTDL_LIBRARY_PATH="$abs_builddir"], [])
-
-AT_CHECK_M4_MODTEST([LTDL_LIBRARY_PATH: relative path],
-                   [LTDL_LIBRARY_PATH="$top_build_prefix/tests"], [])
+AT_CHECK_M4_MODTEST([M4PATH: absolute path],
+                   [M4PATH="$abs_builddir"], [])
 
+AT_CHECK_M4_MODTEST([M4PATH: relative path],
+                   [M4PATH="$top_build_prefix/tests"], [])
 
 
 
@@ -180,7 +173,7 @@ test
 shadow
 
 # module Shadow defines `shadow' and `test' macros
-load(`shadow')
+include(`shadow')
 dumpdef(`test')
 dumpdef(`shadow')
 test
@@ -190,14 +183,14 @@ shadow
 define(`Shadow::test', defn(`test'))
 
 # module Modtest also defines a `test' macro
-load(`modtest')
+include(`modtest')
 dumpdef(`test')
 dumpdef(`shadow')
 test
 shadow
 
 # Reloading Shadow shouldn't affect anything
-load(`shadow')
+include(`shadow')
 dumpdef(`test')
 dumpdef(`shadow')
 test
@@ -295,7 +288,7 @@ test:       <test>
 shadow:        <shadow>
 ]])
 
-AT_CHECK_M4([-M "$abs_builddir" -m load input.m4], [0],
+AT_CHECK_M4([-I "$abs_builddir" load input.m4], [0],
            [expout], [experr])
 
 AT_CLEANUP
@@ -312,16 +305,16 @@ AT_CHECK_DYNAMIC_MODULE
 AT_DATA([[input.m4]],
 [[test
 __test__
-load(`modtest')
+include(`modtest')
 test
 __test__
-load(`shadow')
+include(`shadow')
 test
 __test__
 unload(`modtest')
 test
 __test__
-load(`modtest')
+include(`modtest')
 test
 __test__
 unload(`modtest')
@@ -363,7 +356,7 @@ Test module unloaded.
 ]])
 
 
-AT_CHECK_M4([-M "$abs_builddir" -m load input.m4],
+AT_CHECK_M4([-I "$abs_builddir" load input.m4],
            [0], [expout], [experr])
 
 AT_CLEANUP
@@ -386,7 +379,7 @@ AT_CHECK_DYNAMIC_MODULE
 
 AT_DATA([[input.m4]],
 [[import
-load(`import')
+include(`import')
 import
 unload(`modtest')
 import
@@ -415,7 +408,9 @@ m4:input.m4:6: cannot load symbol `no_such' from module 
`modtest'
 m4:input.m4:7: cannot open module `no_such'
 ]])
 
-AT_CHECK_M4([-M "$abs_builddir" -m load input.m4],
+ls "$abs_builddir"
+
+AT_CHECK_M4([-I "$abs_builddir" load input.m4],
            [1], [expout], [experr])
 
 AT_CLEANUP
@@ -443,7 +438,7 @@ manyargs(1)
 manyargs(1,2)
 ]])
 
-AT_CHECK_M4([-M "$abs_builddir" -m modtest input.m4], [0],
+AT_CHECK_M4([-I "$abs_builddir" modtest input.m4], [0],
 [[modtest
 modtest
 modtest
@@ -476,11 +471,11 @@ AT_CHECK_DYNAMIC_MODULE
 
 AT_DATA([[input.m4]],
 [[test
-load(`shadow')
+include(`shadow')
 test
 unload(`shadow')
 test
-load(`shadow')
+include(`shadow')
 test
 ]])
 
@@ -500,7 +495,7 @@ m4trace: -1- test -> `Shadow::`test' called.'
 ]])
 
 
-AT_CHECK_M4([-M "$abs_builddir" -m load -t test input.m4],
+AT_CHECK_M4([-I "$abs_builddir" load -t test input.m4],
            [0], [expout], [experr])
 
 AT_CLEANUP
@@ -523,10 +518,10 @@ define(`forloop',
 define(`_forloop',
   `$4`'ifelse($1, `$3', `',
     `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
-forloop(`i', `1', `5000', `unload(`gnu')load(`gnu')regexp(`123', `\(4\)?2')')
+forloop(`i', `1', `5000', `unload(`gnu')include(`gnu')regexp(`123', 
`\(4\)?2')')
 ]])
 
-AT_CHECK_M4([-m load input.m4], [0])
+AT_CHECK_M4([load input.m4], [0])
 
 AT_CLEANUP
 
@@ -549,7 +544,7 @@ __load__ 3
 ]])
 
 AT_DATA([in2.m4], [[__load__ 4
-load(`load') 5
+include(`load') 5
 __load__ 6
 unload(`load') 7
 __load__ 8
@@ -557,7 +552,7 @@ unload(`load') 9
 __load__ 10
 ]])
 
-AT_CHECK_M4([-m load in1.m4 -m load in2.m4], [0],
+AT_CHECK_M4([load in1.m4 load in2.m4], [0],
 [[ 1
  2
 __load__ 3
diff --git a/tests/options.at b/tests/options.at
index 19b8874..bfee70b 100644
--- a/tests/options.at
+++ b/tests/options.at
@@ -662,7 +662,7 @@ AT_CHECK_M4([-I post -B pre in], [1],
 [[in pre/foo
 in ./bar
 in post/blah
-]], [[m4:in:3: include: cannot open `bad': No such file or directory
+]], [[m4:in:3: include: cannot open file `bad': No such file or directory
 ]])
 
 AT_CLEANUP


hooks/post-receive
--
GNU M4 source repository




reply via email to

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