BV strategy for SMT-EVAL
[cvc5.git] / contrib / get-antlr-3.4
1 #!/bin/bash
2 #
3 set -e
4
5 cd "$(dirname "$0")/.."
6
7 if ! [ -e src/parser/cvc/Cvc.g ]; then
8 echo "$(basename $0): I expect to be in the contrib/ of a CVC4 source tree," >&2
9 echo "but apparently:" >&2
10 echo >&2
11 echo " $(pwd)" >&2
12 echo >&2
13 echo "is not a CVC4 source tree ?!" >&2
14 exit 1
15 fi
16
17 function webget {
18 if which wget &>/dev/null; then
19 wget -c -O "$2" "$1"
20 elif which curl &>/dev/null; then
21 curl "$1" >"$2"
22 else
23 echo "Can't figure out how to download from web. Please install wget or curl." >&2
24 exit 1
25 fi
26 }
27
28 if [[ -z "${MACHINE_TYPE}" ]]; then
29 MACHINE_TYPE=`uname -m`
30 fi
31
32 set -x
33 mkdir -p antlr-3.4/share/java
34 mkdir -p antlr-3.4/bin
35 mkdir -p antlr-3.4/src
36 cd antlr-3.4
37 webget http://antlr3.org/download/antlr-3.4-complete.jar share/java/antlr-3.4-complete.jar
38 webget http://antlr3.org/download/C/libantlr3c-3.4.tar.gz src/libantlr3c-3.4.tar.gz
39 tee bin/antlr3 <<EOF
40 #!/bin/bash
41 export CLASSPATH=`pwd`/share/java/antlr-3.4-complete.jar:\$CLASSPATH
42 exec java org.antlr.Tool "\$@"
43 EOF
44 chmod a+x bin/antlr3
45 cd src
46 gunzip -f libantlr3c-3.4.tar.gz
47 tar xfv libantlr3c-3.4.tar
48 cd libantlr3c-3.4
49
50 if [ ${MACHINE_TYPE} == 'x86_64' ]; then
51 # 64-bit stuff here
52 ./configure --enable-64bit --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS
53 else
54 # 32-bit stuff here
55 ./configure --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS
56 fi
57
58 cp Makefile Makefile.orig
59 sed 's,^\(CFLAGS = .*\),\1 -fexceptions,' Makefile.orig > Makefile
60 make
61 make install
62 set +x
63 cd ../../..
64
65 echo
66 echo Invalidating generated parsers..
67 touch src/parser/*/*.g
68
69 if [ ${MACHINE_TYPE} == 'x86_64' ]; then
70 # 64-bit stuff here
71 echo ============== WARNING ====================
72 echo The script guessed that this machine is 64 bit.
73 echo If antlr should be built as 32 bit \(i.e. -m32\),
74 echo please rerun the script as
75 echo MACHINE_TYPE=\"x86\" ./get-antlr3.4
76
77 else
78 # 32-bit stuff here
79 echo ============== WARNING ====================
80 echo The script guessed that this machine is 32 bit.
81 echo If antlr should be built as 64 bit \(i.e. -m64\),
82 echo please rerun the script as
83 echo MACHINE_TYPE=\"x86_64\" ./get-antlr3.4
84 fi
85
86 echo
87 echo ===================== Now configure CVC4 with =====================
88 echo ./configure --with-antlr-dir=`pwd`/antlr-3.4 ANTLR=`pwd`/antlr-3.4/bin/antlr3