As I said in my first post, I manually download the app source and run ./configure --help to determine which flags to use so that I can add them to the FLAGS variable. This script is designed more to be a final product than a testbed. Do all your testing and figuring out by hand, then just fill in the variables and info section. Then the script could be included in the extension submission and anyone could download it and run it from a "base norestore" boot and end up with a working extension. Having the script read configure flags would not 1) run unattended or complete automatically, or 2) allow someone else to follow your work in case you are not available later on.
K.I.S.S. - you gotta do the work to find the source and fill in the variables for it, why not just unpack it, see whats inside, and at least run ./configure --help before even starting to fill in the script.