6.25. Installing Flex-2.5.4a

Estimated build time:           1 minute
Estimated required disk space:  3MB

6.25.1. Installation of Flex

Install Flex by running the following commands:

./configure --prefix=/usr &&
make &&
make install

Some programs don't know about flex and try to find the lex program (flex is a (better) alternative for lex). So to please those few programs out there we'll create a lex script that calls flex and have it emulate lex.

Create a new file /usr/bin/lex by running the following:

cat > /usr/bin/lex << "EOF"
#!/bin/sh
# Begin /usr/bin/lex

exec /usr/bin/flex -l "$@"

# End /usr/bin/lex
EOF
chmod 755 /usr/bin/lex

6.25.2. Contents of flex-2.5.4a

6.25.3. Dependencies

Flex-2.5.4a needs the following to be installed:


bash: sh
binutils: ar, as, ld, ranlib
bison: bison
diffutils: cmp
fileutils: chmod, cp, install, ln, mv, rm, touch
gcc: cc1, collect2, cpp0, gcc
grep: egrep, grep
make: make
sed: sed
sh-utils: echo, hostname
textutils: cat, tr