'Make adjustments to the OpenFOAM configuration files in their various
locations: etc/bashrc, etc/config.sh/FEATURE and customizations that
don\'t properly fit get placed in the etc/prefs.sh file (similiarly for
csh).'

def configure(self, spec, prefix):

    edits = {}
    edits.update(self.foam_arch.foam_dict())
    rewrite_environ_files(edits, posix=join_path('etc', 'bashrc'), cshell=join_path('etc', 'cshrc'))
    self.etc_prefs = {}
    user_mpi = mplib_content(spec, '${MPI_ARCH_PATH}')
    self.etc_config = {'CGAL': [('BOOST_ARCH_PATH', spec['boost'].prefix), ('CGAL_ARCH_PATH', spec['cgal'].prefix), ('LD_LIBRARY_PATH', foamAddLib(pkglib(spec['boost'], '${BOOST_ARCH_PATH}'), pkglib(spec['cgal'], '${CGAL_ARCH_PATH}')))], 'FFTW': [('FFTW_ARCH_PATH', spec['fftw'].prefix), ('LD_LIBRARY_PATH', foamAddLib(pkglib(spec['fftw'], '${BOOST_ARCH_PATH}')))], 'mpi-user': [('MPI_ARCH_PATH', spec['mpi'].prefix), ('LD_LIBRARY_PATH', foamAddLib(user_mpi['libdir'])), ('PATH', foamAddPath(user_mpi['bindir']))], 'scotch': {}, 'metis': {}, 'paraview': [], 'gperftools': []}
    if ('+scotch' in spec):
        self.etc_config['scotch'] = {'SCOTCH_ARCH_PATH': spec['scotch'].prefix, 'SCOTCH_VERSION': 'scotch-{0}'.format(spec['scotch'].version)}
    if ('+metis' in spec):
        self.etc_config['metis'] = {'METIS_ARCH_PATH': spec['metis'].prefix}
    if ('+paraview' in spec):
        pvMajor = 'paraview-{0}'.format(spec['paraview'].version.up_to(2))
        self.etc_config['paraview'] = [('ParaView_DIR', spec['paraview'].prefix), ('ParaView_INCLUDE_DIR', ('${ParaView_DIR}/include/' + pvMajor)), ('PV_PLUGIN_PATH', ('$FOAM_LIBBIN/' + pvMajor)), ('PATH', foamAddPath('${ParaView_DIR}/bin'))]
    if ('+mgridgen' in spec):
        self.etc_config['mgridgen'] = {'MGRIDGEN_ARCH_PATH': spec['parmgridgen'].prefix}
    if ('+zoltan' in spec):
        self.etc_config['zoltan'] = {'ZOLTAN_ARCH_PATH': spec['zoltan'].prefix}
    if self.etc_prefs:
        write_environ(self.etc_prefs, posix=join_path('etc', 'prefs.sh'), cshell=join_path('etc', 'prefs.csh'))
    for (component, subdict) in self.etc_config.items():
        write_environ(subdict, posix=join_path('etc', 'config.sh', component), cshell=join_path('etc', 'config.csh', component))
