Remove tabs in shell script

Indentation by tab will cause a file listing for the current directory
before the command is executed, and that what not intended here.
Ignore version output

When creating CMake files for config mode, a separate version file is
generated; this should be on the ignore list as well if we are going
to build in-tree.
Allow DUNE paths to be specified in configure

Path to DUNE libraries are specified with the ROOT prefix, but with the
stem with the same name as the module -- in lowercase (otherwise; does
the hyphen uppercase to underscore?). This deviates somewhat from the
usual CMake convention of using uppercase all over the place.
Provide distclean target to remove CMake artifacts

If you are building in-tree (which is commonly done by dunecontrol),
it can be advantageous to have a target which is capable of cleaning
out all the files that CMake left without having to erase the entire
folder.
Display CMake command-line that is being executed

Since this is a compatibility script it will probably benefit people
seeing which underlaying CMake command is being executed (not at least
for debugging purposes)
Assume that all paths to modules are directories

Old implementation had a problem with the special case that you
specified a directory directly under the root (e.g. /usr); dirname
adds a trailing slash in that case.
Quote paths

Otherwise strange things will happen if they contain spaces
Provide ability to build in DUNE framework

dunecontrol will look for a file called dune.module and use the
information therein to determine which and in what sequences directories
should be built.

By specifying dune-common and dune-istl as dependencies here, we
ensure that those directories are available before opm-core. They are
not true dependencies; opm-core is usable without them, but if you are
using dunecontrol, then it is a good bet that dune-istl also is
available and desirable to use.