| Line 5... |
Line 5... |
|
|
import petscconf
|
import petscconf
|
import log
|
import log
|
import check
|
import check
|
|
|
def Check(conf,directory):
|
def Check(conf,directory,libs):
|
|
|
if petscconf.PRECISION == 'single':
|
if petscconf.PRECISION == 'single':
|
sys.exit('ERROR: PRIMME does not support single precision.')
|
sys.exit('ERROR: PRIMME does not support single precision.')
|
|
|
if not directory:
|
|
sys.exit('ERROR: I cannot guess where the PRIMME directory is.')
|
|
|
|
functions = ['primme_set_method','primme_Free','primme_initialize']
|
functions = ['primme_set_method','primme_Free','primme_initialize']
|
if petscconf.SCALAR == 'real':
|
if petscconf.SCALAR == 'real':
|
functions += ['dprimme']
|
functions += ['dprimme']
|
include = 'DPRIMME'
|
include = 'DPRIMME'
|
lib = '-ldprimme'
|
lib = str.join(' ', libs) + ' -ldprimme'
|
else:
|
else:
|
functions += ['zprimme']
|
functions += ['zprimme']
|
include = 'ZPRIMME'
|
include = 'ZPRIMME'
|
lib = '-lzprimme'
|
lib = str.join(' ', libs) + ' -lzprimme'
|
|
|
|
if directory:
|
flags = ['-I' + directory + '/' + include]
|
directory = [directory]
|
libs = ['-L' + directory + ' ' + lib]
|
|
|
|
if check.Link(functions,[],flags+libs):
|
|
conf.write('SLEPC_HAVE_PRIMME = -DSLEPC_HAVE_PRIMME\n')
|
|
conf.write('PRIMME_LIB =' + str.join(' ', libs) + '\n')
|
|
conf.write('PRIMME_FLAGS =' + str.join(' ', flags) + '\n')
|
|
else:
|
else:
|
sys.exit('ERROR: PRIMME link test failed.')
|
directory = check.GenerateGuesses('PRIMME')
|
|
|
return flags + libs
|
for dir in directory:
|
|
flags = ['-I' + dir + '/' + include]
|
|
libs = ['-L' + dir + ' ' + lib]
|
|
if check.Link(functions,[],flags+libs):
|
|
conf.write('SLEPC_HAVE_PRIMME = -DSLEPC_HAVE_PRIMME\n')
|
|
conf.write('PRIMME_LIB =' + str.join(' ', libs) + '\n')
|
|
conf.write('PRIMME_FLAGS =' + str.join(' ', flags) + '\n')
|
|
return flags + libs
|
|
|
|
sys.exit('ERROR: PRIMME link test failed.')
|
|
|
|
|
|
|