pioneerspacesim / pioneer

A game of lonely space adventure
https://pioneerspacesim.net
1.58k stars 364 forks source link

Include stdlib.h instead of alloca.h for alloca(3) on FreeBSD #5827

Closed AMDmi3 closed 1 month ago

AMDmi3 commented 1 month ago
AMDmi3 commented 1 month ago

For the record, this fixes build on FreeBSD which doesn't have alloca.h and alloca(3) is defined in stdlib.h. I've just checked that including stdlib.h instead of alloca.h works for me on linux (ubuntu 22.04) as well, so we may consider just switching to stdlib.h as a simpler solution, however I'm not aware if it's portable. The best thing would be to check for alloca.h in cmake, but it's a bit more complicated. Can redo this PR for any of mentioned alternative solutions if it's deemed more suitable.