4.2 mej fixes (for master branch)

Same as pull request #34, but for the "master" branch this time:

> Several fixes necessary to get the 4.2.0 branch building and working on our system. 
> Includes some forward-ports of bugfixes I'd previously made against 4.1-dev, some
> build fixes due to the C/C++ conversion, etc. Also fixes "make distcheck" when
> --with-check was not specified.
>
> Note: DRMAA is broken due to the C/C++ conversion, and I don't know gperf well
> enough to fix it.