3 ms·
Can someone explain this: https://github.com/void-linux/void-packages/blob/master/srcpkgs/txr/patches/musl-configure.patch https://github.com/void-linux/void-p
by kazinator 8y ago
Can someone explain this:
https://github.com/void-linux/void-packages/blob/master/srcpkgs/txr/patches/musl-configure.patch https://github.com/void-linux/void-packages/blob/master/srcp...
This configure test uses a C program to detect that #include <$try_header> works for some value of $try_header, like alloca.h: note angle brackets. After detecting it this way, why would we need to switch this to #include "..." for the sake of Musl, to get the actual program to compile?
- kazinator 8y agoI figured it out (without actually building with Musl). Musl's <stdlib.h> includes <alloca.h> already if _GNU_SOURCE or _BSD_SOURCE is defined. Musl's <alloca.h> defines an object-like alloca macro if compiled with GCC: #define alloca __builtin_alloca. When we try to include the <alloca.h> header through a macro, as in #include ALLOCA_H, it's subject to macro expansion: ALLOCA_H is replaced with <alloca.h>. This is five pp-tokens: < alloca . h >. The second one is the macro that was defined due to <stdlib.h> having included <alloca.h> already, and so this gets replaced now; we end up with #include <__builtin_alloca.h>.