]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
build: Fix option to explicitly disable memory debugging
authorPatrick Steinhardt <ps@pks.im>
Sat, 7 Mar 2020 16:29:08 +0000 (17:29 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 10 Mar 2020 20:56:39 +0000 (21:56 +0100)
The memory management system supports a debug mode that can be enabled
at build time by passing "--enable-mm-debug" to the configure script.
Passing the option will cause us define MM_DEBUG as expected, but in
fact the reverse option "--disable-mm-debug" will do the exact same
thing and also set up the define. This currently causes the build of
"lib/gnulib/base64.c" to fail as it tries to use `grub_debug_malloc()`
and `grub_debug_free()` even though both symbols aren't defined.

Seemingly, `AC_ARG_ENABLE()` will always execute the third argument if
either the positive or negative option was passed. Let's thus fix the
issue by moving the call to`AC_DEFINE()` into an explicit `if test
$xenable_mm_debug` block, similar to how other defines work.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
configure.ac

index 4766f41903a7d001e75ad9b71cdff2646e455cdd..88c0adbae9719164b2643a46fd07d463e8e0e4b4 100644 (file)
@@ -1453,9 +1453,11 @@ LIBS="$tmp_LIBS"
 # Memory manager debugging.
 AC_ARG_ENABLE([mm-debug],
              AS_HELP_STRING([--enable-mm-debug],
-                             [include memory manager debugging]),
-              [AC_DEFINE([MM_DEBUG], [1],
-                         [Define to 1 if you enable memory manager debugging.])])
+                             [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.])
+fi
 
 AC_ARG_ENABLE([cache-stats],
              AS_HELP_STRING([--enable-cache-stats],