Honour CC, CFLAGS and LDFLAGS in configure script.

This fixes feature detection when compiling w/o gcc (ie cross compiling).