doc: document how to run tests
unix: fix various memory leaks and undef behavior

Kindly suggested by `cppcheck`.
build: add support for pkg-config
build: hide dtrace rules unless needed

When using configure, there are situations where libuv will attempt
to build uv-dtrace.h, even if it is configured with --disable-dtrace.
For example, if libuv is first configured with dtrace enabled, then
built, the .deps files will contain references to include/uv-dtrace.h.
After a make clean and configure --disable-dtrace, the build will still
attempt to create include/uv-dtrace.h and fail. make will see the
dependency reference (which survives the make clean), use the rule
(which is always added to the Makefile), and fail since DTRACE is not
defined.

This commit protects the rules to make uv-dtrace.h with the proper
conditionals to ensure the rules are not written if --disable-dtrace
is chosen.

Fix #963.
build: check if pkg-config is installed

Also, don't check for a specific pkg-config version, since libuv doesn't
use pkg-config itself