VSL Dependencies version 1.3

======================= Overview =======================

This distribution contains all the dependencies for SARL and is organized as follows.

.\lib contains java libraries and dynamic libraries, which are listed in the following:

ANTLR v3.4
clj-ds v1.2
CVC3 v2.4.1
CVC4 v1.2
GLPK v4.48 for osx, v4.45 for linux
GMP v5.1.2 for osx, v5.0.2 for linux
Hamcrest-core v1.3
Jsr166y
Junit v4.11
PerfAnal
Pcollections v2.1.2

Note: the instructions for building CVC3 and CVC4 from source could be found later in this document.

.\licenses contains the licenses for each library in .\lib.

.\src contains java source code for some of the libraries in .\lib and is included here for debugging purposes.


======================= Change from version 1.2 ========================
Add the source jar file for antlr-runtime-3.4.


======================= Install CVC3 from source =======================

1. Start by downloading 
	http://www.cs.nyu.edu/acsys/cvc3/releases/2.4.1/cvc3-2.4.1.tar.gz,
   unzip and untar. 

2. Download dependencies for CVC3.

  2.1 On linux, make sure you have flex, bison, libgmp10, and openjdk-7-jdk.
      You can get these by the following command:

	$sudo apt-get install flex bison libgmp10 libgmp-dev openjdk-7-jdk

  2.2 On OS X, use the App Store to install XCode, and use XCode to install the Developer Tools.

3. Configure CVC3. Change into the CVC3 directory and run the configure script as follows:
	
	for 32-bit linux:
	$./configure CXXFLAGS=-m32 --enable-dynamic --enable-java --with-java-home=/usr/lib/jvm/java-7-openjdk-i386

	for 64-bit linux:
	$./configure CXXFLAGS=-m64 --enable-dynamic --enable-java --with-java-home=/usr/lib/jvm/java-7-openjdk-amd64

	for 64-bit OS X:
	$./configure CXXFLAGS=-m64 --enable-dynamic --enable-java --with-java-home=/System/Library/Frameworks/JavaVM.framework/Versions/Current --with-java-includes=/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers

4. Install CVC3 by "make".



======================= Install CVC4 from source =======================

1. Download CVC4 from http://cvc4.cs.nyu.edu/builds/src/cvc4-1.2.tar.gz, unzip and put it at $CVC4SrcFolder.

2. Install dependencies:
	a. Java 7 SDK
	b. g++
	c. gmp
	d. Boost (and Boost thread)
	e. swig

   2.1 For 64-bit mac osx Mavericks users, follow the instructions below. 
       
	2.1.1 Download and install MacPorts from http://www.macports.org/install.php
	
	2.1.2 Download and install Java from http://www.oracle.com/technetwork/java/javase/downloads/
	
	2.1.3 Run the following command to install 2.c-2.e.
	
	$sudo port install gmp boost swig swig-java 

	Note: 
	g++ is installed in Mavericks by default;
	the boost port in MacPorts already includes Boost thread library;
	swig-java is required, otherwise there will be an error "Error: Unable to find 'java.swg'".

   2.2 For 32/64-bit linux users, run the following command.

	 $sudo apt-get install openjdk-7-jdk g++ libgmp-dev libboost-dev libboost-thread-dev swig
	
	Note:
	For linux, Boost thread library needs to be installed 4	separately.

3. Install ANTLR3.
   3.1 For 64-bit mac osx Mavericks and 32-bit linux users, run the following commands as described in CVC4's manual ($CVC4SrcFolder/INSTALL or http://cvc4.cs.nyu.edu/wiki/Building_CVC4_from_source).
	
	$cd $CVC4SrcFolder/contrib
	$./get-antlr-3.4

   3.2 For 64-bit linux users, antlr should be configured with pic. To do this, ./get-antlr-3.4 script needs to be modified. First, open the file using a text editor by
	
	$gedit $CVC4SrcFolder/contrib/get-antlr-3.4

	Second, add "--with-pic" to the ./configure command for 64-bit configuration, i.e., to modify the following lines

	if [ ${MACHINE_TYPE} == 'x86_64' ]; then
  	  # 64-bit stuff here
-          ./configure --enable-64bit --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS
        else

	to be
	
	if [ ${MACHINE_TYPE} == 'x86_64' ]; then
  	  # 64-bit stuff here
+          ./configure --enable-64bit --with-pic --disable-shared --disable-antlrdebug --prefix=`pwd`/../.. $ANTLR_CONFIGURE_ARGS
        else
	
	Finally, run ./get-antlr-3.4 script.

	$cd $CVC4SrcFolder/contrib
	$./get-antlr-3.4

4. Configure CVC4.

   4.1 For 64-bit mac osx Mavericks users, run the following command.

	$cd $CVC4SrcFolder
	$./configure --with-antlr-dir=$CVC4SrcFolder/antlr-3.4 ANTLR=$CVC4SrcFolder/antlr-3.4/bin/antlr3 --enable-language-bindings=java LDFLAGS=-L/opt/local/lib JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ --with-glpk CFLAGS=-I/opt/local/include CPPFLAGS=-I/opt/local/include CXXFLAGS=-stdlib=libstdc++ --disable-debug-symbols

   4.2 For 64-bit linux users, run the following command.

	$cd $CVC4SrcFolder
	$./configure CXXFLAGS=-m64 --with-antlr-dir=$CVC4SrcFolder/antlr-3.4 ANTLR=$CVC4SrcFolder/antlr-3.4/bin/antlr3 --enable-language-bindings=java JAVA_CPPFLAGS=-I/usr/lib/jvm/java-7-openjdk-amd64/include --disable-debug-symbols 

   4.3 For 32-bit linux users, run the following command.

	$cd $CVC4SrcFolder
	$./configure CXXFLAGS=-m32 --with-antlr-dir=$CVC4SrcFolder/antlr-3.4 ANTLR=$CVC4SrcFolder/antlr-3.4/bin/antlr3 --enable-language-bindings=java JAVA_CPPFLAGS=-I/usr/lib/jvm/java-7-openjdk-i386/include --disable-debug-symbols 

   Note: for linux users, "--disable-debug-symbols" must be used, otherwise the generated libcvc4 libraries would be very huge (around 200 mb).

5. (Optional) Enable multithreaded mode: to enable multithreaded mode, add "--with-portfolio" to the options in ./configure command in step 3. This step can be skipped if multithreaded mode is not needed.
   
   Important notes for 64-bit mac osx Mavericks users: since in osx both boost and boost-thread are integrated in one port, $CVC4SrcFolder/config/boost.m4 needs to be modified, otherwise the installer might not be able to find Boost thread library. The trick is to open $CVC4SrcFolder/config/boost.m4, and change the line:

-        Boost_lib_LDFLAGS="-L$boost_ldpath -Wl,-R$boost_ldpath"

to:

+        Boost_lib_LDFLAGS="-L$boost_ldpath"

   And then run automake and autoconf to rebuild the configure script. If automake/autoconf is not found, it can be installed by "sudo port automake autoconf".

   Finally, repeat step 3 with the additional option "--with-portfolio".

6. Install CVC4 by "make".
