elf.h and link.h do not provide ElfW types on BSD systems, triggering the following error (and more) while compiling gnome-shell:
../gnome-shell-44.0/src/main.c:135:3: warning: implicit declaration of function 'ElfW' is invalid in C99 [-Wimplicit-function-declaration] ElfW (Dyn) *dyn; ^ ../gnome-shell-44.0/src/main.c:135:9: error: use of undeclared identifier 'Dyn' ElfW (Dyn) *dyn;
So let's keep the check for Linux systems only (both glibc and musl seems to define ElfW.