-[AC_REQUIRE([AC_HEADER_STDC])dnl
-AC_CHECK_HEADERS(stdlib.h)
-AC_CACHE_CHECK([for GNU libc compatible calloc], ac_cv_func_calloc_0_nonnull,
-[AC_RUN_IFELSE(
-[AC_LANG_PROGRAM(
-[[#if STDC_HEADERS || HAVE_STDLIB_H
-# include <stdlib.h>
-#else
-char *calloc ();
-#endif
-]],
- [exit (calloc (0, 0) ? 0 : 1);])],
- [ac_cv_func_calloc_0_nonnull=yes],
- [ac_cv_func_calloc_0_nonnull=no],
- [ac_cv_func_calloc_0_nonnull=no])])
+[AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+AC_CACHE_CHECK([for GNU libc compatible calloc], [ac_cv_func_calloc_0_nonnull],
+[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
+ [[exit (!calloc (0, 0) || calloc ((size_t) -1 / 8 + 1, 8));]])],
+ [ac_cv_func_calloc_0_nonnull=yes],
+ [ac_cv_func_calloc_0_nonnull=no],
+ [ac_cv_func_calloc_0_nonnull=no])])