1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#!/bin/bash
OS=`uname`
ARCH=`uname -m`
VERSION="dev"
# standardise the OS and ARCH names
if [ "$OS" = "Darwin" ] ; then
OS="apple"
elif [ "$OS" = "Linux" ] ; then
OS="linux"
elif [ "$OS" = "SunOS" ] ; then
OS="sun"
else
echo "OS not supported"
exit 1
fi
if [ "$ARCH" = "x86" ] || [ "$ARCH" = "i686" ] || [ "$ARCH" = "i586" ] \
|| [ "$ARCH" = "i486" ] || [ "$ARCH" = "i386" ] ; then
ARCH="x86"
elif [ "$ARCH" = "Power Macintosh" ] ; then
ARCH="ppc"
elif [ "$ARCH" = "amd64" ] || [ "$ARCH" = "x86_64" ] ; then
ARCH="x86_64"
elif [ "$ARCH" = "sun4u" ] ; then
ARCH="sparc"
else
echo "ARCH not supported"
exit 1
fi
if [ "$OS" = "apple" ] ; then
CC="gcc -Wall"
CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/JavaVM.framework/Home/include"
CFLAGS="-fPIC -fno-common $CFLAGS"
LD="gcc -dynamiclib"
LDFLAGS="$LDFLAGS -framework JavaVM"
LIBPREPEND="lib"
LIBAPPEND="-apple-"${ARCH}".jnilib"
FC="g95"
FFLAGS="$CFLAGS"
LAPACK_INCLUDES="-I/System/Library/Frameworks/vecLib.framework/Headers"
# unfortunately OS X cannot build default multi-module libraries with fortran files
FORTRAN_LIBS="-lg95 -Wl,-single_module"
BLAS_LIBS="-framework veclib"
LAPACK_LIBS=""
elif [ "$OS" = "linux" ] ; then
CC="gcc -Wall"
CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include -I$JAVA_HOME/include/linux"
CFLAGS="-fPIC $CFLAGS"
LD="gcc -shared"
LDFLAGS="$LDFLAGS -L$JAVA_HOME/lib"
LIBPREPEND="lib"
LIBAPPEND="-linux-"${ARCH}".so"
FC="gfortran"
FFLAGS="$CFLAGS"
LAPACK_INCLUDES=""
FORTRAN_LIBS="-lgfortran"
BLAS_LIBS="-lblas"
LAPACK_LIBS="-llapack"
else
echo "OS not supported"
exit 1
fi
echo "Creating config for $OS $ARCH"
echo "CC=$CC" > Makefile.incl
echo "CPPFLAGS=$CPPFLAGS" >> Makefile.incl
echo "CFLAGS=$CFLAGS" >> Makefile.incl
echo "LD=$LD" >> Makefile.incl
echo "LDFLAGS=$LDFLAGS" >> Makefile.incl
echo "LIBPREPEND=$LIBPREPEND" >> Makefile.incl
echo "LIBAPPEND=$LIBAPPEND" >> Makefile.incl
echo "LAPACK_INCLUDES=$LAPACK_INCLUDES" >> Makefile.incl
echo "BLAS_LIBS=$BLAS_LIBS" >> Makefile.incl
echo "FORTRAN_LIBS=$FORTRAN_LIBS" >> Makefile.incl
echo "LAPACK_LIBS=$LAPACK_LIBS" >> Makefile.incl
echo "FC=$FC" >> Makefile.incl
echo "FFLAGS=$FFLAGS" >> Makefile.incl
echo "If you don't have a machine optimised BLAS/LAPACK, please see the comments in this file to compile your own, or install the atlas-base-dev package"
# check if g95 is installed
if [ ! -x "`which $FC 2>/dev/null`" ] ; then
echo "Fortran compiler required. Please install gfortran (sometimes called g95)."
fi
# if we are on a dev machine with a bin directory, use it, otherwise point to a jar
if [ -d "../bin" ] ; then
echo "JLAPACK_JNI_CP=../bin" >> Makefile.incl
else
echo "JLAPACK_JNI_CP=../netlib-java-$VERSION.jar:../lib/f2j/arpack-combined.jar" >> Makefile.incl
fi
# wget http://netlib.org/lapack/lapack-3.1.1.tgz
# tar xfz lapack-3.1.1.tgz
# cd lapack-3.1.1
# cp make.inc.example make.inc
# make FORTRAN="gfortran -fPIC" LOADER="gfortran -fPIC" OPTS="-fPIC -funroll-all-loops -O3" NOOPTS="-fPIC" lib
# cd ..
#
# wget http://belnet.dl.sourceforge.net/sourceforge/math-atlas/atlas3.7.30.tar.bz2
# tar xfj atlas3.7.30.tar.bz2
# cd ATLAS
# mkdir mybuild
# cd mybuild
# ../configure -Fa alg -fPIC --with-netlib-lapack=$PWD/../../lapack-3.1.1/lapack_LINUX.a
# make
# cd lib
# make ptshared
# cd ..
# sudo make install
# sudo install -m 755 lib/*.so /usr/local/atlas/lib/
#
# sudo ln -sf /usr/local/atlas/lib/libcblas.a /etc/alternatives/libblas-3.a
# sudo ln -sf /usr/local/atlas/lib/libcblas.so /etc/alternatives/libblas-3.so
# sudo ln -sf /usr/local/atlas/lib/liblapack.a /etc/alternatives/liblapack-3.a
# sudo ln -sf /usr/local/atlas/lib/liblapack.so /etc/alternatives/liblapack-3.so
# sudo ldconfig
echo "You must download the files"
echo " http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz"
echo " http://www.caam.rice.edu/software/ARPACK/SRC/patch.tar.gz"
echo "and extract them here if you want to have ARPACK support"
if [ ! -f arpack96.tar.gz ] ; then
wget http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz
fi
if [ ! -f patch.tar.gz ] ; then
wget http://www.caam.rice.edu/software/ARPACK/SRC/patch.tar.gz
fi
tar xfz arpack96.tar.gz
tar xfz patch.tar.gz
|