ack/first/fixlexlib

76 lines
1.2 KiB
Plaintext
Raw Normal View History

1987-03-16 23:53:04 +00:00
FL=succes
1987-03-17 00:13:03 +00:00
TRIES=
1987-03-16 23:53:04 +00:00
case X$# in
X0)
1987-03-17 00:13:03 +00:00
if (.Xlex) > /dev/null 2>&1
then
TRY=`.Xlex`
else TRY=-lln
fi
echo "trying to find your lex library ..."
1987-03-16 23:53:04 +00:00
cat > x.l <<'EOF'
%%
[A-Z] putchar(yytext[0]+'a'-'A');
EOF
1987-03-25 22:26:46 +00:00
if lex x.l > /dev/null 2>&1 && cc -c lex.yy.c > /dev/null 2>&1
1987-03-16 23:53:04 +00:00
then :
else echo "Sorry, your lex does not seem to work"
1987-03-16 23:53:04 +00:00
exit 2
fi
cat > trylib <<'EOF'
1987-03-25 22:26:46 +00:00
if cc lex.yy.o $1 > /dev/null 2>&1
1987-03-16 23:53:04 +00:00
then
rm -f lex.yy.* a.out
exit 0
else
exit 1
fi
EOF
1987-03-17 00:13:03 +00:00
if sh trylib $TRY
1987-03-16 23:53:04 +00:00
then
1987-03-17 00:13:03 +00:00
LEX=$TRY
1987-03-16 23:53:04 +00:00
else
1987-03-25 22:26:46 +00:00
exec $0 -ll $TRY
1987-03-16 23:53:04 +00:00
fi
;;
*) if sh trylib $1
then
LEX=$1
else
TRIES="$2 and $1"
FL=fail
fi
;;
esac
case X$FL in
Xfail) echo 'What option do I have to give to cc to get the LEX library?'
echo "I tried " $TRIES "but these don't seem to work."
echo -n 'LEX library option: '
1987-03-16 23:53:04 +00:00
if read ANSWER
then :
else echo "Sorry, got EOF while reading your answer"
1987-03-16 23:53:04 +00:00
exit 9
fi
exec $0 $ANSWER "$TRIES"
;;
Xsucces)
for i in ../util/opt ../util/cgg ../util/ncgg ../lang/occam/comp
do
( cd $i
1988-07-26 19:22:11 +00:00
cp Makefile makefile
ed - makefile << EOF
1987-03-16 23:53:04 +00:00
/^LEXLIB/c
LEXLIB = $LEX
.
w
q
EOF
)
done
;;
esac
1987-03-25 22:26:46 +00:00
rm -f x.l trylib lex.yy.*
1987-03-17 00:13:03 +00:00
echo echo "$LEX" > .Xlex
chmod +x .Xlex
1987-03-25 22:26:46 +00:00
echo "apparently, \"cc ... $LEX\" works"