modules: huge simplification of module loading without libltdl.
Libltdl is huge and slow, and carrying the weight of support for
decades old systems. We can do much better using POSIX dlopen
and dlsym directly, simplifying and speeding up as we do so.
* configure.ac (LT_CONFIG_LTDL_DIR, LTDL_INIT): Remove.
(M4_DEFAULT_PRELOAD): Set to ""; we lost preload support along
with removing libltdl.
* Makefile.am: Don't include ltdl/Makefile.inc.
(AM_CPPFLAGS): Manually add current directory to include search
paths.
* m4/m4private.h (includes): Remove ltdl.h.
(INIT_SYMBOL, m4__module_init): Remove.
(struct m4_module): Change handle type from lt_dlhandle to void *.
* m4/m4module.h (M4INIT_HANDLER): Remove.
* m4/module.c (includes): Add dlfcn.h.
(m4__module_interface, iface_id, m4__module_init, module_dlerror):
Remove.
(m4__module_open): Drastically simplified without all the
libltdl setup and interface id twiddling. Just call dlopen to
get a native handle, and the dlsym to get the init function.
(m4_module_import): Similarly wrt dlsym.
* m4/path.c (FILE_SUFFIXES): Replace .la and LT_MODULE_EXT with
hardcoded ".so".
(m4_load_filename): Likewise.
* modules/gnu.c: Remove libltdl preprocessor symbol renaming,
and use "include_<modulename>" as the single entry point function.
* modules/import.c, modules/m4.c, modules/modtest.c,
modules/mpeval.c, modules/shadow.c, modules/stdlib.c,
modules/time.c, modules/traditional.c: Likewise.
* main.c (main): Remove calls to m4__module_init and
LTDL_SET_PRELOADED_SYMBOLS.
* tests/m4.in: Make sure we always have the modules/.libs and
tests/.libs directories at the front of M4PATH so that the
tests will find the modules they need to include.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
17 files changed: