1import config.base 2 3import os 4import re 5 6# The sorted() builtin is not available with python-2.3 7try: sorted 8except NameError: 9 def sorted(lst): 10 lst.sort() 11 return lst 12 13class Configure(config.base.Configure): 14 def __init__(self, framework): 15 config.base.Configure.__init__(self, framework) 16 self.headerPrefix = 'PETSC' 17 self.substPrefix = 'PETSC' 18 return 19 20 def __str2__(self): 21 desc = [] 22 desc.append('xxx=========================================================================xxx') 23 if self.getMakeMacro('PETSC_BUILD_USING_CMAKE'): 24 build_type = 'cmake build' 25 else: 26 build_type = 'legacy build' 27 desc.append(' Configure stage complete. Now build PETSc libraries with (%s):' % build_type) 28 desc.append(' make PETSC_DIR='+self.petscdir.dir+' PETSC_ARCH='+self.arch.arch+' all') 29 desc.append(' or (experimental with python):') 30 desc.append(' PETSC_DIR='+self.petscdir.dir+' PETSC_ARCH='+self.arch.arch+' ./config/builder.py') 31 desc.append('xxx=========================================================================xxx') 32 return '\n'.join(desc)+'\n' 33 34 def setupHelp(self, help): 35 import nargs 36 help.addArgument('PETSc', '-prefix=<dir>', nargs.Arg(None, '', 'Specifiy location to install PETSc (eg. /usr/local)')) 37 help.addArgument('Windows','-with-windows-graphics=<bool>', nargs.ArgBool(None, 1,'Enable check for Windows Graphics')) 38 help.addArgument('PETSc', '-with-default-arch=<bool>', nargs.ArgBool(None, 1, 'Allow using the last configured arch without setting PETSC_ARCH')) 39 help.addArgument('PETSc','-with-single-library=<bool>', nargs.ArgBool(None, 1,'Put all PETSc code into the single -lpetsc library')) 40 help.addArgument('PETSc', '-with-iphone=<bool>', nargs.ArgBool(None, 0, 'Build an iPhone version of PETSc')) 41 help.addArgument('CTetgen', '-with-ctetgen=<bool>', nargs.ArgBool(None, 0, 'Enable CTetgen support')) 42 return 43 44 def setupDependencies(self, framework): 45 config.base.Configure.setupDependencies(self, framework) 46 self.setCompilers = framework.require('config.setCompilers', self) 47 self.arch = framework.require('PETSc.utilities.arch', self.setCompilers) 48 self.petscdir = framework.require('PETSc.utilities.petscdir', self.setCompilers) 49 self.languages = framework.require('PETSc.utilities.languages',self.setCompilers) 50 self.debugging = framework.require('PETSc.utilities.debugging',self.setCompilers) 51 self.CHUD = framework.require('PETSc.utilities.CHUD', self) 52 self.compilers = framework.require('config.compilers', self) 53 self.types = framework.require('config.types', self) 54 self.headers = framework.require('config.headers', self) 55 self.functions = framework.require('config.functions', self) 56 self.libraries = framework.require('config.libraries', self) 57 if os.path.isdir(os.path.join('config', 'PETSc')): 58 for d in ['utilities', 'packages']: 59 for utility in os.listdir(os.path.join('config', 'PETSc', d)): 60 (utilityName, ext) = os.path.splitext(utility) 61 if not utilityName.startswith('.') and not utilityName.startswith('#') and ext == '.py' and not utilityName == '__init__': 62 utilityObj = self.framework.require('PETSc.'+d+'.'+utilityName, self) 63 utilityObj.headerPrefix = self.headerPrefix 64 utilityObj.archProvider = self.arch 65 utilityObj.languageProvider = self.languages 66 utilityObj.installDirProvider = self.petscdir 67 setattr(self, utilityName.lower(), utilityObj) 68 69 for package in config.packages.all: 70 if not package == 'PETSc': 71 packageObj = framework.require('config.packages.'+package, self) 72 packageObj.archProvider = self.arch 73 packageObj.languageProvider = self.languages 74 packageObj.installDirProvider = self.petscdir 75 setattr(self, package.lower(), packageObj) 76 # Force blaslapack to depend on scalarType so precision is set before BlasLapack is built 77 framework.require('PETSc.utilities.scalarTypes', self.f2cblaslapack) 78 self.f2cblaslapack.precisionProvider = self.scalartypes 79 framework.require('PETSc.utilities.scalarTypes', self.blaslapack) 80 self.blaslapack.precisionProvider = self.scalartypes 81 82 self.compilers.headerPrefix = self.headerPrefix 83 self.types.headerPrefix = self.headerPrefix 84 self.headers.headerPrefix = self.headerPrefix 85 self.functions.headerPrefix = self.headerPrefix 86 self.libraries.headerPrefix = self.headerPrefix 87 self.blaslapack.headerPrefix = self.headerPrefix 88 self.mpi.headerPrefix = self.headerPrefix 89 headersC = map(lambda name: name+'.h', ['dos', 'endian', 'fcntl', 'float', 'io', 'limits', 'malloc', 'pwd', 'search', 'strings', 90 'unistd', 'sys/sysinfo', 'machine/endian', 'sys/param', 'sys/procfs', 'sys/resource', 91 'sys/systeminfo', 'sys/times', 'sys/utsname','string', 'stdlib','memory', 92 'sys/socket','sys/wait','netinet/in','netdb','Direct','time','Ws2tcpip','sys/types', 93 'WindowsX', 'cxxabi','float','ieeefp','stdint','fenv','sched','pthread']) 94 functions = ['access', '_access', 'clock', 'drand48', 'getcwd', '_getcwd', 'getdomainname', 'gethostname', 'getpwuid', 95 'gettimeofday', 'getwd', 'memalign', 'memmove', 'mkstemp', 'popen', 'PXFGETARG', 'rand', 'getpagesize', 96 'readlink', 'realpath', 'sigaction', 'signal', 'sigset', 'usleep', 'sleep', '_sleep', 'socket', 97 'times', 'gethostbyname', 'uname','snprintf','_snprintf','_fullpath','lseek','_lseek','time','fork','stricmp', 98 'strcasecmp', 'bzero', 'dlopen', 'dlsym', 'dlclose', 'dlerror', 99 '_intel_fast_memcpy','_intel_fast_memset'] 100 libraries1 = [(['socket', 'nsl'], 'socket'), (['fpe'], 'handle_sigfpes')] 101 self.headers.headers.extend(headersC) 102 self.functions.functions.extend(functions) 103 self.libraries.libraries.extend(libraries1) 104 105 return 106 107 def Dump(self): 108 ''' Actually put the values into the configuration files ''' 109 # eventually everything between -- should be gone 110#----------------------------------------------------------------------------------------------------- 111 112 # Sometimes we need C compiler, even if built with C++ 113 self.setCompilers.pushLanguage('C') 114 self.addMakeMacro('CC_FLAGS',self.setCompilers.getCompilerFlags()) 115 self.setCompilers.popLanguage() 116 117 # C preprocessor values 118 self.addMakeMacro('CPP_FLAGS',self.setCompilers.CPPFLAGS+self.CHUD.CPPFLAGS) 119 120 # compiler values 121 self.setCompilers.pushLanguage(self.languages.clanguage) 122 self.addMakeMacro('PCC',self.setCompilers.getCompiler()) 123 self.addMakeMacro('PCC_FLAGS',self.setCompilers.getCompilerFlags()) 124 self.setCompilers.popLanguage() 125 # .o or .obj 126 self.addMakeMacro('CC_SUFFIX','o') 127 128 # executable linker values 129 self.setCompilers.pushLanguage(self.languages.clanguage) 130 pcc_linker = self.setCompilers.getLinker() 131 self.addMakeMacro('PCC_LINKER',pcc_linker) 132 self.addMakeMacro('PCC_LINKER_FLAGS',self.setCompilers.getLinkerFlags()) 133 self.setCompilers.popLanguage() 134 # '' for Unix, .exe for Windows 135 self.addMakeMacro('CC_LINKER_SUFFIX','') 136 137 if hasattr(self.compilers, 'FC'): 138 self.setCompilers.pushLanguage('FC') 139 # need FPPFLAGS in config/setCompilers 140 self.addDefine('HAVE_FORTRAN','1') 141 self.addMakeMacro('FPP_FLAGS',self.setCompilers.CPPFLAGS) 142 143 # compiler values 144 self.addMakeMacro('FC_FLAGS',self.setCompilers.getCompilerFlags()) 145 self.setCompilers.popLanguage() 146 # .o or .obj 147 self.addMakeMacro('FC_SUFFIX','o') 148 149 # executable linker values 150 self.setCompilers.pushLanguage('FC') 151 # Cannot have NAG f90 as the linker - so use pcc_linker as fc_linker 152 fc_linker = self.setCompilers.getLinker() 153 if config.setCompilers.Configure.isNAG(fc_linker): 154 self.addMakeMacro('FC_LINKER',pcc_linker) 155 else: 156 self.addMakeMacro('FC_LINKER',fc_linker) 157 self.addMakeMacro('FC_LINKER_FLAGS',self.setCompilers.getLinkerFlags()) 158 # apple requires this shared library linker flag on SOME versions of the os 159 if self.setCompilers.getLinkerFlags().find('-Wl,-commons,use_dylibs') > -1: 160 self.addMakeMacro('DARWIN_COMMONS_USE_DYLIBS',' -Wl,-commons,use_dylibs ') 161 self.setCompilers.popLanguage() 162 163 # F90 Modules 164 if self.setCompilers.fortranModuleIncludeFlag: 165 self.addMakeMacro('FC_MODULE_FLAG', self.setCompilers.fortranModuleIncludeFlag) 166 else: # for non-f90 compilers like g77 167 self.addMakeMacro('FC_MODULE_FLAG', '-I') 168 if self.setCompilers.fortranModuleIncludeFlag: 169 self.addMakeMacro('FC_MODULE_OUTPUT_FLAG', self.setCompilers.fortranModuleOutputFlag) 170 else: 171 self.addMakeMacro('FC','') 172 173 if hasattr(self.compilers, 'CUDAC'): 174 self.setCompilers.pushLanguage('CUDA') 175 self.addMakeMacro('CUDAC_FLAGS',self.setCompilers.getCompilerFlags()) 176 self.setCompilers.popLanguage() 177 178 # shared library linker values 179 self.setCompilers.pushLanguage(self.languages.clanguage) 180 # need to fix BuildSystem to collect these separately 181 self.addMakeMacro('SL_LINKER',self.setCompilers.getLinker()) 182 self.addMakeMacro('SL_LINKER_FLAGS','${PCC_LINKER_FLAGS}') 183 self.setCompilers.popLanguage() 184 # One of 'a', 'so', 'lib', 'dll', 'dylib' (perhaps others also?) depending on the library generator and architecture 185 # Note: . is not included in this macro, consistent with AR_LIB_SUFFIX 186 if self.setCompilers.sharedLibraryExt == self.setCompilers.AR_LIB_SUFFIX: 187 self.addMakeMacro('SL_LINKER_SUFFIX', '') 188 self.addDefine('SLSUFFIX','""') 189 else: 190 self.addMakeMacro('SL_LINKER_SUFFIX', self.setCompilers.sharedLibraryExt) 191 self.addDefine('SLSUFFIX','"'+self.setCompilers.sharedLibraryExt+'"') 192 193 self.addMakeMacro('SL_LINKER_LIBS','${PETSC_EXTERNAL_LIB_BASIC}') 194 195#----------------------------------------------------------------------------------------------------- 196 197 # CONLY or CPP. We should change the PETSc makefiles to do this better 198 if self.languages.clanguage == 'C': lang = 'CONLY' 199 else: lang = 'CXXONLY' 200 self.addMakeMacro('PETSC_LANGUAGE',lang) 201 202 # real or complex 203 self.addMakeMacro('PETSC_SCALAR',self.scalartypes.scalartype) 204 # double or float 205 self.addMakeMacro('PETSC_PRECISION',self.scalartypes.precision) 206 207 if self.framework.argDB['with-batch']: 208 self.addMakeMacro('PETSC_WITH_BATCH','1') 209 210 # Test for compiler-specific macros that need to be defined. 211 if self.setCompilers.isCrayVector('CC'): 212 self.addDefine('HAVE_CRAY_VECTOR','1') 213 214#----------------------------------------------------------------------------------------------------- 215 if self.functions.haveFunction('gethostbyname') and self.functions.haveFunction('socket') and self.headers.haveHeader('netinet/in.h'): 216 self.addDefine('USE_SOCKET_VIEWER','1') 217 if self.checkCompile('#include <sys/socket.h>','setsockopt(0,SOL_SOCKET,SO_REUSEADDR,0,0)'): 218 self.addDefine('HAVE_SO_REUSEADDR','1') 219 220#----------------------------------------------------------------------------------------------------- 221 # print include and lib for makefiles 222 if self.framework.argDB['with-ctetgen']: 223 self.addDefine('HAVE_CTETGEN', 1) 224 self.framework.packages.reverse() 225 includes = [os.path.join(self.petscdir.dir,'include'),os.path.join(self.petscdir.dir,self.arch.arch,'include')] 226 libs = [] 227 for i in self.framework.packages: 228 if i.useddirectly: 229 self.addDefine('HAVE_'+i.PACKAGE, 1) # ONLY list package if it is used directly by PETSc (and not only by another package) 230 if not isinstance(i.lib, list): 231 i.lib = [i.lib] 232 libs.extend(i.lib) 233 self.addMakeMacro(i.PACKAGE+'_LIB', self.libraries.toStringNoDupes(i.lib)) 234 if hasattr(i,'include'): 235 if not isinstance(i.include,list): 236 i.include = [i.include] 237 if not i.PACKAGE.lower() == 'valgrind': 238 includes.extend(i.include) 239 self.addMakeMacro(i.PACKAGE+'_INCLUDE',self.headers.toStringNoDupes(i.include)) 240 if self.framework.argDB['with-single-library']: 241 self.addMakeMacro('PETSC_WITH_EXTERNAL_LIB',self.libraries.toStringNoDupes(['-L'+os.path.join(self.petscdir.dir,self.arch.arch,'lib'),' -lpetsc']+libs+self.libraries.math+self.compilers.flibs+self.compilers.cxxlibs+self.compilers.LIBS.split(' '))+self.CHUD.LIBS) 242 self.addMakeMacro('PETSC_EXTERNAL_LIB_BASIC',self.libraries.toStringNoDupes(libs+self.libraries.math+self.compilers.flibs+self.compilers.cxxlibs+self.compilers.LIBS.split(' '))+self.CHUD.LIBS) 243 self.PETSC_EXTERNAL_LIB_BASIC = self.libraries.toStringNoDupes(libs+self.libraries.math+self.compilers.flibs+self.compilers.cxxlibs+self.compilers.LIBS.split(' '))+self.CHUD.LIBS 244 self.addMakeMacro('PETSC_CC_INCLUDES',self.headers.toStringNoDupes(includes)) 245 self.PETSC_CC_INCLUDES = self.headers.toStringNoDupes(includes) 246 if hasattr(self.compilers, 'FC'): 247 if self.compilers.fortranIsF90: 248 self.addMakeMacro('PETSC_FC_INCLUDES',self.headers.toStringNoDupes(includes,includes)) 249 else: 250 self.addMakeMacro('PETSC_FC_INCLUDES',self.headers.toStringNoDupes(includes)) 251 252 self.addMakeMacro('DESTDIR',self.installdir) 253 self.addDefine('LIB_DIR','"'+os.path.join(self.installdir,'lib')+'"') 254 255 if self.framework.argDB['with-single-library']: 256 # overrides the values set in conf/variables 257 self.addMakeMacro('LIBNAME','${INSTALL_LIB_DIR}/libpetsc.${AR_LIB_SUFFIX}') 258 self.addMakeMacro('SHLIBS','libpetsc') 259 self.addMakeMacro('PETSC_LIB_BASIC','-lpetsc') 260 self.addMakeMacro('PETSC_KSP_LIB_BASIC','-lpetsc') 261 self.addMakeMacro('PETSC_TS_LIB_BASIC','-lpetsc') 262 self.addDefine('USE_SINGLE_LIBRARY', '1') 263 if self.sharedlibraries.useShared: 264 self.addMakeMacro('PETSC_SYS_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 265 self.addMakeMacro('PETSC_VEC_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 266 self.addMakeMacro('PETSC_MAT_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 267 self.addMakeMacro('PETSC_DM_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 268 self.addMakeMacro('PETSC_KSP_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 269 self.addMakeMacro('PETSC_SNES_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 270 self.addMakeMacro('PETSC_TS_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 271 self.addMakeMacro('PETSC_CHARACTERISTIC_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 272 self.addMakeMacro('PETSC_LIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 273 self.addMakeMacro('PETSC_CONTRIB','${C_SH_LIB_PATH} ${PETSC_WITH_EXTERNAL_LIB}') 274 else: 275 self.addMakeMacro('PETSC_SYS_LIB','${PETSC_WITH_EXTERNAL_LIB}') 276 self.addMakeMacro('PETSC_VEC_LIB','${PETSC_WITH_EXTERNAL_LIB}') 277 self.addMakeMacro('PETSC_MAT_LIB','${PETSC_WITH_EXTERNAL_LIB}') 278 self.addMakeMacro('PETSC_DM_LIB','${PETSC_WITH_EXTERNAL_LIB}') 279 self.addMakeMacro('PETSC_KSP_LIB','${PETSC_WITH_EXTERNAL_LIB}') 280 self.addMakeMacro('PETSC_SNES_LIB','${PETSC_WITH_EXTERNAL_LIB}') 281 self.addMakeMacro('PETSC_TS_LIB','${PETSC_WITH_EXTERNAL_LIB}') 282 self.addMakeMacro('PETSC_CHARACTERISTIC_LIB','${PETSC_WITH_EXTERNAL_LIB}') 283 self.addMakeMacro('PETSC_LIB','${PETSC_WITH_EXTERNAL_LIB}') 284 self.addMakeMacro('PETSC_CONTRIB','${PETSC_WITH_EXTERNAL_LIB}') 285 286 if not os.path.exists(os.path.join(self.petscdir.dir,self.arch.arch,'lib')): 287 os.makedirs(os.path.join(self.petscdir.dir,self.arch.arch,'lib')) 288 289 # add a makefile entry for configure options 290 self.addMakeMacro('CONFIGURE_OPTIONS', self.framework.getOptionsString(['configModules', 'optionsModule']).replace('\"','\\"')) 291 return 292 293 def dumpConfigInfo(self): 294 import time 295 fd = file(os.path.join(self.arch.arch,'include','petscconfiginfo.h'),'w') 296 fd.write('static const char *petscconfigureruntime = "'+time.ctime(time.time())+'";\n') 297 fd.write('static const char *petscconfigureoptions = "'+self.framework.getOptionsString(['configModules', 'optionsModule']).replace('\"','\\"')+'";\n') 298 fd.close() 299 return 300 301 def dumpMachineInfo(self): 302 import platform 303 import time 304 import script 305 fd = file(os.path.join(self.arch.arch,'include','petscmachineinfo.h'),'w') 306 fd.write('static const char *petscmachineinfo = \"\\n\"\n') 307 fd.write('\"-----------------------------------------\\n\"\n') 308 fd.write('\"Libraries compiled on %s on %s \\n\"\n' % (time.ctime(time.time()), platform.node())) 309 fd.write('\"Machine characteristics: %s\\n\"\n' % (platform.platform())) 310 fd.write('\"Using PETSc directory: %s\\n\"\n' % (self.petscdir.dir)) 311 fd.write('\"Using PETSc arch: %s\\n\"\n' % (self.arch.arch)) 312 fd.write('\"-----------------------------------------\\n\";\n') 313 fd.write('static const char *petsccompilerinfo = \"\\n\"\n') 314 self.setCompilers.pushLanguage(self.languages.clanguage) 315 fd.write('\"Using C compiler: %s %s ${COPTFLAGS} ${CFLAGS}\\n\"\n' % (self.setCompilers.getCompiler(), self.setCompilers.getCompilerFlags())) 316 self.setCompilers.popLanguage() 317 if hasattr(self.compilers, 'FC'): 318 self.setCompilers.pushLanguage('FC') 319 fd.write('\"Using Fortran compiler: %s %s ${FOPTFLAGS} ${FFLAGS} %s\\n\"\n' % (self.setCompilers.getCompiler(), self.setCompilers.getCompilerFlags(), self.setCompilers.CPPFLAGS)) 320 self.setCompilers.popLanguage() 321 fd.write('\"-----------------------------------------\\n\";\n') 322 fd.write('static const char *petsccompilerflagsinfo = \"\\n\"\n') 323 fd.write('\"Using include paths: %s %s %s\\n\"\n' % ('-I'+os.path.join(self.petscdir.dir, self.arch.arch, 'include'), '-I'+os.path.join(self.petscdir.dir, 'include'), self.PETSC_CC_INCLUDES.replace('\\ ','\\\\ '))) 324 fd.write('\"-----------------------------------------\\n\";\n') 325 fd.write('static const char *petsclinkerinfo = \"\\n\"\n') 326 self.setCompilers.pushLanguage(self.languages.clanguage) 327 fd.write('\"Using C linker: %s\\n\"\n' % (self.setCompilers.getLinker())) 328 self.setCompilers.popLanguage() 329 if hasattr(self.compilers, 'FC'): 330 self.setCompilers.pushLanguage('FC') 331 fd.write('\"Using Fortran linker: %s\\n\"\n' % (self.setCompilers.getLinker())) 332 self.setCompilers.popLanguage() 333 if self.framework.argDB['with-single-library']: 334 petsclib = '-lpetsc' 335 else: 336 petsclib = '-lpetscts -lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetscsys' 337 fd.write('\"Using libraries: %s%s -L%s %s %s\\n\"\n' % (self.setCompilers.CSharedLinkerFlag, os.path.join(self.petscdir.dir, self.arch.arch, 'lib'), os.path.join(self.petscdir.dir, self.arch.arch, 'lib'), petsclib, self.PETSC_EXTERNAL_LIB_BASIC.replace('\\ ','\\\\ '))) 338 fd.write('\"-----------------------------------------\\n\";\n') 339 fd.close() 340 return 341 342 def dumpCMakeConfig(self): 343 ''' 344 Writes configuration-specific values to ${PETSC_ARCH}/conf/PETScConfig.cmake. 345 This file is private to PETSc and should not be included by third parties 346 (a suitable file can be produced later by CMake, but this is not it). 347 ''' 348 def cmakeset(fd,key,val=True): 349 if val == True: val = 'YES' 350 if val == False: val = 'NO' 351 fd.write('set (' + key + ' ' + val + ')\n') 352 def ensurelist(a): 353 if isinstance(a,list): 354 return a 355 else: 356 return [a] 357 def libpath(lib): 358 'Returns a search path if that is what this item provides, else "" which will be cleaned out later' 359 if not isinstance(lib,str): return '' 360 if lib.startswith('-L'): return lib[2:] 361 if lib.startswith('-R'): return lib[2:] 362 if lib.startswith('-Wl,-rpath,'): 363 # This case occurs when an external package needs a specific system library that is normally provided by the compiler. 364 # In other words, the -L path is builtin to the wrapper or compiler, here we provide it so that CMake can locate the 365 # corresponding library. 366 return lib[len('-Wl,-rpath,'):] 367 if lib.startswith('-'): return '' 368 return os.path.dirname(lib) 369 def cleanlib(lib): 370 'Returns a library name if that is what this item provides, else "" which will be cleaned out later' 371 if not isinstance(lib,str): return '' 372 if lib.startswith('-l'): return lib[2:] 373 if lib.startswith('-Wl') or lib.startswith('-L'): return '' 374 lib = os.path.splitext(os.path.basename(lib))[0] 375 if lib.startswith('lib'): return lib[3:] 376 return lib 377 def nub(lst): 378 'Return a list containing the first occurrence of each unique element' 379 unique = [] 380 for elem in lst: 381 if elem not in unique and elem != '': 382 unique.append(elem) 383 return unique 384 try: reversed # reversed was added in Python-2.4 385 except NameError: 386 def reversed(lst): return lst[::-1] 387 def nublast(lst): 388 'Return a list containing the last occurrence of each unique entry in a list' 389 return reversed(nub(reversed(lst))) 390 def cmakeexpand(varname): 391 return r'"${' + varname + r'}"' 392 def uniqextend(lst,new): 393 for x in ensurelist(new): 394 if x not in lst: 395 lst.append(x) 396 def notstandardinclude(path): 397 return path not in '/usr/include'.split() # /usr/local/include is not automatically included on FreeBSD 398 def writeMacroDefinitions(fd): 399 if self.mpi.usingMPIUni: 400 cmakeset(fd,'PETSC_HAVE_MPIUNI') 401 for pkg in self.framework.packages: 402 if pkg.useddirectly: 403 cmakeset(fd,'PETSC_HAVE_' + pkg.PACKAGE) 404 for pair in pkg.defines.items(): 405 if pair[0].startswith('HAVE_') and pair[1]: 406 cmakeset(fd, self.framework.getFullDefineName(pkg, pair[0]), pair[1]) 407 for name,val in self.functions.defines.items(): 408 cmakeset(fd,'PETSC_'+name,val) 409 for dct in [self.defines, self.libraryoptions.defines]: 410 for k,v in dct.items(): 411 if k.startswith('USE_'): 412 cmakeset(fd,'PETSC_' + k, v) 413 cmakeset(fd,'PETSC_USE_COMPLEX', self.scalartypes.scalartype == 'complex') 414 cmakeset(fd,'PETSC_USE_REAL_' + self.scalartypes.precision.upper()) 415 cmakeset(fd,'PETSC_CLANGUAGE_'+self.languages.clanguage) 416 if hasattr(self.compilers, 'FC'): 417 cmakeset(fd,'PETSC_HAVE_FORTRAN') 418 if self.compilers.fortranIsF90: 419 cmakeset(fd,'PETSC_USING_F90') 420 if self.sharedlibraries.useShared: 421 cmakeset(fd,'BUILD_SHARED_LIBS') 422 def writeBuildFlags(fd): 423 def extendby(lib): 424 libs = ensurelist(lib) 425 lib_paths.extend(map(libpath,libs)) 426 lib_libs.extend(map(cleanlib,libs)) 427 lib_paths = [] 428 lib_libs = [] 429 includes = [] 430 libvars = [] 431 for pkg in self.framework.packages: 432 extendby(pkg.lib) 433 uniqextend(includes,pkg.include) 434 extendby(self.libraries.math) 435 extendby(self.libraries.rt) 436 extendby(self.compilers.flibs) 437 extendby(self.compilers.cxxlibs) 438 extendby(self.compilers.LIBS.split()) 439 for libname in nublast(lib_libs): 440 libvar = 'PETSC_' + libname.upper() + '_LIB' 441 addpath = '' 442 for lpath in nublast(lib_paths): 443 addpath += '"' + str(lpath) + '" ' 444 fd.write('find_library (' + libvar + ' ' + libname + ' HINTS ' + addpath + ')\n') 445 libvars.append(libvar) 446 fd.write('mark_as_advanced (' + ' '.join(libvars) + ')\n') 447 fd.write('set (PETSC_PACKAGE_LIBS ' + ' '.join(map(cmakeexpand,libvars)) + ')\n') 448 includes = filter(notstandardinclude,includes) 449 fd.write('set (PETSC_PACKAGE_INCLUDES ' + ' '.join(map(lambda i: '"'+i+'"',includes)) + ')\n') 450 fd = open(os.path.join(self.arch.arch,'conf','PETScConfig.cmake'), 'w') 451 writeMacroDefinitions(fd) 452 writeBuildFlags(fd) 453 fd.close() 454 return 455 456 def dumpCMakeLists(self): 457 import sys 458 if sys.version_info >= (2,5): 459 import cmakegen 460 try: 461 cmakegen.main(self.petscdir.dir, log=self.framework.log) 462 except (OSError), e: 463 self.framework.logPrint('Generating CMakeLists.txt failed:\n' + str(e)) 464 else: 465 self.framework.logPrint('Skipping cmakegen due to old python version: ' +str(sys.version_info) ) 466 467 def cmakeBoot(self): 468 import sys 469 self.cmakeboot_success = False 470 if sys.version_info >= (2,5) and hasattr(self.cmake,'cmake'): 471 try: 472 import cmakeboot 473 self.cmakeboot_success = cmakeboot.main(petscdir=self.petscdir.dir,petscarch=self.arch.arch,argDB=self.argDB,framework=self.framework,log=self.framework.log) 474 except (OSError), e: 475 self.framework.logPrint('Booting CMake in PETSC_ARCH failed:\n' + str(e)) 476 except (ImportError, KeyError), e: 477 self.framework.logPrint('Importing cmakeboot failed:\n' + str(e)) 478 if self.cmakeboot_success: 479 if self.framework.argDB['with-cuda']: # Our CMake build does not support CUDA at this time 480 self.framework.logPrint('CMake configured successfully, but could not be used by default because --with-cuda was used\n') 481 elif hasattr(self.compilers, 'FC') and not self.setCompilers.fortranModuleOutputFlag: 482 self.framework.logPrint('CMake configured successfully, but could not be used by default because of missing fortranModuleOutputFlag\n') 483 else: 484 self.framework.logPrint('CMake configured successfully, using as default build\n') 485 self.addMakeMacro('PETSC_BUILD_USING_CMAKE',1) 486 else: 487 self.framework.logPrint('CMake configuration was unsuccessful\n') 488 else: 489 self.framework.logPrint('Skipping cmakeboot due to old python version: ' +str(sys.version_info) ) 490 return 491 492 def configurePrefetch(self): 493 '''Sees if there are any prefetch functions supported''' 494 if config.setCompilers.Configure.isSolaris() or self.framework.argDB['with-iphone']: 495 self.addDefine('Prefetch(a,b,c)', ' ') 496 return 497 self.pushLanguage(self.languages.clanguage) 498 if self.checkLink('#include <xmmintrin.h>', 'void *v = 0;_mm_prefetch((const char*)v,_MM_HINT_NTA);\n'): 499 # The Intel Intrinsics manual [1] specifies the prototype 500 # 501 # void _mm_prefetch(char const *a, int sel); 502 # 503 # but other vendors seem to insist on using subtly different 504 # prototypes, including void* for the pointer, and an enum for 505 # sel. These are both reasonable changes, but negatively impact 506 # portability. 507 # 508 # [1] http://software.intel.com/file/6373 509 self.addDefine('HAVE_XMMINTRIN_H', 1) 510 self.addDefine('Prefetch(a,b,c)', '_mm_prefetch((const char*)(a),(c))') 511 self.addDefine('PREFETCH_HINT_NTA', '_MM_HINT_NTA') 512 self.addDefine('PREFETCH_HINT_T0', '_MM_HINT_T0') 513 self.addDefine('PREFETCH_HINT_T1', '_MM_HINT_T1') 514 self.addDefine('PREFETCH_HINT_T2', '_MM_HINT_T2') 515 elif self.checkLink('#include <xmmintrin.h>', 'void *v = 0;_mm_prefetch(v,_MM_HINT_NTA);\n'): 516 self.addDefine('HAVE_XMMINTRIN_H', 1) 517 self.addDefine('Prefetch(a,b,c)', '_mm_prefetch((const void*)(a),(c))') 518 self.addDefine('PREFETCH_HINT_NTA', '_MM_HINT_NTA') 519 self.addDefine('PREFETCH_HINT_T0', '_MM_HINT_T0') 520 self.addDefine('PREFETCH_HINT_T1', '_MM_HINT_T1') 521 self.addDefine('PREFETCH_HINT_T2', '_MM_HINT_T2') 522 elif self.checkLink('', 'void *v = 0;__builtin_prefetch(v,0,0);\n'): 523 # From GCC docs: void __builtin_prefetch(const void *addr,int rw,int locality) 524 # 525 # The value of rw is a compile-time constant one or zero; one 526 # means that the prefetch is preparing for a write to the memory 527 # address and zero, the default, means that the prefetch is 528 # preparing for a read. The value locality must be a compile-time 529 # constant integer between zero and three. A value of zero means 530 # that the data has no temporal locality, so it need not be left 531 # in the cache after the access. A value of three means that the 532 # data has a high degree of temporal locality and should be left 533 # in all levels of cache possible. Values of one and two mean, 534 # respectively, a low or moderate degree of temporal locality. 535 # 536 # Here we adopt Intel's x86/x86-64 naming scheme for the locality 537 # hints. Using macros for these values in necessary since some 538 # compilers require an enum. 539 self.addDefine('Prefetch(a,b,c)', '__builtin_prefetch((a),(b),(c))') 540 self.addDefine('PREFETCH_HINT_NTA', '0') 541 self.addDefine('PREFETCH_HINT_T0', '3') 542 self.addDefine('PREFETCH_HINT_T1', '2') 543 self.addDefine('PREFETCH_HINT_T2', '1') 544 else: 545 self.addDefine('Prefetch(a,b,c)', ' ') 546 self.popLanguage() 547 548 def configureFeatureTestMacros(self): 549 '''Checks if certain feature test macros are support''' 550 if self.checkCompile('#define _POSIX_C_SOURCE 200112L\n#include <stdlib.h>',''): 551 self.addDefine('_POSIX_C_SOURCE_200112L', '1') 552 if self.checkCompile('#define _BSD_SOURCE\n#include<stdlib.h>',''): 553 self.addDefine('_BSD_SOURCE', '1') 554 555 def configureAtoll(self): 556 '''Checks if atoll exists''' 557 if self.checkCompile('#define _POSIX_C_SOURCE 200112L\n#include <stdlib.h>','long v = atoll("25")') or self.checkCompile ('#include <stdlib.h>','long v = atoll("25")'): 558 self.addDefine('HAVE_ATOLL', '1') 559 560 def configureUnused(self): 561 '''Sees if __attribute((unused)) is supported''' 562 if self.framework.argDB['with-iphone'] or self.framework.argDB['with-cuda']: 563 self.addDefine('UNUSED', ' ') 564 return 565 self.pushLanguage(self.languages.clanguage) 566 if self.checkLink('__attribute((unused)) static int myfunc(void){ return 1;}', 'int i = myfunc();\ntypedef void* atype;\n__attribute((unused)) atype a;\n'): 567 self.addDefine('UNUSED', '__attribute((unused))') 568 else: 569 self.addDefine('UNUSED', ' ') 570 self.popLanguage() 571 572 def configureExpect(self): 573 '''Sees if the __builtin_expect directive is supported''' 574 self.pushLanguage(self.languages.clanguage) 575 if self.checkLink('', 'if (__builtin_expect(0,1)) return 1;'): 576 self.addDefine('HAVE_BUILTIN_EXPECT', 1) 577 self.popLanguage() 578 579 def configureFunctionName(self): 580 '''Sees if the compiler supports __func__ or a variant. Falls back 581 on __FUNCT__ which PETSc source defines, but most users do not, thus 582 stack traces through user code are better when the compiler's 583 variant is used.''' 584 def getFunctionName(lang): 585 name = '__FUNCT__' 586 self.pushLanguage(lang) 587 if self.checkLink('', "if (__func__[0] != 'm') return 1;"): 588 name = '__func__' 589 elif self.checkLink('', "if (__FUNCTION__[0] != 'm') return 1;"): 590 name = '__FUNCTION__' 591 self.popLanguage() 592 return name 593 langs = [] 594 595 self.addDefine('FUNCTION_NAME_C', getFunctionName('C')) 596 if hasattr(self.compilers, 'CXX'): 597 self.addDefine('FUNCTION_NAME_CXX', getFunctionName('Cxx')) 598 else: 599 self.addDefine('FUNCTION_NAME_CXX', '__FUNCT__') 600 601 def configureIntptrt(self): 602 '''Determine what to use for uintptr_t''' 603 def staticAssertSizeMatchesVoidStar(inc,typename): 604 # The declaration is an error if either array size is negative. 605 # It should be okay to use an int that is too large, but it would be very unlikely for this to be the case 606 return self.checkCompile(inc, ('#define STATIC_ASSERT(cond) char negative_length_if_false[2*(!!(cond))-1]\n' 607 + 'STATIC_ASSERT(sizeof(void*) == sizeof(%s));'%typename)) 608 self.pushLanguage(self.languages.clanguage) 609 if self.checkCompile('#include <stdint.h>', 'int x; uintptr_t i = (uintptr_t)&x;'): 610 self.addDefine('UINTPTR_T', 'uintptr_t') 611 elif staticAssertSizeMatchesVoidStar('','unsigned long long'): 612 self.addDefine('UINTPTR_T', 'unsigned long long') 613 elif staticAssertSizeMatchesVoidStar('#include <stdlib.h>','size_t') or staticAssertSizeMatchesVoidStar('#include <string.h>', 'size_t'): 614 self.addDefine('UINTPTR_T', 'size_t') 615 elif staticAssertSizeMatchesVoidStar('','unsigned long'): 616 self.addDefine('UINTPTR_T', 'unsigned long') 617 elif staticAssertSizeMatchesVoidStar('','unsigned'): 618 self.addDefine('UINTPTR_T', 'unsigned') 619 else: 620 raise RuntimeError('Could not find any unsigned integer type matching void*') 621 self.popLanguage() 622 623 def configureInline(self): 624 '''Get a generic inline keyword, depending on the language''' 625 if self.languages.clanguage == 'C': 626 self.addDefine('STATIC_INLINE', self.compilers.cStaticInlineKeyword) 627 self.addDefine('RESTRICT', self.compilers.cRestrict) 628 elif self.languages.clanguage == 'Cxx': 629 self.addDefine('STATIC_INLINE', self.compilers.cxxStaticInlineKeyword) 630 self.addDefine('RESTRICT', self.compilers.cxxRestrict) 631 632 if self.checkCompile('#include <dlfcn.h>\n void *ptr = RTLD_DEFAULT;'): 633 self.addDefine('RTLD_DEFAULT','1') 634 return 635 636 def configureSolaris(self): 637 '''Solaris specific stuff''' 638 if os.path.isdir(os.path.join('/usr','ucblib')): 639 try: 640 flag = getattr(self.setCompilers, self.language[-1]+'SharedLinkerFlag') 641 except AttributeError: 642 flag = None 643 if flag is None: 644 self.compilers.LIBS += ' -L/usr/ucblib' 645 else: 646 self.compilers.LIBS += ' '+flag+'/usr/ucblib' 647 return 648 649 def configureLinux(self): 650 '''Linux specific stuff''' 651 # TODO: Test for this by mallocing an odd number of floats and checking the address 652 self.addDefine('HAVE_DOUBLE_ALIGN_MALLOC', 1) 653 return 654 655 def configureWin32(self): 656 '''Win32 non-cygwin specific stuff''' 657 kernel32=0 658 if self.libraries.add('Kernel32.lib','GetComputerName',prototype='#include <Windows.h>', call='GetComputerName(NULL,NULL);'): 659 self.addDefine('HAVE_WINDOWS_H',1) 660 self.addDefine('HAVE_GETCOMPUTERNAME',1) 661 kernel32=1 662 elif self.libraries.add('kernel32','GetComputerName',prototype='#include <Windows.h>', call='GetComputerName(NULL,NULL);'): 663 self.addDefine('HAVE_WINDOWS_H',1) 664 self.addDefine('HAVE_GETCOMPUTERNAME',1) 665 kernel32=1 666 if kernel32: 667 if self.framework.argDB['with-windows-graphics']: 668 self.addDefine('USE_WINDOWS_GRAPHICS',1) 669 if self.checkLink('#include <Windows.h>','LoadLibrary(0)'): 670 self.addDefine('HAVE_LOADLIBRARY',1) 671 if self.checkLink('#include <Windows.h>','GetProcAddress(0,0)'): 672 self.addDefine('HAVE_GETPROCADDRESS',1) 673 if self.checkLink('#include <Windows.h>','FreeLibrary(0)'): 674 self.addDefine('HAVE_FREELIBRARY',1) 675 if self.checkLink('#include <Windows.h>','GetLastError()'): 676 self.addDefine('HAVE_GETLASTERROR',1) 677 if self.checkLink('#include <Windows.h>','SetLastError(0)'): 678 self.addDefine('HAVE_SETLASTERROR',1) 679 if self.checkLink('#include <Windows.h>\n','QueryPerformanceCounter(0);\n'): 680 self.addDefine('USE_NT_TIME',1) 681 if self.libraries.add('Advapi32.lib','GetUserName',prototype='#include <Windows.h>', call='GetUserName(NULL,NULL);'): 682 self.addDefine('HAVE_GET_USER_NAME',1) 683 elif self.libraries.add('advapi32','GetUserName',prototype='#include <Windows.h>', call='GetUserName(NULL,NULL);'): 684 self.addDefine('HAVE_GET_USER_NAME',1) 685 686 if not self.libraries.add('User32.lib','GetDC',prototype='#include <Windows.h>',call='GetDC(0);'): 687 self.libraries.add('user32','GetDC',prototype='#include <Windows.h>',call='GetDC(0);') 688 if not self.libraries.add('Gdi32.lib','CreateCompatibleDC',prototype='#include <Windows.h>',call='CreateCompatibleDC(0);'): 689 self.libraries.add('gdi32','CreateCompatibleDC',prototype='#include <Windows.h>',call='CreateCompatibleDC(0);') 690 691 self.types.check('int32_t', 'int') 692 if not self.checkCompile('#include <sys/types.h>\n','uid_t u;\n'): 693 self.addTypedef('int', 'uid_t') 694 self.addTypedef('int', 'gid_t') 695 if not self.checkLink('#if defined(PETSC_HAVE_UNISTD_H)\n#include <unistd.h>\n#endif\n','int a=R_OK;\n'): 696 self.framework.addDefine('R_OK', '04') 697 self.framework.addDefine('W_OK', '02') 698 self.framework.addDefine('X_OK', '01') 699 if not self.checkLink('#include <sys/stat.h>\n','int a=0;\nif (S_ISDIR(a)){}\n'): 700 self.framework.addDefine('S_ISREG(a)', '(((a)&_S_IFMT) == _S_IFREG)') 701 self.framework.addDefine('S_ISDIR(a)', '(((a)&_S_IFMT) == _S_IFDIR)') 702 if self.checkCompile('#include <Windows.h>\n','LARGE_INTEGER a;\nDWORD b=a.u.HighPart;\n'): 703 self.addDefine('HAVE_LARGE_INTEGER_U',1) 704 705 # Windows requires a Binary file creation flag when creating/opening binary files. Is a better test in order? 706 if self.checkCompile('#include <Windows.h>\n#include <fcntl.h>\n', 'int flags = O_BINARY;'): 707 self.addDefine('HAVE_O_BINARY',1) 708 709 if self.compilers.CC.find('win32fe') >= 0: 710 self.addDefine('PATH_SEPARATOR','\';\'') 711 self.addDefine('DIR_SEPARATOR','\'\\\\\'') 712 self.addDefine('REPLACE_DIR_SEPARATOR','\'/\'') 713 self.addDefine('CANNOT_START_DEBUGGER',1) 714 else: 715 self.addDefine('PATH_SEPARATOR','\':\'') 716 self.addDefine('REPLACE_DIR_SEPARATOR','\'\\\\\'') 717 self.addDefine('DIR_SEPARATOR','\'/\'') 718 719 return 720 721#----------------------------------------------------------------------------------------------------- 722 def configureDefaultArch(self): 723 conffile = os.path.join('conf', 'petscvariables') 724 if self.framework.argDB['with-default-arch']: 725 fd = file(conffile, 'w') 726 fd.write('PETSC_ARCH='+self.arch.arch+'\n') 727 fd.write('PETSC_DIR='+self.petscdir.dir+'\n') 728 fd.write('include '+os.path.join(self.petscdir.dir,self.arch.arch,'conf','petscvariables')+'\n') 729 fd.close() 730 self.framework.actions.addArgument('PETSc', 'Build', 'Set default architecture to '+self.arch.arch+' in '+conffile) 731 elif os.path.isfile(conffile): 732 try: 733 os.unlink(conffile) 734 except: 735 raise RuntimeError('Unable to remove file '+conffile+'. Did a different user create it?') 736 return 737 738#----------------------------------------------------------------------------------------------------- 739 def configureScript(self): 740 '''Output a script in the conf directory which will reproduce the configuration''' 741 import nargs 742 import sys 743 scriptName = os.path.join(self.arch.arch,'conf', 'reconfigure-'+self.arch.arch+'.py') 744 args = dict([(nargs.Arg.parseArgument(arg)[0], arg) for arg in self.framework.clArgs]) 745 if 'configModules' in args: 746 if nargs.Arg.parseArgument(args['configModules'])[1] == 'PETSc.Configure': 747 del args['configModules'] 748 if 'optionsModule' in args: 749 if nargs.Arg.parseArgument(args['optionsModule'])[1] == 'PETSc.compilerOptions': 750 del args['optionsModule'] 751 if not 'PETSC_ARCH' in args: 752 args['PETSC_ARCH'] = 'PETSC_ARCH='+str(self.arch.arch) 753 f = file(scriptName, 'w') 754 f.write('#!'+sys.executable+'\n') 755 f.write('if __name__ == \'__main__\':\n') 756 f.write(' import sys\n') 757 f.write(' import os\n') 758 f.write(' sys.path.insert(0, os.path.abspath(\'config\'))\n') 759 f.write(' import configure\n') 760 # pretty print repr(args.values()) 761 f.write(' configure_options = [\n') 762 for itm in sorted(args.values()): 763 f.write(' \''+str(itm)+'\',\n') 764 f.write(' ]\n') 765 f.write(' configure.petsc_configure(configure_options)\n') 766 f.close() 767 try: 768 os.chmod(scriptName, 0775) 769 except OSError, e: 770 self.framework.logPrint('Unable to make reconfigure script executable:\n'+str(e)) 771 self.framework.actions.addArgument('PETSc', 'File creation', 'Created '+scriptName+' for automatic reconfiguration') 772 return 773 774 def configureInstall(self): 775 '''Setup the directories for installation''' 776 if self.framework.argDB['prefix']: 777 self.installdir = self.framework.argDB['prefix'] 778 self.addMakeRule('shared_install','',['-@echo "Now to install the libraries do:"',\ 779 '-@echo "make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} install"',\ 780 '-@echo "========================================="']) 781 else: 782 self.installdir = os.path.join(self.petscdir.dir,self.arch.arch) 783 self.addMakeRule('shared_install','',['-@echo "Now to check if the libraries are working do:"',\ 784 '-@echo "make PETSC_DIR=${PETSC_DIR} PETSC_ARCH=${PETSC_ARCH} test"',\ 785 '-@echo "========================================="']) 786 return 787 788 def configureGCOV(self): 789 if self.framework.argDB['with-gcov']: 790 self.addDefine('USE_GCOV','1') 791 return 792 793 def configureFortranFlush(self): 794 if hasattr(self.compilers, 'FC'): 795 for baseName in ['flush','flush_']: 796 if self.libraries.check('', baseName, otherLibs = self.compilers.flibs, fortranMangle = 1): 797 self.addDefine('HAVE_'+baseName.upper(), 1) 798 return 799 800 def postProcessPackages(self): 801 postPackages=[] 802 for i in self.framework.packages: 803 if hasattr(i,'postProcess'): postPackages.append(i) 804 if postPackages: 805 # prometheus needs petsc conf files. so attempt to create them early 806 self.framework.dumpConfFiles() 807 for i in postPackages: i.postProcess() 808 return 809 810 def configure(self): 811 if not os.path.samefile(self.petscdir.dir, os.getcwd()): 812 raise RuntimeError('Wrong PETSC_DIR option specified: '+str(self.petscdir.dir) + '\n Configure invoked in: '+os.path.realpath(os.getcwd())) 813 if self.framework.argDB['prefix'] and os.path.isdir(self.framework.argDB['prefix']) and os.path.samefile(self.framework.argDB['prefix'],self.petscdir.dir): 814 raise RuntimeError('Incorrect option --prefix='+self.framework.argDB['prefix']+' specified. It cannot be same as PETSC_DIR!') 815 if self.framework.argDB['prefix'] and os.path.isdir(self.framework.argDB['prefix']) and os.path.samefile(self.framework.argDB['prefix'],os.path.join(self.petscdir.dir,self.arch.arch)): 816 raise RuntimeError('Incorrect option --prefix='+self.framework.argDB['prefix']+' specified. It cannot be same as PETSC_DIR/PETSC_ARCH!') 817 self.framework.header = os.path.join(self.arch.arch,'include','petscconf.h') 818 self.framework.cHeader = os.path.join(self.arch.arch,'include','petscfix.h') 819 self.framework.makeMacroHeader = os.path.join(self.arch.arch,'conf','petscvariables') 820 self.framework.makeRuleHeader = os.path.join(self.arch.arch,'conf','petscrules') 821 if self.libraries.math is None: 822 raise RuntimeError('PETSc requires a functional math library. Please send configure.log to petsc-maint@mcs.anl.gov.') 823 if self.languages.clanguage == 'Cxx' and not hasattr(self.compilers, 'CXX'): 824 raise RuntimeError('Cannot set C language to C++ without a functional C++ compiler.') 825 self.executeTest(self.configureInline) 826 self.executeTest(self.configurePrefetch) 827 self.executeTest(self.configureUnused) 828 self.executeTest(self.configureExpect); 829 self.executeTest(self.configureFunctionName); 830 self.executeTest(self.configureIntptrt); 831 self.executeTest(self.configureSolaris) 832 self.executeTest(self.configureLinux) 833 self.executeTest(self.configureWin32) 834 self.executeTest(self.configureDefaultArch) 835 self.executeTest(self.configureScript) 836 self.executeTest(self.configureInstall) 837 self.executeTest(self.configureGCOV) 838 self.executeTest(self.configureFortranFlush) 839 self.executeTest(self.configureFeatureTestMacros) 840 self.executeTest(self.configureAtoll) 841 # dummy rules, always needed except for remote builds 842 self.addMakeRule('remote','') 843 self.addMakeRule('remoteclean','') 844 845 self.Dump() 846 self.dumpConfigInfo() 847 self.dumpMachineInfo() 848 self.postProcessPackages() 849 self.dumpCMakeConfig() 850 self.dumpCMakeLists() 851 self.cmakeBoot() 852 self.framework.log.write('================================================================================\n') 853 self.logClear() 854 return 855