Adjust test cases to not use alloca.h on NetBSD. Use a temporary directory under WRKDIR and allow C++ when test builds are requested.