Miscellaneous fixes to the configuration / build / test system (no functional/API changes)

Hi Nga/Bert,

please review this set of commits: I have cherry-picked the changes from merijn's and my branches that are applicable to your versions as well. I believe they are feature-neutral from your perspective, and should restore "make distcheck" functionality. Also it provides improved support for SAC4SNet.