Forced extension compilation

Is there a way to force the compilation of any or all native extensions
to be built when compiling ruby from src? I find it annoying to
install ruby from source only to find out later that I don’t have
readline, openssl or curses, simply because I didn’t have the headers
installed when I compiled ruby.

Is there any way to ensure that a native extension will configure /
install correctly at build time other than checking that the library
was built once everything is done?