./configure --disable-shared
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
This allows the testsuite to skip tests when --disable-shared makes it impossible for m4 to find modules that were not preloaded. This brings the testsuite results to the same 1 failure that --enable-shared is currently seeing. It also preloads all modules when --enable-debug, to ease static debugging. The testsuite still fails miserably when --enable-debug, because tests/m4 is not filtering out all the junk that is being added to stderr, so maybe I will improve that in a later patch. 2006-09-05 Eric Blake <[email protected]> * m4/input.c (lex_debug): Remove dead code that broke compilation with --enable-debug. * m4/module.c (install_builtin_table, install_macro_table) (m4__module_init, m4__module_open, module_close) (module_remove): Fix compilation when --enable-debug. * m4/output.c (m4_shipout_text): Likewise. * ltdl/m4/debug.m4 (M4_CHECK_DEBUGGING): Preload all static libraries when --enable-debug. * configure.ac (DYNAMIC_MODULES): New variable, to pass information to testsuite. (modules to preload): Determine modules after we know whether shared libraries are supported. * tests/atlocal.in (DYNAMIC_MODULES): Substitute this into testsuite. * tests/testsuite.at (AT_CHECK_DYNAMIC_MODULE): New macro. * tests/modules.at (Freezing modules, AT_CHECK_M4_MODTEST) (modules: shadow, modules: unload, modules: importing) (modules: trace): Use new macro. * tests/builtins.at (gmp): Likewise. Index: configure.ac =================================================================== RCS file: /sources/m4/m4/configure.ac,v retrieving revision 1.54 diff -u -r1.54 configure.ac --- configure.ac 22 Aug 2006 16:16:47 -0000 1.54 +++ configure.ac 5 Sep 2006 16:50:57 -0000 @@ -20,7 +20,7 @@ AC_PREREQ([2.60]) ## ------------------------ ## -## Autoconf initialisation. ## +## Autoconf initialization. ## ## ------------------------ ## AC_INIT([GNU M4], [1.9a], [[email protected]]) @@ -59,39 +59,14 @@ dnl the m4_ namespace provided by m4sugar, so we prefer M4_ as our dnl package-specific prefix. FIXME - consistently use M4_ in the m4 macros dnl that feed the creation of configure. -m4_pattern_forbid([^M4_]) -m4_pattern_allow([^M4_cv_]) +m4_pattern_forbid([^M4_[A-Z]]) AC_DEFUN([M4_DEFAULT_PRELOAD], [m4 traditional gnu]) -AC_MSG_CHECKING([for modules to preload]) - DLPREOPEN= - - AC_ARG_WITH([modules], - [AS_HELP_STRING([--with-modules=MODULES], - [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])], - [use_modules="$withval"], - [use_modules="M4_DEFAULT_PRELOAD"]) - - PREOPEN_DEPENDENCIES= - DLPREOPEN="-dlpreopen force" - if test -z "$use_modules"; then - use_modules=none - else - if test "$use_modules" != yes; then - for module in $use_modules; do - DLPREOPEN="$DLPREOPEN -dlpreopen modules/$module.la" - PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES modules/$module.la" - done - fi - fi -AC_MSG_RESULT([$use_modules]) -AC_SUBST([DLPREOPEN]) -AC_SUBST([PREOPEN_DEPENDENCIES]) - +M4_default_preload="M4_DEFAULT_PRELOAD" ## ------------------------ ## -## Automake Initialisation. ## +## Automake Initialization. ## ## ------------------------ ## AM_INIT_AUTOMAKE([1.9b subdir-objects dist-bzip2 gnits]) @@ -110,7 +85,7 @@ ## ----------------------- ## -## Libtool initialisation. ## +## Libtool initialization. ## ## ----------------------- ## LT_PREREQ([2.0]) LT_CONFIG_LTDL_DIR([ltdl]) @@ -127,6 +102,37 @@ ;; esac +## ------------------------------- ## +## Preloaded module configuration. ## +## ------------------------------- ## +AS_IF([test "x$enable_shared" != xno], + [DYNAMIC_MODULES=yes], [DYNAMIC_MODULES=no]) +AC_SUBST([DYNAMIC_MODULES], [$DYNAMIC_MODULES]) + +AC_MSG_CHECKING([for modules to preload]) + DLPREOPEN= + + AC_ARG_WITH([modules], + [AS_HELP_STRING([--with-modules=MODULES], + [preload MODULES @<:@default: ]M4_DEFAULT_PRELOAD[@:>@])], + [use_modules="$withval"], + [use_modules="$M4_default_preload"]) + + PREOPEN_DEPENDENCIES= + DLPREOPEN="-dlpreopen force" + if test -z "$use_modules"; then + use_modules=none + else + if test "$use_modules" != yes; then + for module in $use_modules; do + DLPREOPEN="$DLPREOPEN -dlpreopen modules/$module.la" + PREOPEN_DEPENDENCIES="$PREOPEN_DEPENDENCIES modules/$module.la" + done + fi + fi +AC_MSG_RESULT([$use_modules]) +AC_SUBST([DLPREOPEN]) +AC_SUBST([PREOPEN_DEPENDENCIES]) ## ---------------- ## Index: ltdl/m4/debug.m4 =================================================================== RCS file: /sources/m4/m4/ltdl/m4/debug.m4,v retrieving revision 1.3 diff -u -r1.3 debug.m4 --- ltdl/m4/debug.m4 16 Jun 2006 03:51:29 -0000 1.3 +++ ltdl/m4/debug.m4 5 Sep 2006 16:50:57 -0000 @@ -28,7 +28,7 @@ AC_DEFUN([M4_CHECK_DEBUGGING], [AC_REQUIRE([AC_PROG_CC]) AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], - [build for debugging [default=no]])]) + [build for debugging [default=no]])]) AC_MSG_CHECKING([for compilation debug mode]) AC_MSG_RESULT([${enable_debug-no}]) @@ -43,48 +43,50 @@ AC_DISABLE_SHARED AC_DEFINE([DEBUG], [1], [Define this to enable additional runtime debugging]) + M4_default_preload="m4 traditional gnu load \ +import modtest mpeval shadow stdlib time" if test "$GCC" = yes; then case "$CFLAGS" in *-O* ) CFLAGS=`echo $CFLAGS | $SED 's/-O[[^ ]]* / /;s/-O[[^ ]]*$//'` ;; esac case "$CFLAGS" in - *-g* ) ;; - * ) AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -ggdb3], - [M4_cv_prog_compiler_ggdb3], - [-ggdb3 -c conftest.$ac_ext], [], - [CFLAGS="$CFLAGS -ggdb3"], - [CFLAGS="$CFLAGS -g"]) - ;; + *-g* ) ;; + * ) AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -ggdb3], + [M4_cv_prog_compiler_ggdb3], + [-ggdb3 -c conftest.$ac_ext], [], + [CFLAGS="$CFLAGS -ggdb3"], + [CFLAGS="$CFLAGS -g"]) + ;; esac CFLAGS="$CFLAGS -Wall" WMORE="-Wshadow -Wpointer-arith -Wcast-align -Wnested-externs" WMORE="$WMORE -Wmissing-prototypes -Wmissing-declarations -Winline" AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts $WMORE], - [M4_cv_prog_compiler_warning_flags], - [$WMORE -c conftest.$ac_ext], [], - [CFLAGS="$CFLAGS $WMORE"]) + [M4_cv_prog_compiler_warning_flags], + [$WMORE -c conftest.$ac_ext], [], + [CFLAGS="$CFLAGS $WMORE"]) AC_LIBTOOL_COMPILER_OPTION([if $compiler accepts -Wno-long-long], - [M4_cv_prog_compiler_wnolonglong], - [-Wno-long-long -c conftest.$ac_ext], [], - [CFLAGS="$CFLAGS -Wno-long-long"]) + [M4_cv_prog_compiler_wnolonglong], + [-Wno-long-long -c conftest.$ac_ext], [], + [CFLAGS="$CFLAGS -Wno-long-long"]) else case "$CFLAGS" in - *-g* ) ;; - * ) CFLAGS="$CFLAGS -g" ;; + *-g* ) ;; + * ) CFLAGS="$CFLAGS -g" ;; esac fi else AC_ENABLE_SHARED case "$CFLAGS" in *-g* ) CFLAGS=`echo "$CFLAGS" |\ - $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'` - ;; + $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'` + ;; esac case "$CXXFLAGS" in *-g* ) CXXFLAGS=`echo "$CXXFLAGS" |\ - $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'` - ;; + $SED -e 's/ -g / /g;s/ -g$//;s/^-g //g;s/^-g$//'` + ;; esac fi ])# M4_CHECK_DEBUGGING Index: m4/input.c =================================================================== RCS file: /sources/m4/m4/m4/input.c,v retrieving revision 1.44 diff -u -r1.44 input.c --- m4/input.c 23 Aug 2006 11:39:26 -0000 1.44 +++ m4/input.c 5 Sep 2006 16:50:57 -0000 @@ -955,8 +955,6 @@ #ifdef DEBUG_INPUT -static void lex_debug (void); - int m4_print_token (const char *s, m4__token_type type, m4_symbol_value *token) { @@ -993,14 +991,4 @@ } return 0; } - -static void -lex_debug (void) -{ - m4__token_type type; - m4_symbol_value token; - - while ((type = next_token (&token)) != NULL) - m4_print_token ("lex", type, &token); -} #endif Index: m4/module.c =================================================================== RCS file: /sources/m4/m4/m4/module.c,v retrieving revision 1.43 diff -u -r1.43 module.c --- m4/module.c 5 Sep 2006 13:25:24 -0000 1.43 +++ m4/module.c 5 Sep 2006 16:50:57 -0000 @@ -45,7 +45,7 @@ * * 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 initialised from the environment variable M4MODPATH, followed + * 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 @@ -176,7 +176,7 @@ } #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: builtins loaded", + M4_DEBUG_MESSAGE1(context, "module %s: builtins loaded", m4_get_module_name (handle)); #endif /* DEBUG_MODULES */ } @@ -207,7 +207,7 @@ } #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: macros loaded", + M4_DEBUG_MESSAGE1(context, "module %s: macros loaded", m4_get_module_name (handle)); #endif /* DEBUG_MODULES */ } @@ -309,8 +309,8 @@ } -/* Initialisation. Currently the module search path in path.c is - initialised from M4MODPATH. Only absolute path names are accepted to +/* Initialization. Currently the module search path in path.c is + initialized from M4MODPATH. Only absolute path names are accepted to prevent the path search of the dlopen library from finding wrong files. */ void @@ -319,7 +319,7 @@ int errors = 0; /* Do this only once! If we already have an iface_id, then the - module system has already been initialised. */ + module system has already been initialized. */ if (iface_id) { m4_error (context, 0, 0, _("multiple module loader initializations")); @@ -360,14 +360,14 @@ errors = lt_dlinsertsearchdir (lt_dlgetsearchpath (), path); } - /* Couldn't initialise the module system; diagnose and exit. */ + /* Couldn't initialize the module system; diagnose and exit. */ if (errors) m4_error (context, EXIT_FAILURE, 0, _("failed to initialize module loader: %s"), module_dlerror ()); #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE ("Module loader initialised."); + M4_DEBUG_MESSAGE (context, "Module loader initialized."); #endif /* DEBUG_MODULES */ } @@ -392,11 +392,11 @@ /* If we have a handle, there must be handle info. */ assert (info); - M4_DEBUG_MESSAGE2("module %s: opening at %s", + M4_DEBUG_MESSAGE2(context, "module %s: opening at %s", name ? name : MODULE_SELF_NAME, info->filename); #endif - /* Find and run any initialising function in the opened module, + /* Find and run any initializing function in the opened module, each time the module is opened. */ init_func = (m4_module_init_func *) lt_dlsym (handle, INIT_SYMBOL); if (init_func) @@ -404,7 +404,7 @@ (*init_func) (context, handle, obs); #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: init hook called", name); + M4_DEBUG_MESSAGE1(context, "module %s: init hook called", name); #endif /* DEBUG_MODULES */ } @@ -418,7 +418,7 @@ } #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: opened", name); + M4_DEBUG_MESSAGE1(context, "module %s: opened", name); #endif /* DEBUG_MODULES */ } else @@ -498,7 +498,7 @@ (*finish_func) (context, handle, obs); #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: finish hook called", name); + M4_DEBUG_MESSAGE1(context, "module %s: finish hook called", name); #endif /* DEBUG_MODULES */ } @@ -508,13 +508,13 @@ if (!errors) { #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: closed", name); + M4_DEBUG_MESSAGE1(context, "module %s: closed", name); #endif /* DEBUG_MODULES */ } } #ifdef DEBUG_MODULES else - M4_DEBUG_MESSAGE1("module %s: resident module not closed", name); + M4_DEBUG_MESSAGE1(context, "module %s: resident module not closed", name); #endif /* DEBUG_MODULES */ if (errors) @@ -552,7 +552,7 @@ #ifdef DEBUG_MODULES if (info->ref_count > 1) { - M4_DEBUG_MESSAGE2("module %s: now has %d references.", + M4_DEBUG_MESSAGE2(context, "module %s: now has %d references.", name, info->ref_count -1); } #endif /* DEBUG_MODULES */ @@ -566,7 +566,7 @@ m4__symtab_remove_module_references (M4SYMTAB, handle); #ifdef DEBUG_MODULES - M4_DEBUG_MESSAGE1("module %s: symbols unloaded", name); + M4_DEBUG_MESSAGE1(context, "module %s: symbols unloaded", name); #endif /* DEBUG_MODULES */ } Index: m4/output.c =================================================================== RCS file: /sources/m4/m4/m4/output.c,v retrieving revision 1.27 diff -u -r1.27 output.c --- m4/output.c 22 Aug 2006 22:36:28 -0000 1.27 +++ m4/output.c 5 Sep 2006 16:50:57 -0000 @@ -366,7 +366,7 @@ #ifdef DEBUG_OUTPUT printf ("DEBUG: cur %d, cur out %d\n", - current_line, output_current_line); + m4_get_current_line (context), m4_output_current_line); #endif /* Output a `#line NUM' synchronisation directive if needed. Index: tests/atlocal.in =================================================================== RCS file: /sources/m4/m4/tests/atlocal.in,v retrieving revision 1.5 diff -u -r1.5 atlocal.in --- tests/atlocal.in 22 Aug 2006 16:16:48 -0000 1.5 +++ tests/atlocal.in 5 Sep 2006 16:50:57 -0000 @@ -5,3 +5,4 @@ # Some tests cannot be performed with all the configurations. USE_GMP=@USE_GMP@ +DYNAMIC_MODULES=@DYNAMIC_MODULES@ Index: tests/builtins.at =================================================================== RCS file: /sources/m4/m4/tests/builtins.at,v retrieving revision 1.17 diff -u -r1.17 builtins.at --- tests/builtins.at 1 Sep 2006 23:11:05 -0000 1.17 +++ tests/builtins.at 5 Sep 2006 16:50:57 -0000 @@ -176,7 +176,7 @@ ## --- ## AT_SETUP([gmp]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE # cannot perform test without --with-gmp AT_CHECK([test "$USE_GMP" = yes || exit 77]) Index: tests/modules.at =================================================================== RCS file: /sources/m4/m4/tests/modules.at,v retrieving revision 1.19 diff -u -r1.19 modules.at --- tests/modules.at 1 Sep 2006 23:11:05 -0000 1.19 +++ tests/modules.at 5 Sep 2006 16:50:57 -0000 @@ -26,7 +26,7 @@ AT_SETUP([Freezing modules]) AT_KEYWORDS([frozen]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE AT_DATA([[frozen.m4]], [[divert(1)dnl @@ -77,7 +77,7 @@ # Skip if modtest is not present (we are not in the package). m4_define([AT_CHECK_M4_MODTEST], [AT_SETUP([$1]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE AT_CHECK([test -f "$abs_top_builddir/modules/modtest.la" || exit 77]) @@ -135,7 +135,7 @@ ## ------ ## AT_SETUP([modules: shadow]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE AT_DATA([[input.m4]], [[# no modules loaded yet @@ -276,7 +276,7 @@ ## ------ ## AT_SETUP([modules: unload]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE AT_DATA([[input.m4]], [[test @@ -350,7 +350,7 @@ # from the first command: AT_SETUP([modules: importing]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE AT_DATA([[input.m4]], [[import @@ -409,7 +409,7 @@ # memory and then redefined by a subsequent load. AT_SETUP([modules: trace]) -AT_KEYWORDS([module]) +AT_CHECK_DYNAMIC_MODULE AT_DATA([[input.m4]], [[test Index: tests/testsuite.at =================================================================== RCS file: /sources/m4/m4/tests/testsuite.at,v retrieving revision 1.20 diff -u -r1.20 testsuite.at --- tests/testsuite.at 25 Aug 2006 19:23:02 -0000 1.20 +++ tests/testsuite.at 5 Sep 2006 16:50:57 -0000 @@ -45,6 +45,17 @@ # We exercise m4. AT_TESTED([m4]) +# AT_CHECK_DYNAMIC_MODULE +# ----------------------- +# Add keyword `module' to the test, and skip the test if dynamic +# modules were disabled at configure time. +m4_define([AT_CHECK_DYNAMIC_MODULE], +[AT_KEYWORDS([module]) +AT_CHECK([if test "x$DYNAMIC_MODULES" = xno ; then + echo Dynamic module support not detected, skipping this test. + exit 77 +fi])]) + ## ----------- ## ## The suite. ## ## ----------- ##