modules: huge simplification of module loading without libltdl.
commit64d44150bc5c9af45051371550f9917027e0fa41
authorGary V. Vaughan <gary@gnu.org>
Sat, 21 Sep 2013 16:11:09 +0000 (21 23:11 +0700)
committerGary V. Vaughan <gary@gnu.org>
Sat, 21 Sep 2013 16:11:09 +0000 (21 23:11 +0700)
treeb3d1f15311909b2ff0ac89341346b2297e3299db
parent7781a595d8236fe0cc6bd2f2fdd2d67c5707eb50
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:
Makefile.am
configure.ac
m4/m4module.h
m4/m4private.h
m4/module.c
m4/path.c
modules/gnu.c
modules/import.c
modules/m4.c
modules/modtest.c
modules/mpeval.c
modules/shadow.c
modules/stdlib.c
modules/time.c
modules/traditional.c
src/main.c
tests/m4.in