rename.
[lilypond.git] / lexer-gcc-3.1.sh
blob944497fdf9f8725323aa1feee97d61ae2e62499a
1 #!/bin/sh
3 # script documenting fixes for flex-2.5.4 and gcc-3.1
5 set -e
7 includes="$HOME/usr/include /usr/local/include /usr/include"
9 for i in $includes; do
10 file=$i/FlexLexer.h
11 if [ -f "$file" ]; then
12 break
13 else
14 file=
16 done
18 if [ -z "$file" ]; then
19 cat <<EOF
20 FlexLexer.h not found in $includes
22 Please install flex, or find and fix FlexLexer.h by hand.
23 EOF
24 exit 1
28 if [ -n "$CONF" ]; then
29 CONFIGSUFFIX=-$CONF
30 SETCONF="CONF=$CONF "
31 setconf="conf=$CONF "
32 ENABLECONFIG="--enable-config=$CONF "
33 fi
34 outdir=out$CONFIGSUFFIX
36 echo -n "Copying and fixing $file... "
37 mkdir -p lily/$outdir
38 rm -f lily/$outdir/FlexLexer.h
39 sed -e 's/iostream.h/iostream/' \
40 -e 's/\<istream\>/std::istream/' \
41 -e 's/\<ostream\>/std::ostream/' \
42 $file > lily/$outdir/FlexLexer.h
43 echo "done"
46 if [ -f GNUmakefile ]; then
47 echo -n "Generating and fixing $file... "
49 file=lily/$outdir/lexer.cc
50 rm -f $file
51 make conf=$CONF -C lily $outdir/lexer.cc > /dev/null 2>&1 || true
53 mv $file $file.orig
54 sed -e 's/\<cin\>/std::cin/g' \
55 -e 's/\<cout\>/std::cout/g' \
56 -e 's/\<cerr\>/std::cerr/g' \
57 $file.orig > $file
58 echo "done"
61 cat <<EOF
63 Remove config.cache before rerunning ./configure
65 Reconfigure, refix, and make doing something like:
67 rm -f config.cache
68 CPPFLAGS=-I$(pwd)/lily/$outdir ./configure $ENABLECONFIG
69 $SETCONF$0
70 make $setconf
71 EOF