Refactor support for 10.8, bring back <=10.7 support

The change to dirent.h was done only in Mac OS X 10.8, for 10.7
and older releases keep using the old prototype.

Availability.h header is used, thus only 10.6 and 10.7 as old
targets are supported.

Signed-off-by: David Abdurachmanov <davidlt@cern.ch>