4.2 mej fixes

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.