#!/bin/bash

# Name of the fortran compiler
#-----------------------------

compiler=gfortran
#compiler=ifort

# To use parall version, put value to 1
#-------------------------------------
DIVA_PARALLEL=1
#

# Compilation flags
#-----------------

flags='-O3  -cpp   -DDIVAITERATIVE  ' # ' -DDIVABINARYFILESMESH -DDIVABINARYFILES '
#flags='-O0' 			# no optimization

flagscalc=' -O3 -cpp   -DDIVAITERATIVE -Wall -fbounds-check'
# -DALLODYZERO if ZEROS in ALLODY to be forced, time consuming...

if [ "$DIVA_PARALLEL" = 1 ]
then
echo Going to use parallel version
flagscalc='-O3 -cpp -fopenmp -DDIVAITERATIVE -DDIVAPARALLEL  ' # -DDIVABINARYFILESMESH -DDIVABINARYFILES ' #'
echo $flagscalc

fi

# Netcdf library
#---------------

ncconfigok=$(type -P nc-config | wc -l)
nfconfigok=$(type -P nf-config | wc -l)
echo nc-config $ncconfigok
echo nf-config $nfconfigok

if [ "$ncconfigok" != "0" ]
then
nclib=`nc-config --flibs`
compiler=`nc-config --fc`
else
   if [ "$nfconfigok" != "0" ]
   then
    nclib=`nf-config --flibs`
# or by hand
    nclib=/usr/lib/libnetcdff.dll.a
    echo $nclib
    compiler=`nf-config --fc`
   else
# put netcdlibrary by hand
   nclib=/usr/lib/libnetcdff.dll.a	
   fi
fi
# Use of Plplot (creation of scientific plots)
#--------------

Plplot=Plplot
Plplot=NoPlplot

# gui = 1 for Graphical User Interface programs to be compiled
gui=1

# netcdf = 1 for NetCDF programs to be compiled
netcdf=1
