From c3926efd938cfe791c93e74cc4acab017dc9c9ba Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Tue, 13 Nov 2012 19:12:00 +0000 Subject: [PATCH] introduced logic to use gfortran as default if ifort is not found --- code/Makefile | 12 ++++++------ code/setup/setup_code.py | 4 ++-- processing/setup/setup_processing.py | 7 ++++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code/Makefile b/code/Makefile index c0114d1f4..89ba53382 100644 --- a/code/Makefile +++ b/code/Makefile @@ -38,13 +38,13 @@ SHELL = /bin/sh # STANDARD_CHECK = checking for Fortran 2008, compiler dependend ######################################################################################## -#auto values will be set by setup_code.py -FFTWROOT := auto -IMKLROOT := auto -ACMLROOT := auto -LAPACKROOT := auto - +#any values will be overwritten by setup_code.py +FFTWROOT ?= auto +IMKLROOT ?= auto +ACMLROOT ?= auto +LAPACKROOT ?= auto +# if F90 empty: ifort if present, otherwise gfortran ifeq ($(wildcard ifort),) F90?=gfortran else diff --git a/code/setup/setup_code.py b/code/setup/setup_code.py index 33b3ab850..4112bbb04 100755 --- a/code/setup/setup_code.py +++ b/code/setup/setup_code.py @@ -76,13 +76,13 @@ content = makefile.readlines() makefile.close() makefile = open(os.path.join(baseDir,'Makefile'),'w') for line in content: - m = re.match(r'(FFTW|IMKL|ACML|LAPACK)ROOT\s*:?=',line) + m = re.match(r'(FFTW|IMKL|ACML|LAPACK)ROOT\s*\?=',line) if m: if m.group(1).lower() in damaskEnv.pathInfo: substitution = damaskEnv.pathInfo[m.group(1).lower()] else: substitution = '' - line = '%sROOT := %s\n'%(m.group(1),substitution) + line = '%sROOT ?= %s\n'%(m.group(1),substitution) makefile.write(line) makefile.close() diff --git a/processing/setup/setup_processing.py b/processing/setup/setup_processing.py index 519677909..f2291c73a 100755 --- a/processing/setup/setup_processing.py +++ b/processing/setup/setup_processing.py @@ -2,7 +2,7 @@ # Makes postprocessing routines acessible from everywhere. -import os,sys,glob,string +import os,sys,glob,string,subprocess from damask import Environment from optparse import OptionParser, Option @@ -41,8 +41,9 @@ compilers = ['intel','ifort','intel32','gfortran','gnu95'] parser.add_option('--F90', '--f90', dest='compiler', type='string', \ help='name of F90 compiler') - -parser.set_defaults(compiler = 'ifort') +parser.set_defaults(compiler = {True:'ifort',False:'gfortran'}[\ + subprocess.call(['which', 'ifort'],\ + stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0]) (options,filenames) = parser.parse_args() if options.compiler not in compilers: