#!/bin/bash

##Configure with the following options:
##
## ./configure --prefix=/opt/R/R-2.8.1 --with-blas --with-lapack --enable-R-shlib r_arch=32
##
## other possible options:
## r_arch=32 and r_arch=64
## --enable-R-shlib
##
## export JAVA_HOME=/where/is/sun/java (/usr/lib/jvm/java-1.6-sun)
## above not necessary, use config.site instead.
##
##Then as root:
## VERSION=devel
## PRIORITY=100
VERSION=2.8.1
PRIORITY=281

update-alternatives --install /opt/bin/R R /opt/R/R-$VERSION/bin/R $PRIORITY \
  --slave /opt/man/man1/R.1 R.1 /opt/R/R-$VERSION/share/man/man1/R.1 \
  --slave /opt/info/R-FAQ.info.gz R-FAQ.info /opt/R/R-$VERSION/share/info/R-FAQ.info.gz \
  --slave /opt/info/R-admin.info.gz R-admin.info /opt/R/R-$VERSION/share/info/R-admin.info.gz \
  --slave /opt/info/R-data.info.gz R-data.info /opt/R/R-$VERSION/share/info/R-data.info.gz \
  --slave /opt/info/R-exts.info.gz R-exts.info /opt/R/R-$VERSION/share/info/R-exts.info.gz \
  --slave /opt/info/R-exts.info-1.gz R-exts.info-1 /opt/R/R-$VERSION/share/info/R-exts.info-1.gz \
  --slave /opt/info/R-exts.info-2.gz R-exts.info-2 /opt/R/R-$VERSION/share/info/R-exts.info-2.gz \
  --slave /opt/info/R-intro.info.gz R-intro.info /opt/R/R-$VERSION/share/info/R-intro.info.gz \
  --slave /opt/info/R-lang.info.gz R-lang.info /opt/R/R-$VERSION/share/info/R-lang.info.gz \
  --slave /opt/info/R-ints.info.gz R-ints.info /opt/R/R-$VERSION/share/info/R-ints.info.gz

ln -sf /opt/R/R-$VERSION/bin/R /opt/bin/R-$VERSION 
