I fixed the missing CPPFLAGS and LDFLAGS in commit 7e974a8c.
Needs testing, let's see if this works...