I think Haiku vs. -lm is a separate issue. Also, I don't think .ifdef-ing all packages that use -lm is impractical.