]> granicus.if.org Git - yasm/commitdiff
Use automake's standard macro for dmalloc instead of rolling our own.
authorPeter Johnson <peter@tortall.net>
Tue, 22 Oct 2002 07:45:45 +0000 (07:45 -0000)
committerPeter Johnson <peter@tortall.net>
Tue, 22 Oct 2002 07:45:45 +0000 (07:45 -0000)
svn path=/trunk/yasm/; revision=777

configure.ac
frontends/yasm/yasm.c
libyasm/util.h
libyasm/xmalloc.c
libyasm/xstrdup.c
src/main.c
src/util.h
src/xmalloc.c
src/xstrdup.c
util.h

index cc4955869fb0b7d035d10f41176932cef78dbb34..aa1c1ab83b5475390bc90f29a593a29d7d3d9d23 100644 (file)
@@ -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
index ca4453dce6e4b1a37d33ec82370b2a3771868f14..27c5327b0a413ec5f828305b8ba6ecf0df6da763 100644 (file)
@@ -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
index 0234977767a5be45bdd90cf93e6318f49b60edb6..dd4ab6adb71c64cb60d1c3ebae23e662d7a43500 100644 (file)
@@ -117,9 +117,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 # endif
 #endif
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#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 <dmalloc.h>
 #endif
 
 /*@only@*/ char *xstrndup(const char *str, size_t len);
index da38bd920665b1098bf396ee4a2bbb382f0c99ca..c1a38d45f4d0ac8f3320352dfc957a9ae197e4f2 100644 (file)
@@ -25,7 +25,7 @@ RCSID("$IdPath$");
 #include "errwarn.h"
 
 
-#ifndef DMALLOC
+#ifndef WITH_DMALLOC
 
 void *
 xmalloc(size_t size)
index 42685ea1e4e8007b4346c1765e491816a41febc6..1fd2a051a72ce5f9857252ba691d69dc60ec43f5 100644 (file)
@@ -47,7 +47,7 @@ void memcpy(void *, const void *, size_t);
 # endif
 #endif
 
-#ifndef DMALLOC
+#ifndef WITH_DMALLOC
 
 char *
 xstrdup(const char *str)
index ca4453dce6e4b1a37d33ec82370b2a3771868f14..27c5327b0a413ec5f828305b8ba6ecf0df6da763 100644 (file)
@@ -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
index 0234977767a5be45bdd90cf93e6318f49b60edb6..dd4ab6adb71c64cb60d1c3ebae23e662d7a43500 100644 (file)
@@ -117,9 +117,6 @@ int strncasecmp(const char *s1, const char *s2, size_t n);
 # endif
 #endif
 
-#ifdef DMALLOC
-# include <dmalloc.h>
-#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 <dmalloc.h>
 #endif
 
 /*@only@*/ char *xstrndup(const char *str, size_t len);
index da38bd920665b1098bf396ee4a2bbb382f0c99ca..c1a38d45f4d0ac8f3320352dfc957a9ae197e4f2 100644 (file)
@@ -25,7 +25,7 @@ RCSID("$IdPath$");
 #include "errwarn.h"
 
 
-#ifndef DMALLOC
+#ifndef WITH_DMALLOC
 
 void *
 xmalloc(size_t size)
index 42685ea1e4e8007b4346c1765e491816a41febc6..1fd2a051a72ce5f9857252ba691d69dc60ec43f5 100644 (file)
@@ -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 0234977767a5be45bdd90cf93e6318f49b60edb6..dd4ab6adb71c64cb60d1c3ebae23e662d7a43500 100644 (file)
--- 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 <dmalloc.h>
-#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 <dmalloc.h>
 #endif
 
 /*@only@*/ char *xstrndup(const char *str, size_t len);