]> git.donarmstrong.com Git - lilypond.git/blob - lexer-gcc-3.1.sh
GCC-3.1.1 fixes
[lilypond.git] / lexer-gcc-3.1.sh
1 #!/bin/sh
2 #
3 # script documenting fixes for flex-2.5.4 and gcc-3.1
4
5 includes="$HOME/usr/include /usr/local/include /usr/include"
6
7 for i in $includes; do
8     file=$i/FlexLexer.h
9     if [ -f "$file" ]; then
10         break
11     else
12         file=
13     fi
14 done
15
16 if [ -z "$file" ]; then
17     cat <<EOF
18 FlexLexer.h not found in $includes
19
20 Please install flex, or find and fix FlexLexer.h by hand.
21 EOF
22     exit 1
23 fi
24
25
26 if [ -n "$CONF" ]; then
27     CONFIGSUFFIX=-$CONF
28     ENABLECONFIG="--enable-config=$CONF"
29 fi    
30 outdir=out$CONFIGSUFFIX
31
32 echo -n "Copying and fixing $file... "
33 mkdir -p lily/$outdir
34 rm -f lily/$outdir/FlexLexer.h
35 sed -e 's/iostream.h/iostream/' \
36     -e 's/\<istream\>/std::istream/' \
37     -e 's/\<ostream\>/std::ostream/' \
38     $file > lily/$outdir/FlexLexer.h
39 echo "done"
40
41 file=lily/$outdir/lexer.cc
42 rm -f $file
43 make conf=$CONF -C lily $outdir/lexer.cc || exit 0
44
45 if [ -f "$file" ]; then
46     echo -n "Generating and fixing $file... "
47
48     mv $file $file.orig
49     sed -e 's/\<cin\>/std::cin/g' \
50         -e 's/\<cout\>/std::cout/g' \
51         -e 's/\<cerr\>/std::cerr/g' \
52         $file.orig > $file
53     echo "done"
54 fi
55
56 cat <<EOF
57
58 Remove config.cache before rerunning ./configure
59
60 Reconfigure doing something like:
61
62     CPPFLAGS=-I$(pwd)/lily/$outdir ./configure $ENABLECONFIG
63 EOF