[2.0] Fix various problems with the build system.

#### 1. Work around pkg-config not being used on non-FreeBSD systems.

This is a horrible hack but I can't seem to find a better way of fixing it which won't end up being the entire build system rewrite which is happening in the master branch.

#### 2. Fix the build system trampling over the default pkg-config path.

This caused the build system to not be able to find dependencies which are installed in non-standard locations.

The intent of extend_pkg_path was to to try and fix systems with a "broken" pkg-config path but it instead breaks things even more.

---

Due to the nature of cd9af69 it would be greatly appreciated if people could help by testing this. It works for me but I only have a small range of systems (mainly OS X and Debian based) to test on.