Jeffrey Walton wrote:
On Sun, Feb 25, 2024 at 2:09 AM Jeffrey Walton <noloader@xxxxxxxxx> wrote:
The page <https://www.gnu.org/software/autoconf-archive/ax_gcc_builtin.html>
does not list __builtin_offsetof in the list of documented builtins.
But the page says "Unsupported built-ins will be tested with an empty
parameter set and the result of the check might be wrong or
meaningless so use with care."
Is it safe to use ax_gcc_builtin to detect __builtin_offsetof?
Sorry to ask. Google is not returning useful results.
Cancel. We can't use AX_GCC_BUILTIN in production. Using
AX_GCC_BUILTIN produces broken configure's:
checking for getpagesize... yes
checking for working mmap... yes
checking for gettimeofday... yes
./configure: line 15023: syntax error near unexpected token `__builtin_offsetof'
./configure: line 15023: `AX_GCC_BUILTIN(__builtin_offsetof)'
Between your error and Peter Hull's response, I suspect that
AX_GCC_BUILTIN is extremely sensitive to underquoted arguments. Try
`AX_GCC_BUILTIN([__builtin_offsetof])' just to see if it solves this
problem, but I would recommend also following Zack Weinberg's advice to
#include <stddef.h> and use the offsetof that is defined in C89 instead
of directly depending on the GCC builtin.
-- Jacob