add to CFLAGS instead of overwriting them.

One less patch for debian to carry.
link with LDFLAGS if set.

(another patch from debian)