#11 fix malloc tests in configure

Next Release
open
nobody
None
2 days ago
2014-05-30
Mojca Miklavec
No

Detection of malloc.h doesn't work properly, at least not on Mac.

With existing configulation it fails with:

checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for working volatile... yes
checking whether closedir returns void... yes
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... no
...
Undefined symbols for architecture x86_64:
"_rpl_malloc", referenced from:
_br_strcat in prefix.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [codeblocks] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

The following workaround fixes the problem (but you probably need to modify it):

--- configure.ac.orig
+++ configure.ac
@@ -36,7 +36,7 @@ AC_PROG_LIBTOOL
 dnl Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_STDC
-AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h malloc.h])
+AC_CHECK_HEADERS([fcntl.h limits.h stdlib.h string.h sys/param.h unistd.h sys/malloc.h])

 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_HEADER_STDBOOL

Discussion