summaryrefslogtreecommitdiff
path: root/packages/lesstif/files/ac_debug.m4.diff
blob: 3fe6e8357d7409ea0186504565fe90d729000e99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Index: lesstif2-0.95.0/ac_debug.m4
===================================================================
--- lesstif2-0.95.0.orig/ac_debug.m4	2004-02-01 16:49:40.000000000 +0100
+++ lesstif2-0.95.0/ac_debug.m4	2006-07-11 11:11:36.000000000 +0200
@@ -4,6 +4,90 @@
 dnl Source code which depends on this is mostly in
 dnl DebugUtil.c/.h
 dnl
+AC_DEFUN(LT_WITH_DMALLOC,
+[AC_MSG_CHECKING(if malloc debugging is wanted)
+AC_ARG_WITH(dmalloc,
+[  --with-dmalloc[=path]   use dmalloc, see INSTALL(.html) for reference],
+[if test "$withval" = no; then
+  AC_MSG_RESULT(no)
+else
+dnl We overwrite the variables since we won't continue in
+dnl case of an error!
+dnl We modify CFLAGS, and also link libs (LDFLAGS) and programs (LIBS)
+  if test "$withval" != yes; then
+dnl  a path was given
+     CFLAGS="$CFLAGS -I$withval/include -DDMALLOC_FUNC_CHECK"
+
+     LDFLAGS="$LDFLAGS -L$withval/lib -ldmalloc"
+     LIBS="$LIBS -L$withval/lib -ldmalloc"
+  else
+dnl  no path was given
+     CFLAGS="$CFLAGS -DDMALLOC_FUNC_CHECK"
+     LDFLAGS="$LDFLAGS -ldmalloc"
+     LIBS="$LIBS -ldmalloc"
+  fi
+  AC_TRY_LINK(
+  [#include <dmalloc.h>],
+  [char *ptr;
+  ptr=malloc(1);
+  free(ptr);
+  ],
+  [AC_DEFINE(WITH_DMALLOC,1,
+            [Define if using the dmalloc debugging malloc package])
+  AC_MSG_RESULT(Using dmalloc)],
+  AC_MSG_ERROR(dmalloc not found)
+  )
+fi],
+[AC_MSG_RESULT(no)])
+])
+
+
+dnl
+dnl Enable another malloc checker for debugging purposes
+dnl Source code which depends on this is mostly in
+dnl DebugUtil.c/.h
+dnl
+AC_DEFUN(LT_WITH_DBMALLOC,
+[AC_MSG_CHECKING(if malloc debugging is wanted)
+AC_ARG_WITH(dbmalloc,
+[  --with-dbmalloc[=path]   use dbmalloc, see INSTALL(.html) for reference],
+[if test "$withval" = no; then
+  AC_MSG_RESULT(no)
+else
+dnl We overwrite the variables since we won't continue in
+dnl case of an error!
+dnl We modify CFLAGS, and also link libs (LDFLAGS) and programs (LIBS)
+  if test "$withval" != yes; then
+dnl  a path was given
+     CFLAGS="$CFLAGS -I$withval/include"
+
+     LDFLAGS="$LDFLAGS -L$withval/lib -ldbmalloc"
+     LIBS="$LIBS -L$withval/lib -ldbmalloc"
+  else
+dnl  no path was given
+     LDFLAGS="$LDFLAGS -ldbmalloc"
+     LIBS="$LIBS -ldbmalloc"
+  fi
+  AC_TRY_LINK(
+  [#include <dbmalloc.h>],
+  [char *ptr;
+  ptr=malloc(1);
+  free(ptr);
+  ],
+  [AC_DEFINE(WITH_DBMALLOC,1,
+            [Define if using the dbmalloc debugging malloc package])
+  AC_MSG_RESULT(Using dbmalloc)],
+  AC_MSG_ERROR(dbmalloc not found)
+  )
+fi],
+[AC_MSG_RESULT(no)])
+])
+dnl
+dnl Enable malloc checker for debugging purposes
+dnl See http://dmalloc.com, INSTALL(.html) for references to this.
+dnl Source code which depends on this is mostly in
+dnl DebugUtil.c/.h
+dnl
 AC_DEFUN([LT_WITH_DMALLOC],
 [AC_MSG_CHECKING(if malloc debugging is wanted)
 AC_ARG_WITH(dmalloc,