Subject: bug#31728: [PATCH] dmalloc: mark macro as obsolete

From: Mike Frysinger <[email-masked]>
Date: Tue, 18 Jan 2022 01:23:34 -0500

This macro doesn't really fit in with Automake's mission.  It's a simple
configure option to add a specific library when linking.  Maybe back in
1996 the dmalloc project was more canonical, but nowadays developers have
a wealth of options when it comes to memory debugging, both from ones
based in compile-time instrumentation (e.g. the various GNU sanitizers),
to ones that work at runtime only (e.g. valgrind and GNU C library's
various M_* env vars).  We can't really add value by trying to track all
of them, and dmalloc itself seems to have fallen significantly in use.

Lets mark it obsolete and start issuing warnings whenever anyone tries
to use it.  Considering we've had it in automake for 2 decades, we can
probably keep it around for a while still in warning mode to give users
ample time to migrate.

This was suggested in https://debbugs.gnu.org/31728.

* doc/automake.texi: Move AM_WITH_DMALLOC to Obsolete Macros chapter.
* m4/dmalloc.m4: Call m4_warn(obsolete) when used.
---
 doc/automake.texi | 21 ++++++++++++---------
 m4/dmalloc.m4     |  5 ++++-
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/doc/automake.texi b/doc/automake.texi
index 9916a41d4b79..ae7a49cba247 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -4170,15 +4170,6 @@ the @command{missing} script is appropriate.
 Control the machinery for less verbose build output
 (@pxref{Automake Silent Rules}).
 
-@item AM_WITH_DMALLOC
-@acindex AM_WITH_DMALLOC
-@cindex @command{dmalloc}, support for
-@vindex WITH_DMALLOC
-@opindex --with-dmalloc
-Add support for the @uref{https://dmalloc.com/, Dmalloc package}.  If
-the user runs @command{configure} with @option{--with-dmalloc}, then
-define @code{WITH_DMALLOC} and add @option{-ldmalloc} to @code{LIBS}.
-
 @end table

@@ -4218,6 +4209,18 @@ you are advised to switch ASAP to the more modern Autoconf-provided
 interface instead; both the macro and the variable might be removed
 in a future major Automake release.
 
+@item AM_WITH_DMALLOC
+@acindex AM_WITH_DMALLOC
+@cindex @command{dmalloc}, support for
+@vindex WITH_DMALLOC
+@opindex --with-dmalloc
+
+Add support for the @uref{https://dmalloc.com/, Dmalloc package}.  If
+the user runs @command{configure} with @option{--with-dmalloc}, then
+define @code{WITH_DMALLOC} and add @option{-ldmalloc} to @code{LIBS}.
+
+This macro is @emph{deprecated} and will be removed in a future release.
+
 @end table

diff --git a/m4/dmalloc.m4 b/m4/dmalloc.m4
index 66d943e4de4c..eecb7e4186f8 100644
--- a/m4/dmalloc.m4
+++ b/m4/dmalloc.m4
@@ -10,7 +10,10 @@
 # with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([AM_WITH_DMALLOC],
-[AC_MSG_CHECKING([if malloc debugging is wanted])
+[m4_warn([obsolete],
+['$0': this macro is obsolete.
+You should add your own configure and link tests instead.])dnl
+AC_MSG_CHECKING([if malloc debugging is wanted])
 AC_ARG_WITH([dmalloc],
 [AS_HELP_STRING([--with-dmalloc],
                 [use dmalloc, as in http://www.dmalloc.com])],
-- 
2.33.0