On Tue, Oct 12, 2021 at 06:29:55PM +1100, Daniel Axtens wrote: > I noticed that compiling with --enable-mm-debug didn't cause the > functions in #ifdef MM_DEBUG to be compiled in. Somehow the variable > wasn't actually being substituted into anything that was built. > > Change configure.ac to do AC_SUBST(), and put a substitution into > config.h.in. This makes MM_DEBUG available to any file which includes > config.h. > > Signed-off-by: Daniel Axtens <d...@axtens.net> > --- > config.h.in | 3 +++ > configure.ac | 6 ++++-- > 2 files changed, 7 insertions(+), 2 deletions(-) > > diff --git a/config.h.in b/config.h.in > index 9e8f9911b183..8cf62616cad7 100644 > --- a/config.h.in > +++ b/config.h.in > @@ -13,6 +13,9 @@ > #define DISK_CACHE_STATS @DISK_CACHE_STATS@ > #define BOOT_TIME_STATS @BOOT_TIME_STATS@ > > +/* Define to 1 to enable mm debugging */ > +#define MM_DEBUG @MM_DEBUG@ > + > /* We don't need those. */ > #define MINILZO_CFG_SKIP_LZO_PTR 1 > #define MINILZO_CFG_SKIP_LZO_UTIL 1 > diff --git a/configure.ac b/configure.ac > index 8d1c81a7316e..889d07b3c1d0 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -1511,9 +1511,11 @@ AC_ARG_ENABLE([mm-debug], > AS_HELP_STRING([--enable-mm-debug], > [include memory manager debugging])) > if test x$enable_mm_debug = xyes; then > - AC_DEFINE([MM_DEBUG], [1], > - [Define to 1 if you enable memory manager debugging.]) > + MM_DEBUG=1 > +else > + MM_DEBUG=0 > fi > +AC_SUBST([MM_DEBUG])
It seems to me this patch is incorrect. The MM_DEBUG constant is properly defined in config-util.h (config-util.h.in contains "#undef MM_DEBUG") which is included conditionally from config.h. The key word here is "conditionally". It means MM_DEBUG is defined when utils are build but it is not defined when the GRUB itself is build. Of course it does not make a lot of sense but it is what it is. I think this is due to how config-util.h and config.h are generated. The former is generated using AC_CONFIG_HEADER() and the latter is generated using AC_CONFIG_FILES(). I tried to move "#undef MM_DEBUG" to the config.h.in but it does not help for some reason. If you could investigate this further that would be perfect... Daniel _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel