#!/bin/csh
# $Modified: Mon Dec 21 17:20:20 2009 by uwer $
# Modified by K. Hasegawa, 2010

if ( $1 == "gfortran" ) then
echo "Patch install.sh: Add call to FixCompiler_susy.csh"
ed install.sh <<EOF
110a
./FixCompiler_susy.csh runfix

.
wq
EOF

echo "Patch runall.sh to work with gfortran"
ed ./lib/sh/runall.sh << EOF
,s/1,2d/1,1d/g
wq
EOF

ed ./lib/patch/makefile << EOF
,s/-O -i4/-O/g
wq
EOF

echo "Call now ./install.sh to use SuperAutoDipole with gfortran"
exit
endif



if ( $#argv == 2 ) then

echo $2
ed -s $2 << EOF
H
g/f77/
,s/f77/gfortran/g
.
wq
EOF

ed -s $2 << EOF
H
,s/g77/gfortran/g
.
wq
EOF

exit

endif

if ( $1 == "runfix" ) then
foreach i ( `find . -name \*akefile\* ` )
 echo $i
 ./FixCompiler_susy.csh fix $i
end
exit
endif


echo "Usage: ./FixCompiler_susy.csh gfortran to prepare package to use gfortran"
