Factor dependency check out of build script

And into a new script, **check_dependencies.sh**.