Fixes for standard IlmBase/OpenEXR 2.1 installation

After upgrading to OpenEXR 2.1 on OSX, my build broke. This seems to fix.

It would be very helpful if somebody on Linux who gets IlmBase/OpenEXR 2.1 from a standard place can try this out (on Linux, at work we use a custom ILMBASE_HOME/OPENEXR_HOME, so it's not a good test of the changed logic).

I don't fully understand the code I modified, other than that it seems not to work. It was submitted a few months back by Bastien Montagne. Bastien, if you are reading this, can you comment? Does this still work for you, or is it broken at your site?