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
unix, windows: always update loop time

Fixes #846
2013.12.13, Version 0.10.20 (Stable)

Changes since version 0.10.19:

* linux: fix up SO_REUSEPORT back-port (Ben Noordhuis)

* fs-event: fix invalid memory access (huxingyi)
Now working on v0.10.21
windows: translate system errors in uv_spawn

We weren't always translating system errors for in uv_spawn.

This is half a fix for node's unit test
 test-child-process-cwd.js on win.
 The rest will go into node lib.
 It also fixes test-child-process-exec-error
windows: uv_spawn code refactor
Merge remote-tracking branch 'origin/v0.10'

Conflicts:
	.mailmap
	ChangeLog
	src/version.c
unix, windows: detect errors in uv_ip4/6_addr
stream: introduce uv_try_write(...)

`uv_try_write(stream, buf, size)` acts like `uv_write()`,
but without queueing actual write until UV_POLLOUT (or IOCP completion).
This is useful for doing writes using on-stack `uv_write_t` requests.

fix #1025
2013.12.14, Version 0.11.16 (Unstable)

Changes since version 0.11.15:

* fsevents: remove kFSEventStreamCreateFlagNoDefer polyfill (ci-innoq)

* libuv: add more getaddrinfo errors (Steven Kabbes)

* unix: fix accept() EMFILE error handling (Ben Noordhuis)

* linux: fix up SO_REUSEPORT back-port (Ben Noordhuis)

* fsevents: fix subfolder check (Fedor Indutny)

* fsevents: fix invalid memory access (huxingyi)

* windows/timer: fix uv_hrtime discontinuity (Bert Belder)

* unix: fix various memory leaks and undef behavior (Fedor Indutny)

* unix, windows: always update loop time (Saúl Ibarra Corretgé)

* windows: translate system errors in uv_spawn (Alexis Campailla)

* windows: uv_spawn code refactor (Alexis Campailla)

* unix, windows: detect errors in uv_ip4/6_addr (Yorkie)

* stream: introduce uv_try_write(...) (Fedor Indutny)
Now working on v0.11.17
test: remove C++ style comment
stream: allow multiple buffers for uv_try_write
build: add support for VS2013
unix: fix a possible memory leak in uv_fs_readdir

Some scandir implementations allocate the dirent struct even if the
directory is empty, so if `scandir` returns 0 there may still be memory
that needs to get deallocated. I have altered uv__fs_readdir to go to
the "deallocation exit area" when 0 files are found in the directory
and continue to return early on a return value of -1.

I went to add a test for this functionality, but it appears that one
already exists (reading an empty directory), so I imagine that the
valgrind builds must only be happening on linux instead of OSX as well?
I have confirmed manually that a program without this fix will
infinitely leak memory, and with this fix the memory usage stays
constant.
test: allow UV_EACCES in spawn_fails

Allow UV_EACCES as a successful return value when uv_spawn fails.

When the PATH environment variable contains a directory which the
user cannot access, execvp may return EACCES instead of ENOENT.

fix #1045.
build: ignore generated makefiles on android

gyp currently doesn't support the --generator-output option for android,
this is the best way to ignore generated files for projects using libuv
as a dependency.