* 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.
* doc/m4.texinfo (Debugmode): Enhance tests.
* tests/generate.awk: Run tests from stdin, not input.m4. Support
stderr munging when using -I examples.
Signed-off-by: Eric Blake <ebb9@byu.net>
* tests/builtins.at (divert): Consume all of m4's output, to avoid
spurious write failure.
* src/main.c (main): In batch mode, restore default handling of
SIGPIPE.
* doc/m4.texinfo (Operation modes): Document SIGPIPE behavior.
* THANKS: Update.
Reported by Bob Proulx, via his autobuilder.
Signed-off-by: Eric Blake <ebb9@byu.net>
* configure.ac (AC_PREREQ): Rely on released autoconf.
(LT_PREREQ): Rely on released libtool.
* tests/testsuite.at (m4_version_prereq): Update dependence.
* bootstrap: Mention prerequisites.
Signed-off-by: Eric Blake <ebb9@byu.net>
* tests/null.m4: Use m4, not printf, to generate NUL byte.
* tests/null.out: Check for esyscmd failure.
Reported by Elbert Pol.
Signed-off-by: Eric Blake <ebb9@byu.net>
* m4/input.c (eof_funcs, input_eof): New objects.
(eof_peek, eof_read, eof_unget): New functions.
(file_clean, m4_push_string_init, pop_input, m4_push_wrapup_init)
(m4_pop_wrapup, next_char, peek_char, unget_input, m4_input_init)
(m4_input_exit): Use placeholder to guarantee non-NULL isp and
wsp.
(next_char): Rename retry to allow_unget, and change sense for
easier manipulation. All callers changed.
Signed-off-by: Eric Blake <ebb9@byu.net>
* modules/gnu.c (m4_macro_table): Ensure all possible identifiers
are defined, not just the first. The testsuite ensures that
exactly one gets defined.
* m4/system_.h [__EMX__]: OS/2 is not Unix-compatible, no matter
what other pre-defined macros it has.
* THANKS: Update.
Reported by Elbert Pol.
Signed-off-by: Eric Blake <ebb9@byu.net>
* configure.ac (version): New variable, which has nicer version
contents when using git 1.5.5+, hardcoded to 1.9a otherwise.
(TIMESTAMP): Delete, since CVS id expansion died with transition
to git.
(AM_INIT_AUTOMAKE): Use version to decide gnu vs. gnits.
* build-aux/mkstamp: Delete, no longer used.
* Makefile.am (CONFIG_STATUS_DEPENDENCIES): Kill, to speed up
rebuilds when timestamps don't matter.
(MKSTAMP): Delete, no longer used.
(EXTRA_DIST): No longer worry about mkstamp.
(.version): New rule and distributed file.
(doc/m4.1, tests/package.m4): Depend on .version, not
configure.ac, for timestamp.
* ltdl/m4/gnulib-cache.m4: Import git-version-gen module.
* modules/gnu.c (__m4_version__): TIMESTAMP no longer exists.
* src/main.c (main): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
* m4/m4module.h (m4_set_symbol_value_builtin): Delete. Use
m4_builtin_find_by_* instead.
(m4_builtin_find_by_func): Change return type.
* m4/m4private.h (m4__builtin): New struct.
(m4_module): Add sorted list of loaded builtins.
(struct m4_symbol_value): Change type of builtin value.
(m4__set_symbol_value_builtin): New prototype and fast accessor.
(m4_get_symbol_value_func, m4_get_symbol_value_builtin): Adjust to
new field type.
* m4/symtab.c (m4_set_symbol_value_builtin): Rename...
(m4__set_symbol_value_builtin): ...and populate additional fields,
based on new type.
(m4_get_symbol_value_func, m4_get_symbol_value_builtin): Adjust to
new field type.
* m4/module.c (install_builtin_table): Use cached table.
(compare_builtin_CB): New helper function.
(m4__module_open): Populate table.
(module_remove): Free table.
* m4/builtin.c (compare_builtin_name_CB): New helper function.
(m4_builtin_find_by_name): Rewrite to use sorted table.
(m4_builtin_find_by_func): Change return type.
* m4/input.c (struct m4_input_block): Simplify u_b, since most
fields can be determined from builtin.
(builtin_peek, builtin_read, builtin_unget, init_builtin_token)
(m4__next_token): Alter parsing so that only init_builtin_token
consumes a builtin.
(builtin_print, m4_push_builtin): Adjust all users.
* tests/macros.at (Arity, defn, and freeze): Fix typo.
Signed-off-by: Eric Blake <ebb9@byu.net>
* m4/macro.c (make_argv_ref): Don't output expansion text when
making wrapper for builtin or indir.
* tests/builtins.at (builtin): New test.
* NEWS: Document the fix.
Reported by Andreas Schwab.
Signed-off-by: Eric Blake <ebb9@byu.net>
* m4/macro.c (make_argv_ref): Avoid wrapping $@ when possible.
(m4_push_args): Let make_argv_ref take care of pending data.
* doc/m4.texinfo (Improved foreach): Tweak wording to match new
performance capability.
* tests/others.at (recursion): Add tests to avoid performance
regression.
Signed-off-by: Eric Blake <ebb9@byu.net>
* m4/input.c (m4__next_token): When DEBUG_INPUT is defined,
undo argument collection optimisation for strings, so that
m4_print_token doesn't abort when it otherwise receives an
unprintable M4_SYMBOL_VOID type token.
* doc/m4.texinfo (Foreach, Improved foreach): Document another
shortcoming in foreach.m4, and improve filter example by using
foreach2.m4.
Signed-off-by: Eric Blake <ebb9@byu.net>
* doc/m4.texinfo (Eval, Incompatibilities): Use @. after capital.
(History): Use @: after abbreviations.
(M4exit): Use correct Latin abbreviation.
(Dumpdef, Debugmode, Frozen file format 2): Use correct spacing
between sentences.
Signed-off-by: Eric Blake <ebb9@byu.net>