%% "Michael T. Babcock" <mikebabcock@...> writes:
mtb> If anyone out there has an example of dmalloc being used with
mtb> their program via an autoconf configure.in macro, I'd love to see
mtb> it.
mtb> ./configure --with-dmalloc
mtb> Would set the proper environment variables and link against dmalloc.
I set this up in FVWM:
In configure.in near the beginning:
AC_ARG_ENABLE(dmalloc,
[ --enable-dmalloc Enable support for the dmalloc debugging library],
[ac_cv_dmalloc="$enableval"],
[ac_cv_dmalloc="no"])
Then near the end, right before AC_OUTPUT():
dnl Allow building with dmalloc. Do this last to avoid screwing up any
dnl other checks above.
case "$ac_cv_dmalloc" in
yes) AC_CHECK_HEADERS(dmalloc.h)
AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK" ;;
esac
Then in some global .h file:
/* Set up heap debugging library dmalloc. */
#ifdef HAVE_DMALLOC_H
# include <dmalloc.h>
#endif
Do it at the end of the .h file. You might also need to move this .h
file sometimes to be sure it comes after all system header files in your
source; see the dmalloc docs for this.
This is all I did, IIRC. It probably could use more sanity checking,
but...
Have fun!
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@...> Network Management Development
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
These are my opinions---Nortel Networks takes no responsibility for them.