dnl CF_WITH_NO_LEAKS version: 6 updated: 2021/11/25 17:10:01
dnl ----------------
AC_DEFUN([CF_WITH_NO_LEAKS],[
AC_REQUIRE([CF_WITH_DMALLOC])
AC_REQUIRE([CF_WITH_DBMALLOC])
AC_REQUIRE([CF_WITH_PURIFY])
AC_REQUIRE([CF_WITH_VALGRIND])

AC_MSG_CHECKING(if you want to perform memory-leak testing)
AC_ARG_WITH(no-leaks,
	[  --with-no-leaks         test: free permanent memory, analyze leaks],
	[case "x$withval" in
	 (xno|x)
		: ${enable_leaks:=yes}
	 	;;
	 (*)
		enable_leaks=no
	 	;;
	esac],
	[: ${enable_leaks:=yes}])

dnl TODO - drop with_no_leaks
if test "x$enable_leaks" = xno
then
	with_no_leaks=yes
else
	with_no_leaks=no
fi

AC_MSG_RESULT($with_no_leaks)

if test "x$enable_leaks" = xno
then
	AC_DEFINE(NO_LEAKS,1,[Define to 1 to enable leak-checking])
	cf_doalloc=".${with_dmalloc}${with_dbmalloc}${with_purify}${with_valgrind}"
	case ${cf_doalloc} in
	(*yes*)
		;;
	(*)
		AC_DEFINE(DOALLOC,10000,[Define to size of malloc-array])
		;;
	esac
fi
])dnl
