Include alloca.h and check for it before use.

This is needed for FreeBSD support.