* ttftool/util.c (syserror): use errno for better error reporting.
[lilypond.git] / lexer-gcc-3.1.sh
blob1898f27eb8b5f9cefc9ba97d3806cd8a5de0430e
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 $PREFIX/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 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"
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 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"
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