#!/bin/sh

# MPICH supports "-compile-info" and "-link-info".
#
# All OpenMPI versions support "-showme". Modern OpenMPI version also
# support "-showme:compile" and "-showme:link".
#
# We choose to behave like OpenMPI in this respect.

if [ "x$1" = "x-showme:compile" ]; then
    echo '-I/workspace/destdir/include'
    exit 0
elif [ "x$1" = "x-showme:link" ]; then
    echo '-L/workspace/destdir/lib -lmpitrampoline -ldl'
    exit 0
elif [ "x$1" = "x-showme" ]; then
    echo '-I/workspace/destdir/include -L/workspace/destdir/lib -lmpitrampoline -ldl'
    exit 0
fi

# if [ "x$1" = "x-compile-info" -o "x$1" = "x-link-info" ]; then
#     echo ${MPITRAMPOLINE_CC:-cc} -I/workspace/destdir/include -L/workspace/destdir/lib "$@" -lmpitrampoline -ldl
#     exit 0
# fi

exec ${MPITRAMPOLINE_CC:-cc} -I/workspace/destdir/include -L/workspace/destdir/lib "$@" -lmpitrampoline -ldl
