Looks like we need -lpthread on all arches, so that move it here and
move out some linux-specific defs.
Use LIBS instead of LDFLAGS to ensure correct order of linker arguments
and move linux-specific defs into linux section, add librt on linux
as well.
Re-gen.