#This is the configuration file for the BigDFT installer
##This is a python script which is executed by the build suite
#
##Add the condition testing to run tests and includes PyYaml
conditions.add("no_upstream")
#List the module the this rcfile will build
modules = ['spred',]

def lapack():
   return ' --with-ext-linalg="-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_gf_lp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -lgomp -lpthread -lm -ldl -lstdc++" '

def conf_line():
  return " FC=mpif90 FCFLAGS='-O2 -g -fPIC -fopenmp -m64 -I${MKLROOT}/include' --enable-dynamic-libraries " + lapack()

def env_configuration():
    return conf_line() + "CC=mpicc CFLAGS='-O2 -g -fPIC' "
##example of the potentialities of the python syntax in this file
#def env_configuration():
#    return  """ FCFLAGS="-I${MKLROOT}/include -O2 -fPIC -qopenmp -g" FC="mpif90 -fc=ifort" CC=icc CFLAGS=-fPIC --with-ext-linalg="-L${MKLROOT}/lib/intel64 -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_lp64 -liomp5 -lpthread -lm -ldl -lstdc++" --with-gobject=yes  --enable-dynamic-libraries CXX=icpc"""
#the following command sets the environment variable to give these settings
#to all the modules
import os
os.environ['BIGDFT_CONFIGURE_FLAGS']=env_configuration()
#here follow the configuration instructions for the modules built
#we specify the configurations for the modules to customize the options if needed
autogenargs = env_configuration()
# Default moduleq for Irene are in use.

#build_policy = "all"
# Specific configure arguments for each module
module_autogenargs['futile'] = conf_line() + " CFLAGS='-O2 -g -fPIC' "
extra_prefixes=[os.path.abspath('../upstream-gnu-1.9.3/install')]
