Correctly check compiler flags with autoconf archive macros, add compiler flag before other compiler checks
Check for pthread support with autoconf archive macro
Check for sockaddr_in.sin_len using conditional include