Development packages for zlib and libbz2 are needed, as well as a standard compiler environment. On Ubuntu, this can be installed via:
sudo apt-get install build-essential libtool automake zlib1g-dev libbz2-dev pkg-config
On MacOS, the Apple Developer tools and Fink (or MacPorts or Brew) must be installed, then:
sudo fink install bzip2-dev pkgconfig