Build: configure: handle yes/no/try options consistently
The configure script has a number of --enable-* and --with-* options that take
some variation of yes/no/try. These were processed individually, leading to
code duplication and inconsistencies regarding what values were accepted.
Now, define a helper function to map the user's value to 0=no, 1=yes, 2=try,
and error on invalid values. Be more consistent about "yes" failing, and "try"
not failing, if enabling the option is not possible.
Also, use the $with_* and $enable_* variables defined by autoconf rather than
unnecessarily defining our own.