1import config.package 2import os 3 4class Configure(config.package.GNUPackage): 5 def __init__(self, framework): 6 config.package.GNUPackage.__init__(self, framework) 7 self.download = ['http://concurrencykit.org/releases/ck-0.4.5.tar.gz'] 8 self.functions = [] 9 self.includes = ['ck_spinlock.h'] 10 self.liblist = [['libck.a']] 11 self.downloadonWindows = 0 12 self.downloadfilename = 'ck' 13 14 def formGNUConfigureArgs(self): 15 # onfigure errors out on certain standard configure arguments 16 args = config.package.GNUPackage.formGNUConfigureArgs(self) 17 rejects = ['--disable-cxx','--disable-fortran', '--disable-fc','--disable-f77','--disable-f90'] 18 self.logPrint('MPICH is rejecting configure arguments '+str(rejects)) 19 return [arg for arg in args if not arg in rejects] 20 21 def checkForCorrectness(self): 22 include = '#include <ck_spinlock.h>' 23 body = 'ck_spinlock_t ck_spinlock; ck_spinlock_init(&ck_spinlock);ck_spinlock_lock(&ck_spinlock);ck_spinlock_unlock(&ck_spinlock);' 24 oldFlags = self.compilers.CPPFLAGS 25 oldLibs = self.compilers.LIBS 26 self.compilers.CPPFLAGS += ' '+self.headers.toString(self.include) 27 self.compilers.LIBS = self.libraries.toString(self.lib)+' '+self.compilers.LIBS 28 self.pushLanguage('C') 29 if not self.checkLink(include, body): 30 raise RuntimeError('Concurrencykit cannot be used') 31 self.popLanguage() 32 self.compilers.CPPFLAGS = oldFlags 33 self.compilers.LIBS = oldLibs 34 35 def configureLibrary(self): 36 '''Calls the regular package configureLibrary and then does an additional test needed''' 37 if 'with-'+self.package+'-shared' in self.argDB: 38 self.argDB['with-'+self.package] = 1 39 config.package.Package.configureLibrary(self) 40 self.executeTest(self.checkForCorrectness) 41