]> git.donarmstrong.com Git - lilypond.git/blob - lexer-gcc-3.1.sh
* buildscripts/output-distance.py (test_compare_signatures):
[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 FLEXLEXER=OK
8
9 if [ -z "$FLEXLEXER" ]; then
10
11 includes="$HOME/usr/include $PREFIX/include /usr/local/include /usr/include" 
12
13 for i in $includes; do
14     file=$i/FlexLexer.h
15     if [ -f "$file" ]; then
16         break
17     else
18         file=
19     fi
20 done
21
22 if [ -z "$file" ]; then
23     cat <<EOF
24 FlexLexer.h not found in $includes
25
26 Please install flex, or find and fix FlexLexer.h by hand.
27 EOF
28     exit 1
29 fi
30
31 fi # flexlexer
32
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
40
41 if [ -z "$FLEXLEXER" ]; then
42
43 echo -n "Copying and fixing $file... "
44 mkdir -p lily/$outdir
45 rm -f lily/$outdir/FlexLexer.h
46 perl -p -e 's/iostream.h/iostream/g;' \
47     -e 's/\bistream\b/std::istream/g;' \
48     -e 's/\bostream\b/std::ostream/' \
49     $file > lily/$outdir/FlexLexer.h
50 echo "done"
51
52 fi # flexlexer
53
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
59
60     mv $file $file.orig
61     perl -p -e 's/\bcin\b/std::cin/g;' \
62         -e 's/\bcout\b/std::cout/g;' \
63         -e 's/\bcerr\b/std::cerr/g' \
64         $file.orig > $file
65     echo "done"
66 fi
67
68 cat <<EOF
69
70 Remove config.cache before rerunning ./configure
71
72 Reconfigure, refix, and make doing something like:
73
74     rm -f config.cache
75     CPPFLAGS=-I$(pwd)/lily/$outdir ./configure $ENABLECONFIG
76     $SETCONF$0
77     make $setconf
78 EOF