- Version: 2.5.31
- Summary: Generates fast lexical analyzers, usually used with yacc or bison.
Prerequisites
Obtaining
Start by checking
http://freshmeat.net/projects/flex/
After a few links, you should be able to find the download page for
flex distributions.
As of the time of this writing, the current version was 2.5.31
cd /cis/src/languages
<... download flex-2.5.31.tar.bz2 ...>
bzip2 -dc flex-2.5.31.tar.bz2 |tar xf -
cd flex-2.5.31
Patching 2.5.31
Version 2.5.31 has some problems, it isn't written to standard C in some
places.
To compile it under a system like Solaris, you'll have to do some light
patching
(it's easy, though).
Hopefully, they'll fix these in the next version of flex.
patch 1 of 3
Make a backup copy of
filter.c, then edit it.
Look in the =filter_apply_chain_ function, around line 140 you should
find two calls to
fflush in a row, flushing
stdout and
stderr.
Insert
fflush (stdin); just before them, so you have three flushes in
a row of stdin, stdout, and stderr.
patch 2 of 3
Then, down around line 161, there are two
if statements that attempt
to call
fdopen and assign its result to
stdin and
stdout.
Ifdef or comment those four lines out.
patch 3 of 3
Finally, around line 187 of the same file, you'll see another
if statement
that's doing the same thing with
fdopen and
stdout.
Again, comment those two lines out.
Solaris
Ensure the
/gnu tree is near the
front of all relevant PATH variables
in your shell.
You can expect three test failure involving bison, if you haven't installed
it yet.
You can expect one more failure around
test-linedir-r if
awk isn't
gawk.
flex installs libraries, so be certain you use the vendor toolkits if
installing into
/cis.
PATH=/gnu/bin:${PATH} ; export PATH
./configure --prefix=/gnu
gmake
gmake check
gmake install
Documentation
cd doc; gmake dvi ps pdf; cd ..
mkdir -m 0775 /gnu/share/doc/flex
cp [A-Z]* doc/*.dvi doc/*.ps doc/*.pdf /gnu/share/doc/flex