]> git.donarmstrong.com Git - lilypond.git/blob - lexer-gcc-3.1.sh
*** empty log message ***
[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 set -e
6
7 includes="$HOME/usr/include /usr/local/include /usr/include"
8
9 for i in $includes; do
10     file=$i/FlexLexer.h
11     if [ -f "$file" ]; then
12         break
13     else
14         file=
15     fi
16 done
17
18 if [ -z "$file" ]; then
19     cat <<EOF
20 FlexLexer.h not found in $includes
21
22 Please install flex, or find and fix FlexLexer.h by hand.
23 EOF
24     exit 1
25 fi
26
27
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
35
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"
44
45
46 if [ -f GNUmakefile ]; then
47     echo -n "Generating and fixing $file... "
48
49     file=lily/$outdir/lexer.cc
50     rm -f $file
51     make conf=$CONF -C lily $outdir/lexer.cc > /dev/null 2>&1 || true
52
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"
59 fi
60
61 cat <<EOF
62
63 Remove config.cache before rerunning ./configure
64
65 Reconfigure, refix, and make doing something like:
66
67     rm -f config.cache
68     CPPFLAGS=-I$(pwd)/lily/$outdir ./configure $ENABLECONFIG
69     $SETCONF$0
70     make $setconf
71 EOF