diff options
author | Yang Tse <yangsita@gmail.com> | 2006-07-11 20:40:38 +0000 |
---|---|---|
committer | Yang Tse <yangsita@gmail.com> | 2006-07-11 20:40:38 +0000 |
commit | 4d95d23d99a35a098cdc17f91b36d41dab98a30c (patch) | |
tree | b362f958a9b85b3aa5ffc6b86f37bec5a8fb02ff /ares/acinclude.m4 | |
parent | c6fc5a1a269796a47ac265751e0baafcf436391a (diff) |
Define NEED_MALLOC_H if including <stdlib.h> is not enough for proper compilation and <malloc.h> must also be included.
Diffstat (limited to 'ares/acinclude.m4')
-rw-r--r-- | ares/acinclude.m4 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/ares/acinclude.m4 b/ares/acinclude.m4 index 05739f114..4db7a360d 100644 --- a/ares/acinclude.m4 +++ b/ares/acinclude.m4 @@ -149,6 +149,57 @@ AC_DEFUN([CURL_CHECK_HEADER_WS2TCPIP], [ ]) +dnl CURL_CHECK_HEADER_MALLOC +dnl ------------------------------------------------- +dnl Check for compilable and valid malloc.h header, +dnl and check if it is needed even with stdlib.h + +AC_DEFUN([CURL_CHECK_HEADER_MALLOC], [ + AC_CACHE_CHECK([for malloc.h], [ac_cv_header_malloc_h], [ + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ +#include <malloc.h> + ],[ + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + ]) + ],[ + ac_cv_header_malloc_h="yes" + ],[ + ac_cv_header_malloc_h="no" + ]) + ]) + if test "$ac_cv_header_malloc_h" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_MALLOC_H, 1, + [Define to 1 if you have the malloc.h header file.]) + # + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([ +#include <stdlib.h> + ],[ + void *p = malloc(10); + void *q = calloc(10,10); + free(p); + free(q); + ]) + ],[ + curl_cv_need_header_malloc_h="no" + ],[ + curl_cv_need_header_malloc_h="yes" + ]) + # + case "$curl_cv_need_header_malloc_h" in + yes) + AC_DEFINE_UNQUOTED(NEED_MALLOC_H, 1, + [Define to 1 if you need the malloc.h header file.]) + ;; + esac + fi +]) + + dnl CURL_CHECK_TYPE_SOCKLEN_T dnl ------------------------------------------------- dnl Check for existing socklen_t type, and provide |