Here's how I fixed it:
- MAMP doesn't provide the source code archive for PHP 5.4.10 so download it from php.net
- Extract the source code archive to /Applications/MAMP/bin/php/php5.4.10/include/php
- Run
./configureto configure the source code for your platform (without this step the pecl install will fail looking for a bunch of header files) - Retry compilation for ssh2