(Text markup): add comment about
[lilypond.git] / lexer-gcc-3.1.sh
blobc9b8a389d64bb86040c8857a37b12f37f541f7f3
1 #!/bin/sh
3 # script documenting fixes for flex-2.5.4 and gcc-3.1
5 set -e
7 FLEXLEXER=OK
9 if [ -z "$FLEXLEXER" ]; then
11 includes="$HOME/usr/include /usr/local/include /usr/include"
13 for i in $includes; do
14 file=$i/FlexLexer.h
15 if [ -f "$file" ]; then
16 break
17 else
18 file=
20 done
22 if [ -z "$file" ]; then
23 cat <<EOF
24 FlexLexer.h not found in $includes
26 Please install flex, or find and fix FlexLexer.h by hand.
27 EOF
28 exit 1
31 fi # flexlexer
33 if [ -n "$CONF" ]; then
34 CONFIGSUFFIX=-$CONF
35 SETCONF="CONF=$CONF "
36 setconf="conf=$CONF "
37 ENABLECONFIG="--enable-config=$CONF "
38 fi
39 outdir=out$CONFIGSUFFIX
41 if [ -z "$FLEXLEXER" ]; then
43 echo -n "Copying and fixing $file... "
44 mkdir -p lily/$outdir
45 rm -f lily/$outdir/FlexLexer.h
46 sed -e 's/iostream.h/iostream/' \
47 -e 's/\<istream\>/std::istream/' \
48 -e 's/\<ostream\>/std::ostream/' \
49 $file > lily/$outdir/FlexLexer.h
50 echo "done"
52 fi # flexlexer
54 if [ -f GNUmakefile ]; then
55 file=lily/$outdir/lexer.cc
56 echo -n "Generating and fixing $file... "
57 rm -f $file
58 make conf=$CONF -C lily $outdir/lexer.cc > /dev/null 2>&1 || true
60 mv $file $file.orig
61 sed -e 's/\<cin\>/std::cin/g' \
62 -e 's/\<cout\>/std::cout/g' \
63 -e 's/\<cerr\>/std::cerr/g' \
64 $file.orig > $file
65 echo "done"
68 cat <<EOF
70 Remove config.cache before rerunning ./configure
72 Reconfigure, refix, and make doing something like:
74 rm -f config.cache
75 CPPFLAGS=-I$(pwd)/lily/$outdir ./configure $ENABLECONFIG
76 $SETCONF$0
77 make $setconf
78 EOF