From 9114cb2e988dabdf4c8561f62eb448aa24117574 Mon Sep 17 00:00:00 2001 From: "Gary V. Vaughan" Date: Fri, 20 Sep 2013 09:52:03 +0700 Subject: refactor: remove dead M4MODPATH code. * m4/m4private.h (USER_MODULE_PATH_ENV): Remove. * m4/module.c: Correct doc-comment header details. (m4__module_init): Remove PKGLIBEXECDIR and M4MODPATH handling. Move configmake.h include from here... * m4/path.c: ...to here. (m4__include_init): Append PKGLIBDIR to search path. Signed-off-by: Gary V. Vaughan --- m4/m4private.h | 1 - m4/module.c | 33 +++++++++------------------------ m4/path.c | 4 ++++ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/m4/m4private.h b/m4/m4private.h index 7dc207ac..bffc57b5 100644 --- a/m4/m4private.h +++ b/m4/m4private.h @@ -173,7 +173,6 @@ extern void m4__builtin_print (m4_obstack *, const m4__builtin *, bool, /* --- MODULE MANAGEMENT --- */ -#define USER_MODULE_PATH_ENV "M4MODPATH" #define BUILTIN_SYMBOL "m4_builtin_table" #define MACRO_SYMBOL "m4_macro_table" #define INIT_SYMBOL "m4_init_module" diff --git a/m4/module.c b/m4/module.c index 6256bcab..ec2913ad 100644 --- a/m4/module.c +++ b/m4/module.c @@ -20,7 +20,6 @@ #include -#include "configmake.h" #include "m4private.h" #include "xvasprintf.h" @@ -45,16 +44,15 @@ * The table is saved as libltdl caller data and each definition therein * is added to the symbol table. * - * To load a module, call m4_module_load(), which uses the libltdl - * API to find the module in the module search path. The search - * path is initialized from the environment variable M4MODPATH, followed - * by the configuration time default where the modules shipped with M4 - * itself are installed. Libltdl reads the libtool .la file to - * get the real library name (which can be system dependent), returning - * NULL on failure or else a libtool module handle for the newly mapped - * vm segment containing the module code. If the module is not already - * loaded, m4_module_load() retrieves its value for the symbol - * `m4_builtin_table', which is installed using set_module_builtin_table(). + * To load a module, call m4_module_load(), which searches for the + * module in directories from M4PATH. The search path is initialized + * from the environment variable M4PATH, followed by the configuration + * time default where the modules shipped with M4 itself are installed. + * `m4_module_load' returns NULL on failure, or else an opaque module + * handle for the newly mapped vm segment containing the module code. + * If the module is not already loaded, m4_module_load() retrieves its + * value for the symbol `m4_builtin_table', which is installed using + * set_module_builtin_table(). * * In addition to builtin functions, you can also define static macro * expansions in the `m4_macro_table' symbol. If you define this symbol @@ -346,19 +344,6 @@ m4__module_init (m4 *context) } } - if (!errors) - errors = lt_dlsetsearchpath (PKGLIBEXECDIR); - - /* If the user set M4MODPATH, then use that as the start of the module - search path. */ - if (!errors) - { - char *path = getenv (USER_MODULE_PATH_ENV); - - if (path) - errors = lt_dlinsertsearchdir (lt_dlgetsearchpath (), path); - } - /* Couldn't initialize the module system; diagnose and exit. */ if (errors) m4_error (context, EXIT_FAILURE, 0, NULL, diff --git a/m4/path.c b/m4/path.c index 37115d03..c69cdbac 100644 --- a/m4/path.c +++ b/m4/path.c @@ -30,6 +30,7 @@ #include "m4private.h" +#include "configmake.h" #include "dirname.h" #include "filenamecat.h" @@ -338,6 +339,9 @@ m4__include_init (m4 *context) assert (info); if (info->list_end == NULL) search_path_add (info, "", false); + + /* Non-core modules installation directory. */ + search_path_add (info, PKGLIBDIR, false); } #ifdef DEBUG_INCL -- cgit v1.2.1