For ubuntu users:
Install the library using
sudo apt-get install libbz2-dev
and then add this to your configure command
--with-bz2
this will automatically detect the default directory.
The mistake I did was installing php7.1-bz2 instead of above given lib.
Wanna say thanks?
Please feed stray animals :)