#!/bin/sh

#
# condor_compile
# Todd Tannenbaum, Nov 1993
#
# Note: to use condor_compile you must move /bin/ld to 
#       /bin/ld.real and then put the condor_compile ld
#       into /bin/ld.
#

if [ $# -eq 0 ]; then
   echo
   echo "Usage: condor_compile <whatever you normally type to create your executeable>"
   echo 
   echo "condor_compile will create a binary for Condor.  The binary will"
   echo "end with a .condor extension.  For instance, if you normally compile"
   echo "by typing 'make myprog', just type 'condor_compile myprog'.  Likewise,"
   echo "if you compile with 'cc +O3 myfile.c -o myprog', just type"
   echo "'condor_compile cc +O3 myfile.c -o myprog', etc."
   echo
   exit
fi

ldsize=0
if [ -x /bin/ld ]; then
   ldsize=`ls -l /bin/ld | awk '{print $5}'`
fi

if [ -x /bin/ld.real -a $ldsize -lt 5000 ]; then
   CONDOR_COMPILE=yes
   export CONDOR_COMPILE
   exec $*
else
   echo
   echo "ERROR: looks like condor_compile not installed correctly (ld not"
   echo "       replaced).  Please see your Condor site administrator."
   echo
   exit 1
fi

