I've read both the Linux and FreeBSD man pages for sysconf. The Linux's says it defines _SC_NPROCESSORS_ONLN but may not be standard. The FreeBSD's says it defines it.

After looking inside <unistd.h>, _SC_NPROCESSORS_ONLN is only defined if __BSD_VISIBLE is defined which led me to the <sys/cdefs.h> header, which in turn, only defines __BSD_VISIBLE to be 1 if you don't have ANSI_SOURCE, _C99_SOURCE, _C11_SOURCE and any of the _POSIX_C_SOURCE and _XOPEN_SOURCE defined.

Is there a way to get this to work without having to define __BSD_VISIBLE on the compiler preprocessor? Thanks in advance.