build: major build script updates.

* Add module specification support to ./configure.
* Add external module specification support to ./configure.
* Add platform and architecture detection to ./configure.
* Miscellaneous cleanups in ./configure.