misc: convert code using atomics.h to stdatomic.h

Requires a C11-compatible libc. The stdatomic.h, at least as shipped by
FreeBSD and MinGW-w64 is compatible with non-C11 compilers as long as
they support at least __sync; atomics.h also had the same requirement.

This doesn't touch waf so it's doing dumb tests and not checking for
stdatomic.h's presence; this will be fixed on a following commit.
misc/ring: Use the acquire/release memory model for atomics

Also removes redundant barriers.
audio/out/pull: Use proper atomics

Remove all the standalone fences (which were broken even on 32-bit x86)
and use actual, proper atomics. Also converts p->ready to an actual
spinlock rather than a boolean you hoped wasn't concurrently accessed.
compat: Add stdatomic.h compat header and waf check

Change atomics-using code to include compat/stdatomic.h instead of
directly including stdatomic.h, for compatibity with systems with old
libc and/or compilers.

We include the code from FreeBSD's stdatomic.h, which, due to supporting
both gcc 4.2 and clang, is compatible with the same compilers we already
supported with the old compat/atomics.h.