#!/usr/bin/env bash

if [ "$SAGE_LOCAL" = "" ]; then
   echo "SAGE_LOCAL undefined ... exiting";
   echo "Maybe run 'sage -sh'?"
   exit 1
fi

PACKAGE_NAME="quantlib"

cd src

./configure --prefix="$SAGE_LOCAL" --with-boost-include="$SAGE_LOCAL/include/boost-1_34_1" --with-boost-lib="$SAGE_LOCAL/lib"
if [ $? -ne 0 ]; then
   echo "Error configuring $PACKAGE_NAME."
   exit 1
fi

make
if [ $? -ne 0 ]; then
   echo "Error building $PACKAGE_NAME."
   exit 1
fi

make install
if [ $? -ne 0 ]; then
   echo "Error installing $PACKAGE_NAME."
   exit 1
fi

