Bert,
you need to make sure the VM compiles even without the headers and libraries present. We need to have configure-time checks for all needed headers and libraries, and disable the plugin if those are not present. I see you check for the headers, but not for the libraries. There is an AC_PLUGIN_CHECK_LIB macro for this, see doc/HowToBuildFromSource.txt
OK. I added a couple of AC_CHECK_LIBs because using both AC_TRY_COMPILE and AC_PLUGIN_CHECK_LIB caused an error in disablePlugin.c. This is somewhat ugly though, it seems to work well. I'm completely novice about the syntax of acinclude.m4, so please check it.
The proper way to make sure ogg or speex is installed would be in sugar-jhbuild sanitycheck.
I'll take a look at that.
cheers, - Takashi