diff options
Diffstat (limited to 'xorg-macros.m4.in')
-rw-r--r-- | xorg-macros.m4.in | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in index fe29881..c7df523 100644 --- a/xorg-macros.m4.in +++ b/xorg-macros.m4.in @@ -904,18 +904,16 @@ AC_ARG_ENABLE(malloc0returnsnull, AC_MSG_CHECKING([whether malloc(0) returns NULL]) if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then - AC_RUN_IFELSE([ -char *malloc(); -char *realloc(); -char *calloc(); -main() { + AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include <stdlib.h> +],[ char *m0, *r0, *c0, *p; m0 = malloc(0); p = malloc(10); r0 = realloc(p,0); - c0 = calloc(0); - exit(m0 == 0 || r0 == 0 || c0 == 0 ? 0 : 1); -}], + c0 = calloc(0,10); + exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); +])], [MALLOC_ZERO_RETURNS_NULL=yes], [MALLOC_ZERO_RETURNS_NULL=no], [MALLOC_ZERO_RETURNS_NULL=yes]) |