import config.base import os import re class Configure(config.base.Configure): def __init__(self, framework): config.base.Configure.__init__(self, framework) self.headerPrefix = 'GALE' self.substPrefix = 'GALE' # List of packages actually found self.framework.packages = [] return def __str__(self): return '' def setupHelp(self, help): import nargs # This should also do datadir, includedir, infodir, libexecdir, # localstatedir, sbindir, sharedstatedir, sysconfdir, and maybe # oldincludedir. But it should all be moved into BuildSystem proper. help.addArgument('Install', '-prefix=', nargs.Arg(None, '', 'Specify location to install Gale (eg. /usr/local)')) help.addArgument('Install', '-exec_prefix=', nargs.Arg(None, '${prefix}', 'Specify location to install Gale (eg. /usr/local)')) help.addArgument('Install', '-bindir=', nargs.Arg(None, '${exec_prefix}/bin', 'Specify location to install Gale binaries (eg. /usr/local/bin)')) help.addArgument('Install', '-libdir=', nargs.Arg(None, '${exec_prefix}/lib', 'Specify location to install Gale libraries (eg. /usr/local/lib)')) help.addArgument('Install', '-mandir=', nargs.Arg(None, '${exec_prefix}/man', 'Specify location to install Gale man pages (eg. /usr/local/man)')) help.addArgument('Install', '-includedir=', nargs.Arg(None, '${exec_prefix}/include', 'Specify location to install Gale header files (eg. /usr/local/include)')) return def setupDependencies(self, framework): config.base.Configure.setupDependencies(self, framework) self.setCompilers = framework.require('config.setCompilers', self) self.compilers = framework.require('config.compilers', self) self.libxml2 = framework.require('Gale.packages.libxml2', self) self.petsc = framework.require('Gale.packages.petsc', self) self.C99 = framework.require('Gale.packages.C99_functions',self) self.mpi = framework.require('config.packages.MPI', self) self.compilers.headerPrefix = self.headerPrefix return def configureDefaults(self): return def configureScript(self): '''Output a script reconfigure.py which will reproduce the configuration''' import nargs scriptName = 'reconfigure.py' args = dict([(nargs.Arg.parseArgument(arg)[0], arg) for arg in self.framework.clArgs]) if 'configModules' in args: del args['configModules'] if 'optionsModule' in args: del args['optionsModule'] f = file(scriptName, 'w') f.write('#!/usr/bin/env python\n') f.write('if __name__ == \'__main__\':\n') f.write(' import sys\n') f.write(' import configure\n') f.write(' configure_options = '+repr(args.values())+'\n') f.write(' configure.gale_configure(configure_options)\n') f.close() try: os.chmod(scriptName, 0775) except OSError, e: self.framework.logPrint('Unable to make reconfigure script executable:\n'+str(e)) self.framework.actions.addArgument('PETSc', 'File creation', 'Created '+scriptName+' for automatic reconfiguration') return def configureInstall(self): '''Setup the directories for installation''' if not self.framework.argDB['prefix']: self.framework.argDB['prefix']=os.getcwd() self.installdir = self.framework.argDB['prefix'] return def configureGCOV(self): if self.framework.argDB['with-gcov']: self.addDefine('USE_GCOV','1') return def configure(self): self.executeTest(self.configureScript) self.executeTest(self.configureInstall) self.executeTest(self.configureGCOV) self.framework.log.write('================================================================================\n') self.logClear() return