Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. Cosmopolitan can be compiled from source on any Linuxdistro. GNU make needs to be installed beforehand. This is a freestanding hermetic repository that bootstraps using a vendored static gcc9 executable. No further dependencies are required.
pofig - portable shell script for probing base system properties: OS, OS version, kernel version, distro, distro version, architecture.
It detects: 19 operating systems, 11 major linux distros, 13 CPU types.
See wiki for more information and examples.