Check and configure for <malloc.h>

This fixes the build on MacOS.