meson: Improve detection of qsort_r().
Instead of trying to guess the interface style by solely checking the OS name, check if a fake test program can be built and linked. This will give more accurate result when FreeBSD and other systems moved to the interface based on GNU qsort_r().