I was using Electric Fence when I was debugging the pool code.
It helped a bit, so it might be good to have it as a configure
option (--with-efence[=DIR]).
However, I'm wondering if we could have a GPL v. BSD disrepency
here since efence is under GPL and we're still BSD. So, I won't
commit unless someone says it is okay.
Note that this requires the addition of the
apr_platform_runtime_link_flag variable so that we can properly
do the LDFLAGS on certain OSes (Solaris). Linux has -rpath, but
I'm not 100% sure we need it. Also, the latest GNU binutils says
that its ld accepts -R as well - can anyone confirm this on
older Linux boxen? (It seems that setting it to -Wl,-rpath screws
up the APR_ADDTO macro.) -- justin
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.197
diff -u -r1.197 CHANGES
--- CHANGES 2001/12/14 10:06:19 1.197
+++ CHANGES 2001/12/14 10:24:16
@@ -1,5 +1,8 @@
Changes with APR b1
+ *) Add --with-efence to allow usage of Electric Fence.
+ [Justin Erenkrantz]
+
*) Put new pools code in place which allows applications to
switch off locking on pools operations in case a pool is
guaranteed to never being used in more than one thread
Index: configure.in
===================================================================
RCS file: /home/cvs/apr/configure.in,v
retrieving revision 1.390
diff -u -r1.390 configure.in
--- configure.in 2001/12/14 02:45:15 1.390
+++ configure.in 2001/12/14 10:24:17
@@ -131,12 +131,15 @@
fi
dnl On AIX, libraries need to be specified on the link of lib_target
+lib_target_libs=""
case $host in
*aix*)
lib_target_libs="\$(EXTRA_LIBS)";
;;
+ *-solaris2*)
+ apr_platform_runtime_link_flag="-R"
+ ;;
*)
- lib_target_libs=""
;;
esac
@@ -184,6 +187,23 @@
fi
fi
)dnl
+
+dnl Electric Fence malloc checker.
+dnl --with-efence specifies the path to Electric Fence
+AC_ARG_WITH(efence,
+ [ --with-efence[[=DIR]] path to Electric Fence installation],
+ [ apr_efence_dir="$withval"
+ if test "$apr_efence_dir" != "yes"; then
+ APR_ADDTO(LDFLAGS,[-L$apr_efence_dir/lib])
+ if test "x$apr_platform_runtime_link_flag" != "x"; then
+ APR_ADDTO(LDFLAGS,
+ [$apr_platform_runtime_link_flag$apr_efence_dir/lib])
+ fi
+ fi
+ AC_CHECK_LIB(efence, malloc,
+ [ APR_ADDTO(LIBS,-lefence) ],
+ [ AC_MSG_ERROR(Electric Fence requested but not detected) ])
+ ])
if test "$host" = "i586-pc-beos"; then
AC_ARG_ENABLE(malloc-debug,[ --enable-malloc-debug Switch on malloc_debug
for BeOS],