portability: check for qsort_r which does not match POSIX-next definition
FreeBSD (and also Darwin) introduced its own qsort_r, which has different semantics than the one slated for inclusion in POSIX. Add a portability thunk to deal with translating between implementations.
Closes #10833 (closed).