configure: Move the bz2 and zlib checks below phtreads

There are alternate implementations of those libraries that use pthreads.
configure: Reorder pthreads checks

Some pthreads symbols might be present in libc (as shown on various *BSD)
but not all of them, leading to false positives.

Check for the most common compiler flags before the plain symbol check
to avoid known pitfalls.
doxy: Define a group for libswscale documentation

Uniform the style and eliminate a warning on newer doxygen version..