-AC_CHECK_FUNCS(mkstemp setlocale)
-AC_CHECK_DECLS([stpcpy, strchr, strndup, strspn, strnlen, memchr])
-AC_REPLACE_FUNCS(stpcpy strchr strndup strnlen strspn memchr)
+AC_FUNC_STRNLEN
+UTILS_FUNC_MKSTEMP
+AC_CHECK_FUNCS(setlocale)
+AC_CHECK_DECLS([free, stpcpy, strchr, strspn, strnlen, malloc, memchr, memrchr])
+AC_REPLACE_FUNCS(stpcpy strchr strspn memchr memrchr)