+dnl Check for efence
+AC_CHECK_LIB(efence, main, [efence=true], [efence=false])
+AC_MSG_CHECKING([for enable-efence])
+AC_ARG_ENABLE(efence,
+[ --enable-efence Use ElectricFence memory allocation],
+[case "${enableval}" in
+ yes) useefence=true
+ AC_MSG_RESULT(yes)
+ ;;
+ no) useefence=false
+ AC_MSG_RESULT(no)
+ ;;
+ *) AC_MSG_RESULT([bad value ${enableval} for --enable-efence])
+ ;;
+esac],
+[useefence=false; AC_MSG_RESULT(no)])
+
+if test "$efence" = "true" -a "$useefence" = "true" ; then
+ ctlibs_tools="$ctlibs_tools -lefence"
+ AC_DEFINE(HAVE_EFENCE)
+ AC_MSG_RESULT(Using efence)
+fi
+