gcc on my linux vm doesn't have M_PI so we make sure it's defined, also fixed pthread linking on linux