build: detect pthread_setname_np and sched_* APIs, guard usage
Add configure checks for pthread_setname_np and sched_* functions. Wrap their usage with HAVE_* guards to avoid build failures on platforms where they are unavailable.
Return -ENOTSUP for unsupported scheduler operations.
Improves portability across non-Linux and restricted environments (e.g. WebAssembly).