#!/bin/sh

error () {
echo "$@" >&2
exit 1;
}

for f in adi2cancel.c adi2hrecv.c adi2hsend.c adi2hssend.c adi2mpack.c adi2pack.c adi2probe.c adi2recv.c \
        adi2req.c adi2send.c adi2ssend.c chnodename.c chtick.c chtime.c cmnargs.c queue.c sbcnst2.c \
        attach.h calltrace.h chhetero.h cmnargs.h comm.h cookie.h datatype.h flow.h mpid_bind.h mpid_time.h mpimem.h \
        smpshort.c smppriv.c smpinit.c smprndv.c smpi.h \
        objtrace.h queue.h reqalloc.h  sbcnst2.h tr2.h bswap2.c chhetero.c calltrace.c objtrace.c tr2.c chflow.c chpackflow.c ; do  
  if test -r $f ; then
        :
  elif test -f  ../ch2/$f ; then 
        ln -s ../ch2/$f .
  elif test -f ../util/$f ; then
        ln -s ../util/$f .
  elif test -f ../ch_mpl/$f ; then
        ln -s ../ch_mpl/$f .
  else
      error "$f cannot be found"
  fi
done
if test -r mpiddev.h; then : ; else
 test -r ../ch2/mpiddevbase.h || error "../ch2/mpiddevbase.h cannot be found"
 ln -s ../ch2/mpiddevbase.h mpiddev.h
fi


