cd src

if [ "$SAGE_DEBUG" = "yes" ]; then
    echo "Building a debug version of IML."
    export CFLAGS="-O0 -g $CFLAGS"
else
    export CFLAGS="-O3 -g $CFLAGS"
fi

if [ "$SAGE64" = "yes" ]; then
    echo "Building a 64-bit version of IML."
    CFLAGS="-m64 $CFLAGS"
fi

sdh_configure --enable-shared \
              --with-default="$SAGE_LOCAL" \
              --with-cblas="$(pkg-config --libs cblas)" \
              --with-cblas-include="$(pkg-config --cflags cblas)" \
              "$IML_CONFIGURE"
sdh_make
sdh_make_install
