implement select-based loop for gcc stderr

this changes the connection code to use a select loop
to read from gcc's stderr

it probably requires a bit of configury before upstream submission
I think it's probably fine to simply not build the code if
select is not found and leave the harder parts of porting to
someone else