Using exit requires #include <stdlib.h> first which this configure check doesn't do. Consequently, newer compilers that default to -Werror=implicit-function-declaration encounter an error like error: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations (llvm.org clang 16 and later) or error: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))' (Apple clang 12 and later) when running this configure check and thus always think sys_errlist is not available even if it is. Using return instead of exit is simpler than including the header.
Also declare the return type of main. Not doing this causes error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int in new compilers like llvm.org clang 16 that default to -Werror=implicit-int which, as above, can cause the feature detection to arrive at the wrong answer.
Using
exit
requires#include <stdlib.h>
first which this configure check doesn't do. Consequently, newer compilers that default to-Werror=implicit-function-declaration
encounter an error likeerror: call to undeclared library function 'exit' with type 'void (int) __attribute__((noreturn))'; ISO C99 and later do not support implicit function declarations
(llvm.org clang 16 and later) orerror: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
(Apple clang 12 and later) when running this configure check and thus always thinksys_errlist
is not available even if it is. Usingreturn
instead ofexit
is simpler than including the header.Also declare the return type of
main
. Not doing this causeserror: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int
in new compilers like llvm.org clang 16 that default to-Werror=implicit-int
which, as above, can cause the feature detection to arrive at the wrong answer.