Fix bugzilla issue 24389 - Make Phobos compile on FreeBSD 14 again. #8918
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
zlib can't be built with importC on FreeBSD 14, because qsort_r in stdlib.h uses some asm instructions, which dmd can't handle.
dlang/dmd#16184 fixed it so that we got a proper error message about it (and theoretically making it so that zlib could be compiled on FreeBSD 14 with gdc or ldc, though I haven't tried that), but it didn't fix it so that it could build on dmd, since that would require that dmd be able to handle GNU assembly code, which isn't a planned feature AFAIK.
#8914 fixed it so that it's possible to build Phobos without using importC by providing a make variable, but it didn't do anything for FreeBSD specifically.
This commit changes it so that FreeBSD sets that make variable in the makefile so that you don't have to do it manually to get FreeBSD 14 to build. It's not necessary for FreeBSD 13.2 (which is what the auto testers currently use), but it will be necessary for FreeBSD 14 (14.0 currently being the latest release of FreeBSD).
I can confirm from testing that explicitly setting USE_IMPORTC=1 on the command line will overrides this change, so that variable can still be set one way or the other on FreeBSD. It's just now 0 by default so that it will build by default on FreeBSD 14.