Allow disabling hardware counters from cmake

Allows disabling hardware counters with `cmake -DDISABLE_HARDWARE_COUNTERS=1 .`, needed for Linux XenU (paravirtualized Xen) guest systems (see #981, #1065, #1118).

P.S. Maybe could be added to 2.3 branch too, if there will be some more releases there.