#!/bin/sh
# Copyright (C) 2007 International Business Machines.
# All Rights Reserved.
# This file is distributed under the Common Public License.
# It is part of the BuildTools project in COIN-OR (www.coin-or.org)
#
## $Id: compile_f2c 352 2007-06-13 19:49:55Z andreasw $
#
# Author: Andreas Waechter IBM 2007-06-09
########################################################################
# Replace the following to the location of your vcf2c.lib library
# Note that there must be no space before and after "="
f2clibdir=/usr/local/lib/libf2c
#You should not have to change anything below this line
########################################################################
#Find out what the
if test `which cygpath | wc -l` -eq 0; then
CYGPATH_W=echo
else
CYGPATH_W='cygpath -w'
fi
if test "$F2C_CC" = ""; then
F2C_CC=cl
fi
f2clib=`$CYGPATH_W $f2clibdir/vcf2c.lib`
mainobj=`$CYGPATH_W $f2clibdir/main.obj`
# Get rid of the \
f2clib=`echo $f2clib | sed -e s'!\\\\!/!g'`
mainobj=`echo $mainobj | sed -e s'!\\\\!/!g'`
if test "$#" -eq 1 && test "$1" = "-FLIBS"; then
echo $f2clib
exit 0
fi
cincs="-I`$CYGPATH_W $f2clibdir`"
options=
incs=
fsrc=
objs=
outfile=
while test "$#" -gt 0
do
arg="$1"
shift
if test "$outfile" = next; then
outfile="$arg"
else
case "$arg" in
-I*)
incs="$incs $arg"
;;
-o)
if test "$outfile" != ""; then
echo "There are more than two -o options"
exit 1
fi
outfile=next
;;
-c)
options="$options $arg"
f2clib=
mainobj=
;;
-*)
options="$options $arg"
;;
*.[fF])
fsrc="$fsrc $arg"
;;
*)
objs="$objs $arg"
;;
esac
fi
done
if test "$fsrc" = "" && test "$objs" = "" ; then
echo "No source or object files given"
exit 1
fi
csrc=
if test "$fsrc" != ""; then
for f in $fsrc; do
cf=`echo $f | sed -e 's|.[fF]$|.c|' -e 's|.*/||'`
csrc="$csrc $cf"
done
echo f2c $incs $fsrc
f2c $incs $fsrc
f2c_status=$?
if test $f2c_status != 0; then
rm -f $csrc
exit $f2c_status
fi
fi
if test "$outfile"; then
cout="-o `$CYGPATH_W $outfile`"
fi
echo $F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib
$F2C_CC $options $cincs $csrc $objs $cout $mainobj $f2clib
cl_status=$?
rm -f $csrc
exit $cl_status
syntax highlighted by Code2HTML, v. 0.9.1