On NetBSD 10.0 with gcc 10.5.0 libgcrypt's master branch (and probably earlier) fails to build with the following error after running ./configure && make:
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I../mpi -I../mpi -I/home/collinfunk/tmp/include -g -O2 -fvisibility=hidden -fno-delete-null-pointer-checks -Wall -MT aria.lo -MD -MP -MF .deps/aria.Tpo -c aria.c -fPIC -DPIC -o .libs/aria.o In file included from /usr/include/machine/types.h:41, from /usr/include/sys/types.h:45, from ../src/types.h:44, from aria.c:24: aria.c:645:5: error: expected declaration specifiers or '...' before '__builtin_constant_p' 645 | u32 bswap32(u32 v) | ^~~~~~~ *** Error code 1
This is because this platform defines a macro bswap32 in /usr/include/sys/endian.h which is included in many headers.
Simply undefining the macro does not work unfortunately and will fail with the following error:
aria.c:647:5: error: static declaration of 'bswap32' follows non-static declaration 647 | u32 bswap32(u32 v) | ^~~~~~~ In file included from /usr/include/arm/bswap.h:13, from /usr/include/machine/bswap.h:3, from /usr/include/sys/endian.h:107, from /usr/include/machine/endian.h:3, from /usr/include/sys/types.h:98, from ../src/types.h:44, from aria.c:24: /usr/include/sys/bswap.h:20:10: note: previous declaration of 'bswap32' was here 20 | uint32_t bswap32(uint32_t) __RENAME(__bswap32) __constfunc; | ^~~~~~~ gmake[2]: *** [Makefile:968: aria.lo] Error 1
It seems like the only solution is to #define bswap32 to some other function name on this platform.