configure: require automake 1.13

AM_INIT_AUTOMAKE requests subdir-objects, which is only available starting
on automake 1.13
Makefile: fix build on windows

Correct wrong filename, change the defines to define to 1 (so they work
with #if) and include osdep/priority.c in the sources when needed.
configure: check for sys/soundcard.h before soundcard.h

Only OpenBSD and some older BSDs put it in the toplevel.
configure: Also check for -ltinfo in the TERMINFO test
configure: Add WASAPI test

Code in audio/out/ao.c expects CONFIG_WASAPI instead of HAVE_WASAPI, so
we AC_DEFINE that.
configure: Only run Cocoa tests when building for Darwin
configure: enable encoding support, support disabling it
Add an autogen.sh script
configure: don't define HAVE_DOS_PATHS on cygwin
configure: Move some OS-specific checks into separate files
configure: Add OpenGL check to OS_WINDOWS_CHECK