build: Reduce redundancy in configure.ac, convert osl detection.
We've had a fair number of bugs in configure.ac due to the fact that
most parts of it were created by copy+paste from an existing part.
This commit is an attempt to reduce this redundancy by factoring out
the reappearing parts to common macros. This will also reduce the
number of lines of configure.ac considerably, although this first
patch naturally adds more lines than it removes.
This commit introduces four new macros in configure.ac:
* AC_ARG_WITH: handles --with-xxx-headers and --with-xxx-libs
options for configure. The generated options are identical
to the old ones, so there are no compatibility issues.
* LIB_SUBST_FLAGS: creates preprocessor defines and make
variables
* STASH_FLAGS: saves copies of the CPPFLAGS, LDFLAGS and
LIBS variables
* UNSTASH_FLAGS restores stashed values
Only libosl detection is converted to use the new macros. Subsequent
patches will convert other libraries.