diff --git a/Makefile b/Makefile
index f9e99d2f5ec402f1e886b904ea32523b4defcbc1..d934b653e50cdbcc06d7c96d78d026c1cf9a18f7 100644
--- a/Makefile
+++ b/Makefile
@@ -191,7 +191,7 @@ OTHER_SUBDIR_CFLAGS=-include ../include/autoconfig.h -I../include -I..
 
 #   *CLI> show memory allocations [filename]
 #   *CLI> show memory summary [filename]
-ifneq ($(findstring -DMALLOC_DEBUG,$(ASTCFLAGS)),)
+ifneq ($(findstring MALLOC_DEBUG,$(MENUSELECT_CFLAGS)),)
   TOPDIR_CFLAGS+=-include include/asterisk/astmm.h
   MOD_SUBDIR_CFLAGS+=-include ../include/asterisk/astmm.h
 endif
diff --git a/build_tools/make_buildopts_h b/build_tools/make_buildopts_h
index f4db2a6870a43b6edc974ab14f569001f5c108d0..cca17992504b0f20744261823392869866616a57 100755
--- a/build_tools/make_buildopts_h
+++ b/build_tools/make_buildopts_h
@@ -9,5 +9,5 @@ cat << END
 END
 TMP=`grep MENUSELECT_CFLAGS menuselect.makeopts | sed s/MENUSELECT_CFLAGS\=//g | sed s/-D//g`
 for x in ${TMP}; do
-     echo "#define ${x}"
+     echo "#define ${x} 1"
 done