Support for FreeBSD and few other features (reworked PR #264).

This is an ancestor of PR #264. If it is good to merge, the #264 should be closed.

This is quite big set of changes. I've rebased it, so it currently merges nicely to master.

I've merged three other commits from related pull requests:  #341, #271, #304.

I have ran few tests on FreeBSD, checked with prefork, itk, event and worker mpms, tried with php module, at least these configurations worked.