#!/bin/bash
#
# $Id: runm4,v 1.4 2006/08/16 21:15:49 frank Exp $
#
#set -x

if test $? = 1
then
echo "WRONG number of args!"
exit 1
fi

# try gpic or pic (on SUSE it is pic)

PIC=`type -a gpic 2> /dev/null | head -1 |awk '{print $3}'`
if test "$PIC" = "" ; then PIC=pic ; fi

F=`basename $1 .m4`

if test -r $F.eps
then
echo $F.eps already made
else
m4 circuit/libcct.m4 $F.m4 | $PIC -t  > $F.ltx
 echo $F: M4 and $PIC done now run LaTeX
./runltx $F.ltx
fi