Instead of including -lm by default, perhaps do a check for cos in libm and if found then add the -lm.
Haiku has the math lib built into libroot, same as BeOS did. This may affect other systems as well.
Ccache is used by Paladin, and IDE for Haiku.
Fixed in a8e73e8e617942cf2c25a6301415488c74b5662d.
Included in v3.1.5.