#! /bin/bash

# Mandatory requirement: gcc compilers 
# Run this script as SU to install fftw-3.3.4 in /share/apps/fftw-3.3.4/gnu
# works for CENTOS7 and Rocks Linux cluster

# fftw3 will then be installed in /share/apps/fftw-3.3.4/gnu

mkdir /share/apps/configrepo
cd /share/apps/configrepo
wget http://www2.fizik.usm.my/configrepo/howto/fftw/fftw-3.3.4.tar.gz
tar -zxvf fftw-3.3.4.tar.gz
cd fftw-3.3.4

make distclean

./configure --with-g77-wrappers --enable-mpi --enable-threads --enable-openmp CXX="/share/apps/mpich2/3.1.4/gcc/bin/mpicxx" CC="/share/apps/mpich2/3.1.4/gcc/bin/mpicc" CPP="/share/apps/mpich2/3.1.4/gcc/bin/mpic++ -E" CXXCPP="/share/apps/mpich2/3.1.4/gcc/bin/mpicxx -E" FC='gfortran' --prefix=/share/apps/fftw-3.3.4/gnu  F77=/share/apps/mpich2/3.1.4/gcc/bin/mpif77 FFLAGS="-I/share/apps/mpich2/3.1.4/gcc/include" LDFLAGS=-L/share/apps/mpich2/3.1.4/gcc/lib CPPFLAGS="-I/share/apps/mpich2/3.1.4/gcc/include" --enable-shared --enable-float

make
# make check  # as user
make install  #exectute this as su
## make installcheck  #execute this as user



