configure.sh: refactoring