Trim configure.ac, remove #ifdefs for POSIX features

* Remove checking for some POSIX features - POSIX is now a requirement.
* Remove obsolete and redundant autoconf macros.
Move tests into subdirectory; combine into single suite.
Write tests for perm.c
Reorganise source tree, remove unused Makefile.in targets.