Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add detect_gnu_libc() and detect_musl_libc() functions
This PR adds a simple function to detect the version of glibc to the detect_api. This functionality is only intended for Linux systems using glibc. The function is detect_gnu_libc(). It simply runs ldd --version to detect the version of glibc. It is also possible to detect the version of the libc library by running the libc.so file. The location of this library varies much more than the path to ldd, so ldd --version is used instead. The path to ldd is passed as an argument, /usr/bin/ldd by default. This can modified to suite alternate sysroots. It can even be used in cross-compilation scenarios where emulation is available to execute ldd. The detect_gnu_libc function does a simple sanity check to verify that glibc is indeed being used. This avoids confusion on systems using an alternative libc implementation, i.e. musl. I also added a function to detect the version of the musl libc library as well. This function is detect_musl_libc() and works the same way. Addresses #3972, at least in part.
- Loading branch information