If you want to compile MPI-based codes into babel-wrapped libraries that can be dynamically loaded, consistency of compiler and linker flags is critically important. The simplest way to maintain consistency with MPI codes is to use the MPI compiler wrappers (mpicc, mpicxx, mpif77/90) when building Babel. E.g. if your mpi compilers are in /opt/mpi/bin, configure babel like so:
./configure --prefix=$HOME/cca/install/babel-mpi \
FC=/opt/mpi/bin/mpif90 \
F77=/opt/mpi/bin/mpif77 \
CXX=/opt/mpi/bin/mpicxx \
CC=/opt/mpi/bin/mpicc
Note, however, that your MPI may not support dynamic loading correctly (or correctly for all the different languages) and this will probably only show up at final application link time.
We have real configuration examples-
odin.cs.indiana.edu-mpich-1.2.7-intel-9-babel