Synchronise build system with opm-core

Bring in recent improvements to `configure` script from opm-core.