Add support for new kernel include structures

Newer kernel versions use the uapi include direcory for user space
APIs. The Makefile incorrectly used the old location on such kernels,
which lead to compilation errors. This changeset introduces a check
for the new perf_event.h header location before probing the old one.
Merge branch 'master' into pirate
pirate: Fix unused warning

Add a compiler attribute to silence warnings about the 'discard'
variable being unused.