From: Peter Johnson Date: Tue, 22 Oct 2002 07:45:45 +0000 (-0000) Subject: Use automake's standard macro for dmalloc instead of rolling our own. X-Git-Tag: v0.2.0~77 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e54446905dd8b2a9d8575c28763d203f44248d22;p=yasm Use automake's standard macro for dmalloc instead of rolling our own. svn path=/trunk/yasm/; revision=777 --- diff --git a/configure.ac b/configure.ac index cc495586..aa1c1ab8 100644 --- a/configure.ac +++ b/configure.ac @@ -60,14 +60,6 @@ AC_ARG_ENABLE(gcov, *) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;; esac],[gcov=false]) -AC_ARG_ENABLE(dmalloc, -[ --enable-dmalloc Enable debug malloc (requires dmalloc library)], -[case "${enableval}" in - yes) dmalloc=true ;; - no) dmalloc=false ;; - *) AC_MSG_ERROR([bad value ${enableval} for --enable-dmalloc]) ;; -esac],[dmalloc=false]) - # # Checks for programs. # @@ -100,11 +92,7 @@ AC_EXEEXT # # Checks for libraries. # - -# dmalloc library (optional) -if ${dmalloc}; then - AC_CHECK_LIB(dmalloc, dmalloc_shutdown) -fi +AM_WITH_DMALLOC # # Checks for header files. @@ -113,11 +101,6 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([alloca.h limits.h sys/cdefs.h sys/ipc.h sys/msg.h sys/param.h sys/types.h sys/queue.h unistd.h]) -# dmalloc library (optional) -if ${dmalloc}; then - AC_CHECK_HEADERS([dmalloc.h]) -fi - # REQUIRE standard C headers if test "$ac_cv_header_stdc" != yes; then AC_MSG_ERROR([Standard (ANSI/ISO C89) header files are required.]) @@ -176,21 +159,6 @@ fi ARCH=x86 AC_SUBST([ARCH]) -# Require things for --enable-dmalloc option. -DMALLOCFLAGS= -if ${dmalloc}; then - if test "$ac_cv_header_dmalloc_h" != yes || - test "$ac_cv_lib_dmalloc_dmalloc_shutdown" != yes; then - AC_MSG_ERROR([dmalloc required for --enable-dmalloc.]) - else - AC_DEFINE([DMALLOC], 1, [Enable dmalloc library debugging.]) - fi -else - if ${morewarn}; then - DMALLOCFLAGS="-Wredundant-decls" - fi -fi - # Require things for --enable-dev option. if ${dev}; then # Require Perl @@ -265,7 +233,7 @@ fi # If we're using GCC, then we can enable the above CFLAGS as well as turn on # -ansi -pedantic -Wall. if test "$GCC" = yes; then - ANSI_CFLAGS="-ansi -pedantic -Wall $MOREWARNFLAGS $WARNERRORFLAGS $DEVFLAGS $PROFILINGFLAGS $GCOVFLAGS $DMALLOCFLAGS" + ANSI_CFLAGS="-ansi -pedantic -Wall $MOREWARNFLAGS $WARNERRORFLAGS $DEVFLAGS $PROFILINGFLAGS $GCOVFLAGS" else ANSI_CFLAGS="" fi diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c index ca4453dc..27c5327b 100644 --- a/frontends/yasm/yasm.c +++ b/frontends/yasm/yasm.c @@ -136,7 +136,7 @@ main(int argc, char *argv[]) textdomain(PACKAGE); /* Set libltdl malloc/free functions. */ -#ifdef DMALLOC +#ifdef WITH_DMALLOC lt_dlmalloc = malloc; lt_dlfree = free; #else diff --git a/libyasm/util.h b/libyasm/util.h index 02349777..dd4ab6ad 100644 --- a/libyasm/util.h +++ b/libyasm/util.h @@ -117,9 +117,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n); # endif #endif -#ifdef DMALLOC -# include -#else /* strdup() implementation with error checking (using xmalloc). */ /*@only@*/ char *xstrdup(const char *str); @@ -129,6 +126,9 @@ int strncasecmp(const char *s1, const char *s2, size_t n); /*@only@*/ void *xrealloc(/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size) /*@modifies oldmem@*/; void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/; + +#ifdef WITH_DMALLOC +# include #endif /*@only@*/ char *xstrndup(const char *str, size_t len); diff --git a/libyasm/xmalloc.c b/libyasm/xmalloc.c index da38bd92..c1a38d45 100644 --- a/libyasm/xmalloc.c +++ b/libyasm/xmalloc.c @@ -25,7 +25,7 @@ RCSID("$IdPath$"); #include "errwarn.h" -#ifndef DMALLOC +#ifndef WITH_DMALLOC void * xmalloc(size_t size) diff --git a/libyasm/xstrdup.c b/libyasm/xstrdup.c index 42685ea1..1fd2a051 100644 --- a/libyasm/xstrdup.c +++ b/libyasm/xstrdup.c @@ -47,7 +47,7 @@ void memcpy(void *, const void *, size_t); # endif #endif -#ifndef DMALLOC +#ifndef WITH_DMALLOC char * xstrdup(const char *str) diff --git a/src/main.c b/src/main.c index ca4453dc..27c5327b 100644 --- a/src/main.c +++ b/src/main.c @@ -136,7 +136,7 @@ main(int argc, char *argv[]) textdomain(PACKAGE); /* Set libltdl malloc/free functions. */ -#ifdef DMALLOC +#ifdef WITH_DMALLOC lt_dlmalloc = malloc; lt_dlfree = free; #else diff --git a/src/util.h b/src/util.h index 02349777..dd4ab6ad 100644 --- a/src/util.h +++ b/src/util.h @@ -117,9 +117,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n); # endif #endif -#ifdef DMALLOC -# include -#else /* strdup() implementation with error checking (using xmalloc). */ /*@only@*/ char *xstrdup(const char *str); @@ -129,6 +126,9 @@ int strncasecmp(const char *s1, const char *s2, size_t n); /*@only@*/ void *xrealloc(/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size) /*@modifies oldmem@*/; void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/; + +#ifdef WITH_DMALLOC +# include #endif /*@only@*/ char *xstrndup(const char *str, size_t len); diff --git a/src/xmalloc.c b/src/xmalloc.c index da38bd92..c1a38d45 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -25,7 +25,7 @@ RCSID("$IdPath$"); #include "errwarn.h" -#ifndef DMALLOC +#ifndef WITH_DMALLOC void * xmalloc(size_t size) diff --git a/src/xstrdup.c b/src/xstrdup.c index 42685ea1..1fd2a051 100644 --- a/src/xstrdup.c +++ b/src/xstrdup.c @@ -47,7 +47,7 @@ void memcpy(void *, const void *, size_t); # endif #endif -#ifndef DMALLOC +#ifndef WITH_DMALLOC char * xstrdup(const char *str) diff --git a/util.h b/util.h index 02349777..dd4ab6ad 100644 --- a/util.h +++ b/util.h @@ -117,9 +117,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n); # endif #endif -#ifdef DMALLOC -# include -#else /* strdup() implementation with error checking (using xmalloc). */ /*@only@*/ char *xstrdup(const char *str); @@ -129,6 +126,9 @@ int strncasecmp(const char *s1, const char *s2, size_t n); /*@only@*/ void *xrealloc(/*@only@*/ /*@out@*/ /*@returned@*/ /*@null@*/ void *oldmem, size_t size) /*@modifies oldmem@*/; void xfree(/*@only@*/ /*@out@*/ /*@null@*/ void *p) /*@modifies p@*/; + +#ifdef WITH_DMALLOC +# include #endif /*@only@*/ char *xstrndup(const char *str, size_t len);