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.

Note:  "make distcheck" doesn't work if one hasn't enabled --with-check.  I know how to fix it, but it'll take some time.  DRMAA is also broken, and I don't know gperf well enough to fix it.