cmake: import an in-tree version of CheckPrototypeDefinition

Some older versions of cmake do not have check_prototype_definition().
This patch impotrs an in-tree version.
cmake: Relax cmake version requirements

Some stable platforms (like RHEL-6) only have an old version of cmake,
usually 2.6.x. This patch relaxes the version requirement to allow
building on RHEL-6 as well.