Another attempt to fix fdatasync() on Darwin and FreeBSD

Use check_symbol_exists(), not check_function_exists(),
to discover fdatasync(), since apparently on some BSD systems
the symbol is present in the library but not in the headers
(I hope not vice versa).

Don't use check_prototype_definition, since it's not available
in CMake 2.6.