Commits

Jed Brown  committed 15ac296 Merge

Merge branch 'maint' of buildsystem into maint

  • Participants
  • Parent commits 372c83b, 7d86a4c

Comments (0)

Files changed (34)

File config/BuildSystem/.hgtags

 08d1a842beeb60886d02ca2e9fb49deac27b64cc release-2.3.3
 e2ee09c1d244ce7c7009364bec161d3a4a71a10b release-3.0.0
 e7987146764be982e7ab2822301e836c54438a20 release-3.1
+16a648a4b95789443cb53c4a66689a0d9ba28a7b release-3.2
+c8d64c3790acea22054ea2d3f57ebb6bbddcfc13 release-3.3

File config/BuildSystem/build/framework.py

 import nargs
 
 if not hasattr(sys, 'version_info'):
-  raise RuntimeError('You must have Python version 2.2 or higher to run the build system')
+  raise RuntimeError('You must have Python version 2.4 or higher to run the build system')
 
 class Framework(base.Base):
   '''This is the base class for all user make modules'''

File config/BuildSystem/config/base.py

     self.makeMacros[name] = value
     return
 
+  def getMakeMacro(self, name):
+    return self.makeMacros.get(name)
+
   def delMakeMacro(self, name):
     '''Designate that "name" should be deleted (never put in) configuration header'''
     self.framework.logPrint('Deleting "'+name+'"')
   def outputRun(self, includes, body, cleanup = 1, defaultOutputArg = '', executor = None):
     if not self.checkLink(includes, body, cleanup = 0): return ('', 1)
     if not os.path.isfile(self.linkerObj) or not os.access(self.linkerObj, os.X_OK):
-      self.framework.log.write('ERROR while running executable: '+self.linkerObj+' is not executable')
+      self.framework.log.write('ERROR while running executable: '+self.linkerObj+' is not executable\n')
       return ('', 1)
     if self.framework.argDB['with-batch']:
       if defaultOutputArg:

File config/BuildSystem/config/compilerFlags.py

           if not bopt == '' and self.getOptionalFlagsName(language) in self.framework.argDB:
             # treat user supplied options as single option - as it could include options separated by spaces '-tp k8-64'
             flags = [self.framework.argDB[self.getOptionalFlagsName(language)]]
-          elif bopt == '' and self.getCompilerFlagsName(language) in self.framework.argDB and self.framework.argDB[self.getCompilerFlagsName(language)] != '':
+          elif bopt == '' and self.getCompilerFlagsName(language) in self.framework.argDB:
             self.logPrint('Ignoring default options which were overridden using --'+self.getCompilerFlagsName(language)+ ' ' + self.framework.argDB[self.getCompilerFlagsName(language)])
             flags = []
           else:
             flags = options.getCompilerFlags(language, self.setCompilers.getCompiler(), bopt)
           for testFlag in flags:
+            if isinstance(testFlag,tuple):
+              testFlag = ' '.join(testFlag)
             try:
               self.framework.logPrint('Trying '+language+' compiler flag '+testFlag)
               self.setCompilers.addCompilerFlag(testFlag)

File config/BuildSystem/config/compilerOptions.py

     if config.setCompilers.Configure.isGNU(compiler) or config.setCompilers.Configure.isClang(compiler):
       if bopt == '':
         flags.extend(['-Wall', '-Wwrite-strings', '-Wno-strict-aliasing','-Wno-unknown-pragmas'])
+        if self.framework.argDB['with-visibility']:
+          flags.extend(['-fvisibility=hidden'])
       elif bopt == 'g':
         if self.framework.argDB['with-gcov']:
           flags.extend(['-fprofile-arcs', '-ftest-coverage'])
-        flags.append('-g3')
+        if self.framework.argDB['with-cuda']:
+          flags.append('-g') #cuda 4.1 with sm_20 is buggy with -g3
+        else:
+          flags.append('-g3')
+        flags.append('-fno-inline')
+        flags.append('-O0')
       elif bopt == 'O':
         flags.append('-O')
     else:
       if config.setCompilers.Configure.isIntel(compiler) and not compiler.find('win32fe') >=0:
         if bopt == '':
           flags.append('-wd1572')
-          flags.append('-Qoption,cpp,--extended_float_type')
+          # next one fails in OpenMP build and we don't use it anyway so remove
+          # flags.append('-Qoption,cpp,--extended_float_type')
         elif bopt == 'g':
           flags.append('-g')
         elif bopt == 'O':
     if config.setCompilers.Configure.isGNU(compiler) or config.setCompilers.Configure.isClang(compiler):
       if bopt == '':
         flags.extend(['-Wall', '-Wwrite-strings', '-Wno-strict-aliasing','-Wno-unknown-pragmas'])
+        # The option below would prevent warnings about compiling C as C++ being deprecated, but it causes Clang to SEGV, http://llvm.org/bugs/show_bug.cgi?id=12924
+        # flags.extend([('-x','c++')])
+        if self.framework.argDB['with-visibility']:
+          flags.extend(['-fvisibility=hidden'])
       elif bopt in ['g']:
         if self.framework.argDB['with-gcov']:
           flags.extend(['-fprofile-arcs', '-ftest-coverage'])

File config/BuildSystem/config/compilers.py

 
     self.logPrint('Libraries needed to link C code with another linker: '+str(self.clibs), 3, 'compilers')
 
-    if hasattr(self.setCompilers, 'FC'):
+    if hasattr(self.setCompilers, 'FC') or hasattr(self.setCompilers, 'CXX'):
       self.logPrint('Check that C libraries can be used from Fortran', 4, 'compilers')
       oldLibs = self.setCompilers.LIBS
       self.setCompilers.LIBS = ' '.join([self.libraries.getLibArgument(lib) for lib in self.clibs])+' '+self.setCompilers.LIBS
+    if hasattr(self.setCompilers, 'FC'):
       try:
         self.setCompilers.checkCompiler('FC')
       except RuntimeError, e:
           if not arg in lflags:
             lflags.append(arg)
             self.logPrint('Found library directory: '+arg, 4, 'compilers')
-            if arg in self.clibs:
-              self.logPrint('Library directory already in C list so skipping in C++')
-            else:
-              cxxlibs.append(arg)
+            cxxlibs.append(arg)
           continue
         # Check for '-rpath /sharedlibpath/ or -R /sharedlibpath/'
         if arg == '-rpath' or arg == '-R':
         break
     else:
       if self.setCompilers.isDarwin():
-        mess = '  See http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#gfortran'
+        mess = '  See http://www.mcs.anl.gov/petsc/documentation/faq.html#gfortran'
       else:
         mess = ''
       raise RuntimeError('Unknown Fortran name mangling: Are you sure the C and Fortran compilers are compatible?\n  Perhaps one is 64 bit and one is 32 bit?\n'+mess)
             else:
               lflags.append(arg)
             self.logPrint('Found library: '+arg, 4, 'compilers')
-            flibs.append(arg)
+            if arg in self.clibs:
+              self.logPrint('Library already in C list so skipping in Fortran')
+            elif arg in self.cxxlibs:
+              self.logPrint('Library already in Cxx list so skipping in Fortran')
+            else:
+              flibs.append(arg)
           else:
             self.logPrint('Already in lflags: '+arg, 4, 'compilers')
           continue
           self.logPrint(str(e), 4, 'compilers')
           raise RuntimeError('Fortran libraries cannot be used with C compiler')
 
-    # check if Intel library exists (that is not linked by default but has iargc_ in it :-(
-    self.logPrint('Check for Intel PEPCF90 library', 4, 'compilers')
-    self.setCompilers.LIBS = oldLibs+' -lPEPCF90 '+' '.join([self.libraries.getLibArgument(lib) for lib in self.flibs])
-    try:
-      self.setCompilers.checkCompiler('C')
-      self.flibs = [' -lPEPCF90']+self.flibs
-      self.logPrint('Intel PEPCF90 library exists', 4, 'compilers')
-    except RuntimeError, e:
-      self.logPrint('Intel PEPCF90 library does not exist', 4, 'compilers')
-      self.setCompilers.LIBS = oldLibs+' '+' '.join([self.libraries.getLibArgument(lib) for lib in self.flibs])
-
     # check these monster libraries work from C++
     if hasattr(self.setCompilers, 'CXX'):
       self.logPrint('Check that Fortran libraries can be used from C++', 4, 'compilers')
     self.popLanguage()
     return
 
+  def checkFortran2003(self):
+    '''Determine whether the Fortran compiler handles F2003'''
+    self.pushLanguage('FC')
+    if self.checkLink(body = '''
+      use,intrinsic :: iso_c_binding
+      Type(C_Ptr),Dimension(:),Pointer :: CArray
+      character(kind=c_char),pointer   :: nullc => null()
+      character(kind=c_char,len=5),dimension(:),pointer::list1
+
+      allocate(list1(5))
+      CArray = (/(c_loc(list1(i)),i=1,5),c_loc(nullc)/)'''):
+      self.addDefine('USING_F2003', 1)
+      self.fortranIsF2003 = 1
+      self.logPrint('Fortran compiler supports F2003')
+    else:
+      self.fortranIsF2003 = 0
+      self.logPrint('Fortran compiler does not support F2003')
+    self.popLanguage()
+    return
+
   def checkFortran90Array(self):
     '''Check for F90 array interfaces'''
     if not self.fortranIsF90:
     if not os.path.isdir(testdir):
       os.mkdir(testdir)
     os.rename(self.compilerObj, modobj)
-    if os.path.isfile('configtest.mod'):
-      modname = 'configtest.mod'
-    elif os.path.isfile('CONFIGTEST.mod'):
-      modname = 'CONFIGTEST.mod'
-    else:
-      raise RuntimeError('Fortran module was not created during the compile. configtest.mod/CONFIGTEST.mod not found')
-    shutil.move(modname, os.path.join(testdir, modname))
+    foundModule = 0
+    for f in [os.path.abspath('configtest.mod'), os.path.abspath('CONFIGTEST.mod'), os.path.join(os.path.dirname(self.compilerObj),'configtest.mod'), os.path.join(os.path.dirname(self.compilerObj),'CONFIGTEST.mod')]:
+      if os.path.isfile(f):
+        modname     = f
+        foundModule = 1
+        break
+    if not foundModule:
+      d = os.path.dirname(os.path.abspath('configtest.mod'))
+      self.logPrint('Directory '+d+' contents:\n'+str(os.listdir(d)))
+      raise RuntimeError('Fortran module was not created during the compile. %s/CONFIGTEST.mod not found' % os.path.abspath('configtest.mod'))
+    shutil.move(modname, os.path.join(testdir, os.path.basename(modname)))
     fcode = '''\
       use configtest
 
       if not self.checkLink(None, fcode):
         self.logPrint('Fortran module include flag '+flag+' failed', 3, 'compilers')
       else:
-        self.logPrint('Fortran module include flag '+flag+' found', 3, 'compilers')        
+        self.logPrint('Fortran module include flag '+flag+' found', 3, 'compilers')
         self.setCompilers.fortranModuleIncludeFlag = flag
         found = 1
       self.setCompilers.LIBS   = oldLIBS
     self.popLanguage()
     if os.path.isfile(modobj):
       os.remove(modobj)
-    os.remove(os.path.join(testdir, modname))
+    os.remove(os.path.join(testdir, os.path.basename(modname)))
     os.rmdir(testdir)
     if not found:
       raise RuntimeError('Cannot determine Fortran module include flag')
     self.pushLanguage('FC')
     oldFLAGS = self.setCompilers.FFLAGS
     oldLIBS  = self.setCompilers.LIBS
-    for flag in ['-module ', '-module:', '-fmod=', '-J', '-M', '-p', '-moddir=']:
+    for flag in ['-module ', '-module:', '-fmod=', '-J', '-M', '-p', '-qmoddir=', '-moddir=']:
       self.setCompilers.FFLAGS = flag+testdir+' '+self.setCompilers.FFLAGS
       self.setCompilers.LIBS   = modobj+' '+self.setCompilers.LIBS
       if not self.checkCompile(modcode, None, cleanup = 0):
       if hasattr(self.setCompilers, 'CXX'):
         self.executeTest(self.checkFortranLinkingCxx)
       self.executeTest(self.checkFortran90)
+      self.executeTest(self.checkFortran2003)
       self.executeTest(self.checkFortran90Array)
       self.executeTest(self.checkFortranModuleInclude)
       self.executeTest(self.checkFortranModuleOutput)

File config/BuildSystem/config/framework.py

       if hasattr(child, 'setupHelp'): child.setupHelp(self.help)
     return argDB
 
-  def cleanup(self):
-    '''Performs cleanup actions
+  def dumpConfFiles(self):
+    '''Performs:
        - Subtitute files
        - Output configure header
        - Log actions'''
       self.outputCHeader(self.log)
       self.actions.addArgument('Framework', 'File creation', 'Created C specific configure header '+self.cHeader)
     self.log.write('\n')
+    return
+
+  def cleanup(self):
     self.actions.output(self.log)
     self.tmpDir = None
     return
       # Cray XT3
       lines = filter(lambda s: s.find('INFO: catamount target') < 0, lines)
       lines = filter(lambda s: s.find('INFO: linux target') < 0, lines)
+      lines = filter(lambda s: s.find('Successful compile:') < 0, lines)
       # Lahey/Fujitsu
       lines = filter(lambda s: s.find('Encountered 0 errors') < 0, lines)
       output = reduce(lambda s, t: s+t, lines, '')
     if self.argDB['ignoreLinkOutput']:
       output = ''
     elif output:
+      hasIbmCrap = output.find('in statically linked applications requires at runtime the shared libraries from the glibc version used for linking') >= 0
       lines = output.splitlines()
-      if self.argDB['ignoreWarnings']:
+      if self.argDB['ignoreWarnings'] and not hasIbmCrap:
         lines = filter(lambda s: not self.warningRE.search(s), lines)
       # PGI: Ignore warning about temporary license
       lines = filter(lambda s: s.find('license.dat') < 0, lines)
         self.outputMakeMacro(f, pair[0], pair[1])
     return
 
+  def getFullDefineName(self, child, name, prefix = None):
+    if prefix is None: prefix = self.getHeaderPrefix(child)
+    if prefix:         prefix = prefix+'_'
+    return prefix+name
+
   def outputDefines(self, f, child, prefix = None):
     '''If the child contains a dictionary named "defines", the entries are output as defines in the config header.
     The prefix to each define is calculated as follows:
       help = child.help
     else:
       help = {}
-    if prefix is None: prefix = self.getHeaderPrefix(child)
-    if prefix:         prefix = prefix+'_'
     for pair in child.defines.items():
       if not pair[1]: continue
       if help.has_key(pair[0]):
-        self.outputDefine(f, prefix+pair[0], pair[1], help[pair[0]])
+        self.outputDefine(f, self.getFullDefineName(child, pair[0], prefix), pair[1], help[pair[0]])
       else:
-        self.outputDefine(f, prefix+pair[0], pair[1])
+        self.outputDefine(f, self.getFullDefineName(child, pair[0], prefix), pair[1])
     return
 
   def outputTypedefs(self, f, child):
       child._configured = 1
     if self.argDB['with-batch']:
       self.configureBatch()
+    self.dumpConfFiles()
     self.cleanup()
     return 1

File config/BuildSystem/config/functions.py

       self.addDefine('HAVE___VA_COPY', 1)
     return
 
+  def checkNanosleep(self):
+    '''Check for functional nanosleep() - as time.h behaves differently for different compiler flags - like -std=c89'''
+    if self.checkLink('#include <time.h>','struct timespec tp;\n tp.tv_sec = 0;\n tp.tv_nsec = (long)(1e9);\n nanosleep(&tp,0);\n'):
+      self.addDefine('HAVE_NANOSLEEP', 1)
+    return
+
   def configure(self):
     self.executeTest(self.checkMemcmp)
     self.executeTest(self.checkSysinfo)
     self.executeTest(self.checkVPrintf)
     self.executeTest(self.checkVFPrintf)
-    self.executeTest(self.checkVSNPrintf)        
+    self.executeTest(self.checkVSNPrintf)
+    self.executeTest(self.checkNanosleep)
     if hasattr(self.compilers, 'CXX'):
       self.executeTest(self.checkSignalHandlerType)
     self.executeTest(self.checkFreeReturnType)

File config/BuildSystem/config/libraries.py

       self.logPrint('Warning: erf() not found')
     return
 
+  def checkCompression(self):
+    '''Check for libz, the compression library'''
+    self.compression = None
+    funcs = ['compress', 'uncompress']
+    prototypes = ['int   compress(char *dest, unsigned long *destLen, const char *source, unsigned long sourceLen);',
+                  'int uncompress(char *dest, unsigned long *destLen, const char *source, unsigned long sourceLen);']
+    calls = ['char *dest = 0; const char *source = 0; unsigned long destLen = 0, sourceLen = 0; int ret = 0; ret =   compress(dest, &destLen, source, sourceLen);\n',
+             'char *dest = 0; const char *source = 0; unsigned long destLen = 0, sourceLen = 0; int ret = 0; ret = uncompress(dest, &destLen, source, sourceLen);\n']
+    if self.check('', funcs, prototype = prototypes, call = calls):
+      self.logPrint('Compression functions are linked in by default')
+      self.compression = []
+    elif self.check('z', funcs, prototype = prototypes, call = calls):
+      self.logPrint('Using libz for the compression library')
+      self.compression = ['libz.a']
+    elif self.check('zlib.lib', funcs, prototype = prototypes, call = calls):
+      self.logPrint('Using zlib.lib for the compression library')
+      self.compression = ['zlib.lib']
+    else:
+      self.logPrint('Warning: No compression library found')
+    return
+
   def checkRealtime(self):
     '''Check for presence of clock_gettime() in realtime library (POSIX Realtime extensions)'''
     self.rt = None
     map(lambda args: self.executeTest(self.check, list(args)), self.libraries)
     self.executeTest(self.checkMath)
     self.executeTest(self.checkMathErf)
+    self.executeTest(self.checkCompression)
     self.executeTest(self.checkRealtime)
     self.executeTest(self.checkDynamic)
     return

File config/BuildSystem/config/package.py

     self.cxx              = 0    # 1 means requires C++
     self.fc               = 0    # 1 means requires fortran
     self.needsMath        = 0    # 1 means requires the system math library
+    self.needsCompression = 0    # 1 means requires the system compression library
     self.noMPIUni         = 0    # 1 means requires a real MPI
     self.libdir           = 'lib'     # location of libraries in the package directory tree
     self.altlibdir        = 'lib64'   # alternate location of libraries in the package directory tree
     for libSet in self.liblist:
       libs = []
       # add full path only to the first library in the list
-      if not self.libdir == directory and len(libSet) > 0:
-        libs.append(os.path.join(directory, libSet[0]))
+      if len(libSet) > 0:
+        if not self.libdir == directory:
+          libs.append(os.path.join(directory, libSet[0]))
+        else:
+          libs.append(libSet[0])
       for library in libSet[1:]:
         # if the library name doesn't start with lib - then add the fullpath
         if library.startswith('lib') or self.libdir == directory:
 
     if 'with-'+self.package+'-dir' in self.framework.argDB:
       d = self.framework.argDB['with-'+self.package+'-dir']
+      # error if package-dir is in externalpackages
+      if os.path.realpath(d).find(os.path.realpath(self.externalPackagesDir)) >=0:
+        fakeExternalPackagesDir = d.replace(os.path.realpath(d).replace(os.path.realpath(self.externalPackagesDir),''),'')
+        raise RuntimeError('Bad option: '+'--with-'+self.package+'-dir='+self.framework.argDB['with-'+self.package+'-dir']+'\n'+
+                           fakeExternalPackagesDir+' is reserved for --download-package scratch space. \n'+
+                           'Do not install software in this location nor use software in this directory.')
       for l in self.generateLibList(os.path.join(d, self.libdir)):
         yield('User specified root directory '+self.PACKAGE, d, l, self.getIncludeDirs(d, self.includedir))
       for l in self.generateLibList(os.path.join(d, self.altlibdir)):
     retriever = retrieval.Retriever(self.sourceControl, argDB = self.framework.argDB)
     retriever.setup()
     self.framework.logPrint('Downloading '+self.name)
+    # check if its http://ftp.mcs - and add ftp://ftp.mcs as fallback
+    download_urls = []
     for url in self.download:
+      download_urls.append(url)
+      if url.find('http://ftp.mcs.anl.gov') >=0:
+        download_urls.append(url.replace('http://','ftp://'))
+    # now attempt to download each url until any one succeeds.
+    err =''
+    for url in download_urls:
       try:
-        retriever.genericRetrieve(url, self.externalPackagesDir, self.downloadfilename)
+        retriever.genericRetrieve(url, self.externalPackagesDir, self.downloadname)
         self.framework.actions.addArgument(self.PACKAGE, 'Download', 'Downloaded '+self.name+' into '+self.getDir(0))
         return
       except RuntimeError, e:
         self.logPrint('ERROR: '+str(e))
-    raise RuntimeError(e)
+        err += str(e)
+    raise RuntimeError(err)
 
   def Install(self):
     raise RuntimeError('No custom installation implemented for package '+self.package+'\n')
     self.checkDependencies(libs, incls)
     if self.needsMath:
       if self.libraries.math is None:
-        raise RuntimeError('Math library not found')
+        raise RuntimeError('Math library [libm.a or equivalent] is not found')
       libs += self.libraries.math
+    if self.needsCompression:
+      if self.libraries.compression is None:
+        raise RuntimeError('Compression library [libz.a or equivalent] not found')
+      libs += self.libraries.compression
 
     for location, directory, lib, incl in self.generateGuesses():
       if directory and not os.path.isdir(directory):
     setupDownload
   which is called only when the package is downloaded (as opposed to being used from a tar file).
   By default this method constructs self.download from the other instance variables as follows:
-    self.download = [self.downloadpath+self.downloadversion+self.downloadext]
+    self.download = [self.downloadpath+self.downloadname+self.downloadversion+self.downloadext]
   Variables self.downloadpath, self.downloadext and self.downloadversion can be set in __init__ or
   using the following hook, which is called at the beginning of setupDownload:
     setupVersion
     self.checkDependencies(libs, incls)
     if self.needsMath:
       if self.libraries.math is None:
-        raise RuntimeError('Math library not found')
+        raise RuntimeError('Math library [libm.a or equivalent] is not found')
       libs += self.libraries.math
+    if self.needsCompression:
+      if self.libraries.compression is None:
+        raise RuntimeError('Compression [libz.a or equivalent] library not found')
+      libs += self.libraries.compression
 
     for location, directory, lib, incl in self.generateGuesses():
       if directory and not os.path.isdir(directory):

File config/BuildSystem/config/packages/BlasLapack.py

     help.addArgument('BLAS/LAPACK', '-with-blas-lib=<libraries: e.g. [/Users/..../libblas.a,...]>',    nargs.ArgLibrary(None, None, 'Indicate the library(s) containing BLAS'))
     help.addArgument('BLAS/LAPACK', '-with-lapack-lib=<libraries: e.g. [/Users/..../liblapack.a,...]>',nargs.ArgLibrary(None, None, 'Indicate the library(s) containing LAPACK'))
     help.addArgument('BLAS/LAPACK', '-download-f-blas-lapack=<no,yes,filename>',                       nargs.ArgDownload(None, 0, 'Automatically install a Fortran version of BLAS/LAPACK'))
+    help.addArgument('BLAS/LAPACK', '-known-64-bit-blas-indices=<bool>', nargs.ArgBool(None, 0, 'Indicate if using 64 bit integer BLAS'))
     return
 
   def getDefaultPrecision(self):
     if self.f2cblaslapack.found:
       self.f2c = 1
       libDir = self.f2cblaslapack.libDir
-      yield ('f2cblaslapack',os.path.join(libDir,'libf2cblas.a') , os.path.join(libDir,'libf2clapack.a'), 0)
+      f2cLibs = [os.path.join(libDir,'libf2cblas.a')]
+      if self.libraries.math:
+        f2cLibs = f2cLibs+self.libraries.math
+      yield ('f2cblaslapack', f2cLibs, os.path.join(libDir,'libf2clapack.a'), 0)
       raise RuntimeError('--download-f2cblaslapack libraries cannot be used')
     if 'with-blas-lib' in self.framework.argDB and not 'with-lapack-lib' in self.framework.argDB:
       raise RuntimeError('If you use the --with-blas-lib=<lib> you must also use --with-lapack-lib=<lib> option')
 
     if self.framework.argDB['download-f-blas-lapack']:
       self.download= ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/fblaslapack-3.1.1.tar.gz']
-      self.downloadname     = 'fblaslapack'
+      self.downloadname     = 'f-blas-lapack'
       self.downloadfilename = 'fblaslapack'
 
     if self.framework.argDB['download-f-blas-lapack'] == 1  or isinstance(self.framework.argDB['download-f-blas-lapack'], str):
     # Try specified installation root
     if 'with-blas-lapack-dir' in self.framework.argDB:
       dir = self.framework.argDB['with-blas-lapack-dir']
+      # error if package-dir is in externalpackages
+      if os.path.realpath(dir).find(os.path.realpath(self.externalPackagesDir)) >=0:
+        fakeExternalPackagesDir = dir.replace(os.path.realpath(dir).replace(os.path.realpath(self.externalPackagesDir),''),'')
+        raise RuntimeError('Bad option: '+'--with-blas-lapack-dir='+self.framework.argDB['with-blas-lapack-dir']+'\n'+
+                           fakeExternalPackagesDir+' is reserved for --download-package scratch space. \n'+
+                           'Do not install software in this location nor use software in this directory.')
       if not (len(dir) > 2 and dir[1] == ':') :
         dir = os.path.abspath(dir)
       self.framework.log.write('Looking for BLAS/LAPACK in user specified directory: '+dir+'\n')
       yield ('User specified AMD ACML lib dir', None, [os.path.join(dir,'lib','libacml.a'), os.path.join(dir,'lib','libacml_mv.a')], 1)
       yield ('User specified AMD ACML lib dir', None, os.path.join(dir,'lib','libacml_mp.a'), 1)
       yield ('User specified AMD ACML lib dir', None, [os.path.join(dir,'lib','libacml_mp.a'), os.path.join(dir,'lib','libacml_mv.a')], 1)      
+      # Check MATLAB [ILP64] MKL
+      yield ('User specified MATLAB [ILP64] MKL Linux lib dir', None, [os.path.join(dir,'bin','glnxa64','mkl.so'), os.path.join(dir,'sys','os','glnxa64','libiomp5.so'), 'pthread'], 1)
       # Check Linux MKL variations
       yield ('User specified MKL Linux lib dir', None, [os.path.join(dir, 'libmkl_lapack.a'), 'mkl', 'guide', 'pthread'], 1)
       for libdir in ['32','64','em64t']:
       # Some new MKL 11/12 variations
       for libdir in ['',os.path.join('lib','32'),os.path.join('lib','ia32')]:
         yield ('User specified MKL11/12 Linux32', None, [os.path.join(dir,libdir,'libmkl_intel.a'),'mkl_intel_thread','mkl_core','iomp5','pthread'],1)
+        yield ('User specified MKL11/12 Linux32', None, [os.path.join(dir,libdir,'libmkl_intel.a'),'mkl_gnu_thread','mkl_core','gomp','pthread'],1) #gnu
       for libdir in ['',os.path.join('lib','em64t'),os.path.join('lib','intel64')]:
         yield ('User specified MKL11/12 Linux64', None, [os.path.join(dir,libdir,'libmkl_intel_lp64.a'),'mkl_intel_thread','mkl_core','iomp5','pthread'],1)
+        yield ('User specified MKL11/12 Linux64', None, [os.path.join(dir,libdir,'libmkl_intel_lp64.a'),'mkl_gnu_thread','mkl_core','gomp','pthread'],1) #gnu
       # Older Linux MKL checks
       yield ('User specified MKL Linux-x86 lib dir', None, [os.path.join(dir, 'libmkl_lapack.a'), 'libmkl_def.a', 'guide', 'pthread'], 1)
       yield ('User specified MKL Linux-x86 lib dir', None, [os.path.join(dir, 'libmkl_lapack.a'), 'libmkl_def.a', 'guide', 'vml','pthread'], 1)
     yield ('Compaq/Alpha Mathematics library', None, 'libcxml.a', 1)
     # IBM ESSL locations
     yield ('IBM ESSL Mathematics library', None, 'libessl.a', 1)
+    yield ('IBM ESSL Mathematics library for Blue Gene', None, 'libesslbg.a', 2)
     # Portland group compiler blas and lapack
     if 'PGI' in os.environ and config.setCompilers.Configure.isPGI(self.setCompilers.CC):
       dir = os.path.join(os.environ['PGI'],'linux86','5.1','lib')
     return ''
 
   def getWindowsNonOptFlags(self,cflags):
-    for flag in ['-MT','-MTd','-MD','-threads']:
+    for flag in ['-MT','-MTd','-MD','-MDd','-threads']:
       if cflags.find(flag) >=0: return flag
     return ''
 
     '''Check for missing LAPACK routines'''
     if self.foundLapack:
       mangleFunc = hasattr(self.compilers, 'FC') and not self.f2c
-      for baseName in ['trsen','gerfs','gges','tgsen','gesvd','getrf','getrs','geev','gelss','syev','syevx','sygv','sygvx','potrf','potrs','stebz','pttrf','pttrs','stein','orgqr','geqrf','gesv','hseqr']:
+      for baseName in ['trsen','gerfs','gges','tgsen','gesvd','getrf','getrs','geev','gelss','syev','syevx','sygv','sygvx','potrf','potrs','stebz','pttrf','pttrs','stein','orgqr','geqrf','gesv','hseqr','geqrf']:
         prefix = self.getPrefix()
         if self.f2c:
           if self.mangling == 'underscore':
         self.compilers.LIBS = oldLibs
     return
 
+  def checklsame(self):
+    ''' Do the BLAS/LAPACK libraries have a valid lsame() function with correction binding. Lion and xcode 4.2 do not'''
+    routine = 'lsame';
+    if self.f2c:
+      if self.mangling == 'underscore':
+        routine = routine + '_'
+    else:
+      routine = self.compilers.mangleFortranFunction(routine)
+    if not self.libraries.check(self.dlib,routine,fortranMangle = 0):
+      self.addDefine('MISSING_LAPACK_'+routine, 1)
+
   def checkForRoutine(self,routine):
     ''' used by other packages to see if a BLAS routine is available
         This is not really correct because other packages do not (usually) know about f2cblasLapack'''
     else:
       return self.libraries.check(self.dlib,routine,fortranMangle = hasattr(self.compilers, 'FC'))
 
+  def check64BitBLASIndices(self):
+    '''Check for and use 64bit integer blas'''
+    if 'known-64-bit-blas-indices' in self.argDB:
+      if int(self.argDB['known-64-bit-blas-indices']):
+        self.addDefine('HAVE_64BIT_BLAS_INDICES', 1)
+    return
+
   def configure(self):
     self.executeTest(self.configureLibrary)
+    self.executeTest(self.check64BitBLASIndices)
     self.executeTest(self.checkESSL)
     self.executeTest(self.checkPESSL)
     self.executeTest(self.checkMissing)
+    self.executeTest(self.checklsame)
     return
 
 if __name__ == '__main__':

File config/BuildSystem/config/packages/CHOLMOD.py

-#!/usr/bin/env python
 from __future__ import generators
 import user
 import config.base
 class Configure(config.package.Package):
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
-    self.liblist   = [['libcholmod.a','libamd.a','libcolamd.a','libcamd.a','libccolamd.a','libmetis.a']]
-    self.functions = ['cholmod_l_solve'] 
+    self.liblist   = [['libcholmod.a','libamd.a','libcolamd.a','libcamd.a','libccolamd.a'],
+                      ['libcholmod.a','libamd.a','libcolamd.a','libcamd.a','libccolamd.a','libsuitesparseconfig.a'],
+                      ['libcholmod.a','libamd.a','libcolamd.a','libcamd.a','libccolamd.a','libmetis.a'],
+                      ['libcholmod.a','libamd.a','libcolamd.a','libcamd.a','libccolamd.a','libmetis.a','libsuitesparseconfig.a']]
+    self.functions = ['cholmod_l_solve']
     self.includes  = ['cholmod.h']
     self.complex   = 1
     return
     g.write('CHOLMOD_CONFIG   = '+flg+'\n')
     g.write('CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d\n')
     g.close()
-    
+
     # Build CHOLMOD
     if self.installNeeded(mkfile):
       try:

File config/BuildSystem/config/packages/MOAB.py

 class Configure(config.package.GNUPackage):
   def __init__(self, framework):
     config.package.GNUPackage.__init__(self, framework)
-    self.downloadpath  = 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/'
-    self.downloadversion = '3.99-10-18-2010'
-    self.downloadext     = 'tar.gz'
-    self.functions = ['iMesh_newMesh']
-    self.functionsFortran = 1
-    self.includes  = ['iMesh.h']
-    self.liblist   = [['libiMesh.a', 'libMOAB.a']]
-    self.cxx       = 1
+    self.downloadpath      = 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/'
+    self.downloadname      = 'moab'
+    self.downloadfilename  = 'moab'
+    self.downloadversion   = '3.99-10-18-2010'
+    self.downloadext       = 'tar.gz'
+
+    self.functions         = ['iMesh_newMesh']
+    self.functionsFortran  = 1
+    self.includes          = ['iMesh.h']
+    self.liblist           = [['libiMesh.a', 'libMOAB.a']]
+    self.cxx               = 1
     return
 
   def setupDependencies(self, framework):

File config/BuildSystem/config/packages/MPI.py

 class Configure(config.package.Package):
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
-    self.download_openmpi   = ['http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.3.tar.gz']
-    self.download_mpich     = ['http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz']
+    self.download_openmpi   = ['http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.5.tar.gz']
+    self.download_mpich     = ['http://www.mpich.org/static/tarballs/1.4.1p1/mpich2-1.4.1p1.tar.gz',
+                               'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/mpich2-1.4.1p1.tar.gz']
     self.download           = ['redefine']
     self.functions          = ['MPI_Init', 'MPI_Comm_create']
     self.includes           = ['mpi.h']
     help.addArgument('MPI', '-download-openmpi=<no,yes,filename>',               nargs.ArgDownload(None, 0, 'Download and install OpenMPI'))
     help.addArgument('MPI', '-with-mpiexec=<prog>',                              nargs.Arg(None, None, 'The utility used to launch MPI jobs'))
     help.addArgument('MPI', '-with-mpi-compilers=<bool>',                        nargs.ArgBool(None, 1, 'Try to use the MPI compilers, e.g. mpicc'))
-    help.addArgument('MPI', '-known-mpi-shared-libraries=<bool>',                          nargs.ArgBool(None, None, 'Indicates the MPI libraries are shared (the usual test will be skipped)'))
-    help.addArgument('MPI', '-download-mpich-pm=<hydra, gforker or mpd>',          nargs.Arg(None, 'hydra', 'Launcher for MPI processes'))
+    help.addArgument('MPI', '-known-mpi-shared-libraries=<bool>',                nargs.ArgBool(None, None, 'Indicates the MPI libraries are shared (the usual test will be skipped)'))
+    help.addArgument('MPI', '-download-mpich-pm=<hydra, gforker or mpd>',        nargs.Arg(None, 'hydra', 'Launcher for MPI processes'))
     help.addArgument('MPI', '-download-mpich-device=<ch3:nemesis or see mpich2 docs>', nargs.Arg(None, 'ch3:sock', 'Communicator for MPI processes'))
-    help.addArgument('MPI', '-download-mpich-mpe=<bool>',                               nargs.ArgBool(None, 0, 'Install MPE with MPICH'))
-    help.addArgument('MPI', '-download-mpich-shared=<bool>',                            nargs.ArgBool(None, 0, 'Install MPICH with shared libraries'))
+    help.addArgument('MPI', '-download-mpich-mpe=<bool>',                        nargs.ArgBool(None, 0, 'Install MPE with MPICH'))
+    help.addArgument('MPI', '-download-mpich-shared=<bool>',                     nargs.ArgBool(None, 0, 'Install MPICH with shared libraries'))
+    help.addArgument('MPI', '-with-mpiuni-fortran-binding=<bool>',               nargs.ArgBool(None, 1, 'Build the MPIUni Fortran bindings'))
     return
 
   def setupDependencies(self, framework):
           dir = os.path.join(homedir,dir)
           if os.path.isdir(dir):
             yield (dir)
-    # Try MPICH install locations under Windows
-    yield(os.path.join('/cygdrive','c','Program Files','Microsoft HPC Pack 2008 SDK'))
-    yield(os.path.join('/cygdrive','c','Program Files','Microsoft Compute Cluster Pack'))
-    yield(os.path.join('/cygdrive','c','Program Files','MPICH2'))
-    yield(os.path.join('/cygdrive','c','Program Files (x86)','MPICH2'))
-    yield(os.path.join('/cygdrive','c','Program Files','MPICH'))
-    yield(os.path.join('/cygdrive','c','Program Files','MPICH','SDK.gcc'))
-    yield(os.path.join('/cygdrive','c','Program Files','MPICH','SDK'))
+    # Try MSMPI/MPICH install locations under Windows
+    # ex: /cygdrive/c/Program Files/Microsoft HPC Pack 2008 SDK
+    for root in ['/',os.path.join('/','cygdrive')]:
+      for drive in ['c']:
+        for programFiles in ['Program Files','Program Files (x86)']:
+          for packageDir in ['Microsoft HPC Pack 2008 SDK','Microsoft Compute Cluster Pack','MPICH2','MPICH',os.path.join('MPICH','SDK.gcc'),os.path.join('MPICH','SDK')]:
+            yield(os.path.join(root,drive,programFiles,packageDir))
     return
 
   def checkSharedLibrary(self):
       self.mpiexec = os.path.abspath(os.path.join('bin', 'mpiexec.poe'))
       return
     if self.framework.argDB['with-batch']:
-      self.mpiexec = 'Not_appropriate_for_batch_systems'
+      self.mpiexec = 'Not_appropriate_for_batch_systems_You_must_use_your_batch_system_to_submit_MPI_jobs_speak_with_your_local_sys_admin'
       self.addMakeMacro('MPIEXEC',self.mpiexec)
       return
     mpiexecs = ['mpiexec -n 1', 'mpirun -n 1', 'mprun -n 1', 'mpiexec', 'mpirun', 'mprun']
     self.addDefine('HAVE_MPI_COMM_F2C', 1)
     self.addDefine('HAVE_MPI_COMM_C2F', 1)
     self.addDefine('HAVE_MPI_FINT', 1)
+    self.addDefine('HAVE_MPI_IN_PLACE', 1)
+    if not self.argDB['with-mpiuni-fortran-binding']:
+      self.framework.addDefine('MPIUNI_AVOID_MPI_NAMESPACE', 1)
+      self.usingMPIUniFortranBinding = 0
+    else:
+      self.usingMPIUniFortranBinding = 1
     if self.getDefaultLanguage == 'C': self.addDefine('HAVE_MPI_C_DOUBLE_COMPLEX', 1)
     self.commf2c = 1
     self.commc2f = 1
         raise RuntimeError('Error running make on OPENMPI, libraries not installed')
       try:
         # OpenMPI puts Fortran 90 modules into lib instead of include like we want
-        output,err,ret  = config.base.Configure.executeShellCommand('cp '+os.path.join(installDir,'lib','*.mod ')+os.path.join(installDir,'include'), timeout=30, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cp '+os.path.join(installDir,'lib*','*.mod ')+os.path.join(installDir,'include'), timeout=30, log = self.framework.log)
       except RuntimeError, e:
         pass
 
         fd.close()
       except:
         self.framework.logPrint('Unable to output configure arguments into '+os.path.join(self.confDir, self.name))
-      #need to run ranlib on the libraries using the full path
-      try:
-        if not self.framework.argDB['with-shared-libraries']:
-          output,err,ret  = config.base.Configure.executeShellCommand(self.setCompilers.RANLIB+' '+os.path.join(installDir,'lib')+'/lib*.a', timeout=2500, log = self.framework.log)
-      except RuntimeError, e:
-        raise RuntimeError('Error running ranlib on OPENMPI/MPI libraries: '+str(e))
       self.framework.actions.addArgument(self.PACKAGE, 'Install', 'Installed OPENMPI/MPI into '+installDir)
 
     self.updateCompilers(installDir,'mpicc','mpic++','mpif77','mpif90')
       self.addDefine('HAVE_MPI_COMM_SPAWN',1)
     if self.libraries.check(self.dlib, "MPI_Win_create"):
       self.addDefine('HAVE_MPI_WIN_CREATE',1)
+      self.addDefine('HAVE_MPI_REPLACE',1) # MPI_REPLACE is strictly for use with the one-sided function MPI_Accumulate
+    if self.libraries.check(self.dlib, 'MPI_Init_thread'):
+        self.addDefine('HAVE_MPI_INIT_THREAD',1)
+    if self.libraries.check(self.dlib, "MPIX_Iallreduce"):
+      self.addDefine('HAVE_MPIX_IALLREDUCE',1)
     if self.libraries.check(self.dlib, "MPI_Finalized"):
       self.addDefine('HAVE_MPI_FINALIZED',1)
     if self.libraries.check(self.dlib, "MPI_Exscan"):

File config/BuildSystem/config/packages/UMFPACK.py

-#!/usr/bin/env python
 from __future__ import generators
 import user
 import config.base
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
     self.download  = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/UMFPACK-5.5.1.tar.gz']
-    self.liblist   = [['libumfpack.a','libamd.a']]
-    self.functions = ['umfpack_di_report_info'] 
+    self.liblist   = [['libumfpack.a','libamd.a'],
+                      ['libumfpack.a','libcholmod.a','libcamd.a','libccolamd.a','libcolamd.a','libamd.a'],
+                      ['libumfpack.a','libcholmod.a','libcamd.a','libccolamd.a','libcolamd.a','libamd.a','libsuitesparseconfig.a'],
+                      ['libumfpack.a','libcholmod.a','libcamd.a','libccolamd.a','libcolamd.a','libamd.a','libsuitesparseconfig.a','libmetis.a']]
+    self.functions = ['umfpack_di_report_info','umfpack_dl_symbolic','umfpack_dl_numeric','umfpack_dl_wsolve']
     self.includes  = ['umfpack.h']
     self.complex   = 1
     return

File config/BuildSystem/config/packages/__init__.py

-all = ['f2cblaslapack','BlasLapack', 'CHOLMOD', 'exodusii', 'scientificpython', 'fiat', 'MOAB', 'MPI', 'netcdf', 'PETSc', 'UMFPACK', 'boost', 'cusp', 'thrust', 'hdf5', 'metis']
+all = ['f2cblaslapack','BlasLapack', 'CHOLMOD', 'exodusii', 'scientificpython', 'fiat', 'MOAB', 'MPI', 'netcdf', 'PETSc', 'UMFPACK', 'boost', 'cusp', 'thrust', 'hdf5']

File config/BuildSystem/config/packages/cusp.py

   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
     self.includes        = ['cusp/version.h']
-    self.includedir      = ''
+    self.includedir      = ['','include']
     self.forceLanguage   = 'CUDA'
     self.cxx             = 0
     self.archIndependent = 1

File config/BuildSystem/config/packages/exodusii.py

 #!/usr/bin/env python
-from __future__ import generators
-import user
 import config.base
 import config.package
 import os
 class Configure(config.package.Package):
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
-    self.download   = ['http://downloads.sourceforge.net/exodusii/exodusii-4.75.tar.gz']
+    self.download   = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/exodusii-5.14-petsc.tgz']
     self.liblist    = [['libexoIIv2for.a', 'libexodus.a'], ['libexoIIv2for.a', 'libexoIIv2c.a']]
     self.functions  = ['ex_close']
     self.includes   = ['exodusII.h']
   def Install(self):
     self.framework.log.write('exodusIIDir = '+self.packageDir+' installDir '+self.installDir+'\n')
 
-    mkfile = 'UFconfig/UFconfig.mk'
+    mkfile = 'make.inc'
     g = open(os.path.join(self.packageDir, mkfile), 'w')
+    self.framework.log.write(repr(dir(self.setCompilers)))
     self.setCompilers.pushLanguage('C')
-    g.write('CC           = '+self.setCompilers.getCompiler()+'\n')
-    if self.checkCompile('#ifdef PETSC_HAVE_LIMITS_H\n  #include <limits.h>\n#endif\n', 'long long i=ULONG_MAX;\n\nif (i);\n'):
-      ulong_max = 'ULONG_MAX'
-    else:
-      ulong_max = '9223372036854775807LL'
-    g.write('CFLAGS       = '+self.setCompilers.getCompilerFlags()+''' -DUF_long="long long" -DUF_long_max=''' + ulong_max + ''' -DUF_long_id='"%lld"' \n''')
+    g.write('CC = '+self.setCompilers.getCompiler()+'\n')
+    g.write('CC_FLAGS = '+self.setCompilers.getCompilerFlags()+'\n')
     self.setCompilers.popLanguage()
-    g.write('RANLIB       = '+self.setCompilers.RANLIB+'\n')
-    g.write('AR = ar cr\n')
-    g.write('RM = rm -f\n')
-    g.write('MV = mv -f\n')
-    g.write('BLAS      = '+self.libraries.toString(self.blasLapack.dlib)+'\n')
-    if self.blasLapack.mangling == 'underscore':
-      flg = ''
-    elif self.blasLapack.mangling == 'caps':
-      flg = '-DBLAS_CAPS_DOES_NOT_WORK'
-    else:
-      flg = '-DBLAS_NO_UNDERSCORE'
-    g.write('UMFPACK_CONFIG   = '+flg+'\n')
-    g.write('CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d\n')
+
+    self.setCompilers.pushLanguage('FC')
+    g.write('FC = '+self.setCompilers.getCompiler()+'\n')
+    g.write('FC_FLAGS = '+self.setCompilers.getCompilerFlags()+'\n')
+    self.setCompilers.popLanguage()
+    g.write('RANLIB      = '+self.setCompilers.RANLIB+'\n')
+    g.write('AR      = '+self.setCompilers.AR+'\n')
+    g.write('AR_FLAGS      = '+self.setCompilers.AR_FLAGS+'\n')
+
     g.close()
 
-    # Build UMFPACK
     if self.installNeeded(mkfile):
       try:
-        self.logPrintBox('Compiling UMFPACK; this may take several minutes')
-        output,err,ret = config.base.Configure.executeShellCommand('cd '+self.packageDir+'/UMFPACK && UMFPACK_INSTALL_DIR='+self.installDir+'''/lib && export UMFPACK_INSTALL_DIR && make && make clean && mv Lib/*.a '''+self.libDir+' && cp Include/*.h '+self.includeDir+' && cd .. && cp UFconfig/*.h '+self.includeDir+' && cd AMD && mv Lib/*.a '+self.libDir+' && cp Include/*.h '+self.includeDir, timeout=2500, log = self.framework.log)
+        self.logPrintBox('Compiling ExodusII; this may take several minutes')
+        output,err,ret = config.base.Configure.executeShellCommand('cd '+self.packageDir+' && make -f Makefile.petsc clean && make -f Makefile.petsc && make -f Makefile.petsc install', timeout=2500, log = self.framework.log)
       except RuntimeError, e:
-        raise RuntimeError('Error running make on UMFPACK: '+str(e))
-      self.checkInstall(output+err, mkfile)
+        raise RuntimeError('Error running make on exodusII: '+str(e))
+      self.postInstall(output+err, mkfile)
     return self.installDir

File config/BuildSystem/config/packages/f2cblaslapack.py

     config.package.Package.__init__(self, framework)
     self.download         = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.1.1.q.tar.gz']
     self.double           = 0
+    self.worksonWindows   = 1
+    self.downloadonWindows= 1
 
   def setupDependencies(self, framework):
     config.package.Package.setupDependencies(self, framework)
     return ''
 
   def getWindowsNonOptFlags(self,cflags):
-    for flag in ['-MT','-MTd','-MD','-threads']:
+    for flag in ['-MT','-MTd','-MD','-MDd','-threads']:
       if cflags.find(flag) >=0: return flag
     return ''
 
   def Install(self):
     import os
 
-    precision = self.defaultPrecision
-    if precision == '__float128': precision = 'quad'
+    make_target = 'single double'
+    if self.defaultPrecision == '__float128': make_target += ' quad'
 
     libdir = self.libDir
     confdir = self.confDir
 
     try:
       self.logPrintBox('Compiling BLASLAPACK; this may take several minutes')
-      output,err,ret  = config.base.Configure.executeShellCommand('cd '+blasDir+' && make -f tmpmakefile cleanblaslapck cleanlib && make -f tmpmakefile '+precision, timeout=2500, log = self.framework.log)
+      output,err,ret  = config.base.Configure.executeShellCommand('cd '+blasDir+' && make -f tmpmakefile cleanblaslapck cleanlib && make -f tmpmakefile '+make_target, timeout=2500, log = self.framework.log)
     except RuntimeError, e:
       raise RuntimeError('Error running make on '+blasDir+': '+str(e))
     try:

File config/BuildSystem/config/packages/fiat.py

 class Configure(config.package.Package):
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
-    self.download = ['http://launchpad.net/fiat/trunk/0.9.9/+download/fiat-0.9.9.tar.gz'] # 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/fiat-dev.tar.gz'
+    self.download = ['http://launchpad.net/fiat/0.x/0.9.9/+download/fiat-0.9.9.tar.gz'] # 'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/fiat-dev.tar.gz'
     self.archIndependent   = 1
     self.worksonWindows    = 1
     self.downloadonWindows = 1

File config/BuildSystem/config/packages/hdf5.py

 class Configure(config.package.Package):
   def __init__(self, framework):
     config.package.Package.__init__(self, framework)
-    self.download     = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/hdf5-1.8.6.tar.gz']
+    self.download     = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/hdf5-1.8.8-p1.tar.gz']
     self.functions = ['H5T_init']
     self.includes  = ['hdf5.h']
-    self.liblist   = [['libhdf5.a']]
+    self.liblist   = [['libhdf5.a','libhdf5_hl.a']]
     self.needsMath = 1
-    self.extraLib  = ['libz.a']
+    self.needsCompression = 1
     self.complex   = 1
     self.worksonWindows = 1
     return
     return self.installDir
 
   def configureLibrary(self):
+    self.extraLib = self.libraries.compression
     if hasattr(self.compilers, 'FC'):
-      self.liblist   = [['libhdf5_fortran.a', 'libhdf5.a']]
+      self.liblist   = [['libhdf5_fortran.a', 'libhdf5.a', 'libhdf5hl_fortran.la', 'libhdf5_hl.la']]
     config.package.Package.configureLibrary(self)
     if self.libraries.check(self.dlib, 'H5Pset_fapl_mpio'):
       self.addDefine('HAVE_H5PSET_FAPL_MPIO', 1)

File config/BuildSystem/config/packages/metis.py

-#!/usr/bin/env python
-import config.package
-
-class Configure(config.package.Package):
-  def __init__(self, framework):
-    config.package.Package.__init__(self, framework)
-    self.download          = ['http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-4.0.3.tar.gz']
-    self.functions         = ['METIS_mCPartGraphKway']
-    self.includes          = ['metis.h']
-    self.liblist           = [['libmetis.a']]
-    self.needsMath         = 1
-    self.complex           = 1
-    self.worksonWindows    = 1
-    self.downloadonWindows = 1
-    return
-
-  def setupDependencies(self, framework):
-    config.package.Package.setupDependencies(self, framework)
-    return
-
-  def Install(self):
-    import os
-    import sys
-
-    makeinc              = os.path.join(self.packageDir, 'make.inc')
-    installmakeinc       = os.path.join(self.confDir, 'Metis')
-    metisconfigheader    = os.path.join(self.packageDir, 'METISLib', 'configureheader.h')
-
-    # Configure Metis
-    g = open(makeinc,'w')
-    g.write('SHELL          = '+self.programs.SHELL+'\n')
-    g.write('CP             = '+self.programs.cp+'\n')
-    g.write('RM             = '+self.programs.RM+'\n')
-    g.write('MKDIR          = '+self.programs.mkdir+'\n')
-
-    g.write('AR             = '+self.setCompilers.AR+'\n')
-    g.write('ARFLAGS        = '+self.setCompilers.AR_FLAGS+'\n')
-    g.write('AR_LIB_SUFFIX  = '+self.setCompilers.AR_LIB_SUFFIX+'\n')
-    g.write('RANLIB         = '+self.setCompilers.RANLIB+'\n')
-
-    g.write('METIS_ROOT     = '+self.packageDir+'\n')
-    g.write('PREFIX         = '+self.installDir+'\n')
-    g.write('METISLIB       = $(METIS_ROOT)/libmetis.$(AR_LIB_SUFFIX)\n')
-
-    self.setCompilers.pushLanguage('C')
-    cflags = self.setCompilers.getCompilerFlags().replace('-Wall','').replace('-Wshadow','')
-    cflags += ' ' + self.headers.toString(self.mpi.include)+' '+self.headers.toString('.')
-
-    g.write('CC             = '+self.setCompilers.getCompiler()+'\n')
-    g.write('OPTFLAGS       = '+cflags+'\n')
-    # parmetis uses defaut 'make' targets, and this uses TARGET_ARCH var. If this var
-    # is set incorrectly in user env - build breaks.
-    g.write('TARGET_ARCH    = \n')
-
-    self.setCompilers.popLanguage()
-    g.close()
-
-    if self.installNeeded('make.inc'):    # Now compile & install
-      self.framework.outputHeader(metisconfigheader, prefix = 'METIS')
-      try:
-        self.logPrintBox('Compiling & installing Metis; this may take several minutes')
-        output,err,ret  = config.package.Package.executeShellCommand('cd '+self.packageDir+' && make clean && make library && make minstall && make clean', timeout=2500, log = self.framework.log)
-      except RuntimeError, e:
-        raise RuntimeError('Error running make on Metis: '+str(e))
-      self.postInstall(output+err, 'make.inc')
-    return self.installDir

File config/BuildSystem/config/packages/netcdf.py

     g.write('PREFIX         = '+self.installDir+'\n')
     configOpts.append('--prefix='+self.installDir)
     configOpts.append('--libdir='+os.path.join(self.installDir,self.libdir))
+    configOpts.append('--disable-dap')
 
     self.setCompilers.pushLanguage('C')
     cflags = self.setCompilers.getCompilerFlags().replace('-Wall','').replace('-Wshadow','')

File config/BuildSystem/config/packages/scientificpython.py

     self.logPrintBox('Installing Scientific Python (PETSc version)')
     # Copy ScientificPython into $PETSC_ARCH/lib/python2.*/site-packages
     installLoc = os.path.join(self.installDir, self.altlibdir)
+    initfile   = os.path.join(installLoc, '__init__.py')
     packageDir = os.path.join(installLoc, 'Scientific')
     if not os.path.isdir(installLoc):
       os.makedirs(installLoc)
+    if not os.path.exists(initfile):
+      f = file(initfile, 'w')
+      f.write('')
+      f.close()
     if os.path.exists(packageDir):
       shutil.rmtree(packageDir)
     shutil.copytree(os.path.join(self.packageDir, 'Scientific'), packageDir)

File config/BuildSystem/config/programs.py

     import nargs
     import nargs
     help.addArgument('PETSc', '-with-make=<prog>', nargs.Arg(None, 'make', 'Specify make'))
+    help.addArgument('PETSc', '-with-make-np=<np>', nargs.ArgInt(None, None, min=1, help='Default number of threads to use for parallel builds'))
     return
 
   def configureMake(self):
     self.addMakeRule('libf','${OBJSF}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSF}')
 
     # check no of cores on the build machine [perhaps to do make '-j ncores']
-    try:
-      import multiprocessing
-      make_np = multiprocessing.cpu_count()+1
-      self.framework.logPrint('module multiprocessing found: using make_np ='+str(make_np))
-    except (ImportError), e:
-        self.framework.logPrint('module multiprocessing *not* found: using default for make_np')
+    make_np = self.framework.argDB.get('with-make-np')
+    if make_np is not None:
+      self.framework.logPrint('using user-provided make_np = %d' % make_np)
+    else:
+      try:
+        import multiprocessing
+        cores = multiprocessing.cpu_count()
+        make_np = max(min(cores+1,5),cores/3)
+        self.framework.logPrint('module multiprocessing found %d cores: using make_np = %d' % (cores,make_np))
+      except (ImportError), e:
         make_np = 2
-    import os
-    import pwd
-    if 'barrysmith' == pwd.getpwuid(os.getuid()).pw_name:
-      # Barry wants to use exactly the number of physical cores (not logical cores) because it breaks otherwise.
-      # Since this works for everyone else who uses a Mac, something must be wrong with their systems. ;-)
+        self.framework.logPrint('module multiprocessing *not* found: using default make_np = %d' % make_np)
       try:
-        (output, error, status) = config.base.Configure.executeShellCommand('/usr/sbin/system_profiler -detailLevel full SPHardwareDataType', log = self.framework.log)
-        import re
-        match = re.search(r'.*Total Number Of Cores: (\d+)', output)
-        if match:
-          make_np = int(match.groups()[0])
-          self.framework.logPrint('Found number of cores using system_profiler: make_np = %d' % (make_np,))
+        import os
+        import pwd
+        if 'barrysmith' == pwd.getpwuid(os.getuid()).pw_name:
+          # Barry wants to use exactly the number of physical cores (not logical cores) because it breaks otherwise.
+          # Since this works for everyone else who uses a Mac, something must be wrong with their systems. ;-)
+          try:
+            (output, error, status) = config.base.Configure.executeShellCommand('/usr/sbin/system_profiler -detailLevel full SPHardwareDataType', log = self.framework.log)
+            import re
+            match = re.search(r'.*Total Number Of Cores: (\d+)', output)
+            if match:
+              make_np = int(match.groups()[0])
+              self.framework.logPrint('Found number of cores using system_profiler: make_np = %d' % (make_np,))
+          except:
+            pass
       except:
         pass
+    self.make_np = make_np
     self.addMakeMacro('MAKE_NP',str(make_np))
     return
 

File config/BuildSystem/config/setCompilers.py

 
     help.addArgument('Compilers', '-with-cpp=<prog>', nargs.Arg(None, None, 'Specify the C preprocessor'))
     help.addArgument('Compilers', '-CPP=<prog>',            nargs.Arg(None, None, 'Specify the C preprocessor'))
-    help.addArgument('Compilers', '-CPPFLAGS=<string>',     nargs.Arg(None, '',   'Specify the C preprocessor options'))
+    help.addArgument('Compilers', '-CPPFLAGS=<string>',     nargs.Arg(None, None, 'Specify the C preprocessor options'))
     help.addArgument('Compilers', '-with-cc=<prog>',  nargs.Arg(None, None, 'Specify the C compiler'))
     help.addArgument('Compilers', '-CC=<prog>',             nargs.Arg(None, None, 'Specify the C compiler'))
-    help.addArgument('Compilers', '-CFLAGS=<string>',       nargs.Arg(None, '',   'Specify the C compiler options'))
+    help.addArgument('Compilers', '-CFLAGS=<string>',       nargs.Arg(None, None, 'Specify the C compiler options'))
     help.addArgument('Compilers', '-CC_LINKER_FLAGS=<string>',        nargs.Arg(None, [], 'Specify the C linker flags'))
 
     help.addArgument('Compilers', '-CXXPP=<prog>',          nargs.Arg(None, None, 'Specify the C++ preprocessor'))
-    help.addArgument('Compilers', '-CXXCPPFLAGS=<string>',  nargs.Arg(None, '',   'Specify the C++ preprocessor options'))
+    help.addArgument('Compilers', '-CXXCPPFLAGS=<string>',  nargs.Arg(None, None, 'Specify the C++ preprocessor options'))
     help.addArgument('Compilers', '-with-cxx=<prog>', nargs.Arg(None, None, 'Specify the C++ compiler'))
     help.addArgument('Compilers', '-CXX=<prog>',            nargs.Arg(None, None, 'Specify the C++ compiler'))
-    help.addArgument('Compilers', '-CXXFLAGS=<string>',     nargs.Arg(None, '',   'Specify the C++ compiler options'))
+    help.addArgument('Compilers', '-CXXFLAGS=<string>',     nargs.Arg(None, None, 'Specify the C++ compiler options'))
     help.addArgument('Compilers', '-CXX_CXXFLAGS=<string>', nargs.Arg(None, '',   'Specify the C++ compiler-only options'))
     help.addArgument('Compilers', '-CXX_LINKER_FLAGS=<string>',       nargs.Arg(None, [], 'Specify the C++ linker flags'))
 
     help.addArgument('Compilers', '-with-fc=<prog>',  nargs.Arg(None, None, 'Specify the Fortran compiler'))
     help.addArgument('Compilers', '-FC=<prog>',             nargs.Arg(None, None, 'Specify the Fortran compiler'))
-    help.addArgument('Compilers', '-FFLAGS=<string>',       nargs.Arg(None, '',   'Specify the Fortran compiler options'))
+    help.addArgument('Compilers', '-FFLAGS=<string>',       nargs.Arg(None, None, 'Specify the Fortran compiler options'))
     help.addArgument('Compilers', '-FC_LINKER_FLAGS=<string>',        nargs.Arg(None, [], 'Specify the FC linker flags'))
 
     help.addArgument('Compilers', '-with-gnu-compilers=<bool>',      nargs.ArgBool(None, 1, 'Try to use GNU compilers'))
     help.addArgument('Compilers', '-with-large-file-io=<bool>', nargs.ArgBool(None, 0, 'Allow IO with files greater then 2 GB'))
 
     help.addArgument('Compilers', '-CUDAPP=<prog>',        nargs.Arg(None, None, 'Specify the CUDA preprocessor'))
-    help.addArgument('Compilers', '-CUDAPPFLAGS=<string>', nargs.Arg(None, '',   'Specify the CUDA preprocessor options'))
+    help.addArgument('Compilers', '-CUDAPPFLAGS=<string>', nargs.Arg(None, None, 'Specify the CUDA preprocessor options'))
     help.addArgument('Compilers', '-CUDAC=<prog>',         nargs.Arg(None, None, 'Specify the CUDA compiler'))
-    help.addArgument('Compilers', '-CUDAFLAGS=<string>',    nargs.Arg(None, '',   'Specify the CUDA compiler options'))
+    help.addArgument('Compilers', '-CUDAFLAGS=<string>',   nargs.Arg(None, None, 'Specify the CUDA compiler options'))
     help.addArgument('Compilers', '-CUDAC_LINKER_FLAGS=<string>',        nargs.Arg(None, [], 'Specify the CUDA linker flags'))
     
 ##    help.addArgument('Compilers', '-LD=<prog>',              nargs.Arg(None, None, 'Specify the executable linker'))
       (output, error, status) = config.base.Configure.executeShellCommand(compiler+' --help')
       output = output + error
       return (any([s in output for s in ['www.gnu.org',
-                                         'developer.apple.com',
                                          'bugzilla.redhat.com',
                                          'gcc.gnu.org',
                                          'gcc version',
+                                         '-print-libgcc-file-name',
                                          'passed on to the various sub-processes invoked by gcc',
+                                         'passed on to the various sub-processes invoked by cc',
                                          'passed on to the various sub-processes invoked by gfortran',
                                          'passed on to the various sub-processes invoked by g++',
+                                         'passed on to the various sub-processes invoked by c++',
                                          ]])
               and not any([s in output for s in ['Intel(R)',
                                                  'Unrecognised option --help passed to ld', # NAG f95 compiler
     for language in ['C', 'CUDA', 'Cxx', 'FC']:
       self.pushLanguage(language)
       for flagsArg in [self.getCompilerFlagsName(language), self.getCompilerFlagsName(language, 1), self.getLinkerFlagsName(language)]:
-        setattr(self, flagsArg, self.argDB[flagsArg])
+        if flagsArg in self.argDB: setattr(self, flagsArg, self.argDB[flagsArg])
+        else: setattr(self, flagsArg, '')
         self.framework.logPrint('Initialized '+flagsArg+' to '+str(getattr(self, flagsArg)))
       self.popLanguage()
     for flagsArg in ['CPPFLAGS', 'CUDAPPFLAGS', 'CXXCPPFLAGS', 'CC_LINKER_FLAGS', 'CXX_LINKER_FLAGS', 'FC_LINKER_FLAGS', 'CUDAC_LINKER_FLAGS','sharedLibraryFlags', 'dynamicLibraryFlags']:
-      setattr(self, flagsArg, self.argDB[flagsArg])
+      if flagsArg in self.argDB: setattr(self, flagsArg, self.argDB[flagsArg])
+      else: setattr(self, flagsArg, '')
       self.framework.logPrint('Initialized '+flagsArg+' to '+str(getattr(self, flagsArg)))
     if 'LIBS' in self.argDB:
       self.LIBS = self.argDB['LIBS']
       if not self.checkRun():
         msg = 'Cannot run executables created with '+language+'. If this machine uses a batch system \nto submit jobs you will need to configure using ./configure with the additional option  --with-batch.\n Otherwise there is problem with the compilers. Can you compile and run code with your C/C++ (and maybe Fortran) compilers?\n'
         if self.isIntel(self.getCompiler()):
-          msg = msg + 'See http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#libimf'
+          msg = msg + 'See http://www.mcs.anl.gov/petsc/documentation/faq.html#libimf'
         self.popLanguage()
         raise OSError(msg)
     self.popLanguage()
       yield os.path.join(self.framework.argDB['with-mpi-dir'], 'bin', 'hcc')
       yield os.path.join(self.framework.argDB['with-mpi-dir'], 'bin', 'mpcc_r')
       self.usedMPICompilers = 0
-      raise RuntimeError('MPI compiler wrappers in '+self.framework.argDB['with-mpi-dir']+'/bin do not work. See http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#mpi-compilers')
+      raise RuntimeError('MPI compiler wrappers in '+self.framework.argDB['with-mpi-dir']+'/bin do not work. See http://www.mcs.anl.gov/petsc/documentation/faq.html#mpi-compilers')
     else:
       if self.useMPICompilers():
         self.usedMPICompilers = 1
     if hasattr(self, 'CXX') and self.mainLanguage == 'Cxx':
       # C++ compiler default
       yield (self.CXX, ['-shared'], 'so')
+      yield (self.CXX, ['-dynamic'], 'so')
     # C compiler default
     yield (self.CC, ['-shared'], 'so')
+    yield (self.CC, ['-dynamic'], 'so')
     yield (self.CC, ['-qmkshrobj'], 'so')
     # Solaris default
     if Configure.isSolaris():
       languages.append('Cxx')
     if hasattr(self, 'FC'):
       languages.append('FC')
+    if hasattr(self, 'CUDAC'):
+      languages.append('CUDA')
     for language in languages:
       flag = '-L'
       self.pushLanguage(language)
       #yield ('libtool', ['-noprebind','-dynamic','-single_module','-flat_namespace -undefined warning','-multiply_defined suppress'], 'dylib')
       if hasattr(self, 'CXX') and self.mainLanguage == 'Cxx':
 #        yield ("g++", ['-dynamiclib -single_module', '-undefined dynamic_lookup', '-multiply_defined suppress'], 'dylib')
-        yield (self.CXX, ['-dynamiclib -single_module', '-undefined dynamic_lookup', '-multiply_defined suppress'], 'dylib')        
+        yield (self.CXX, ['-dynamiclib -single_module', '-undefined dynamic_lookup', '-multiply_defined suppress'], 'dylib')
 #      yield ("gcc", ['-dynamiclib -single_module', '-undefined dynamic_lookup', '-multiply_defined suppress'], 'dylib')
-      yield (self.CC, ['-dynamiclib -single_module', '-undefined dynamic_lookup', '-multiply_defined suppress'], 'dylib')      
+      yield (self.CC, ['-dynamiclib -single_module', '-undefined dynamic_lookup', '-multiply_defined suppress'], 'dylib')
     # Shared default
     if hasattr(self, 'sharedLinker'):
       yield (self.sharedLinker, self.sharedLibraryFlags, 'so')
             self.dynamicLibraries = 1
             self.logPrint('Using dynamic linker '+self.dynamicLinker+' with flags '+str(self.dynamicLibraryFlags)+' and library extension '+self.dynamicLibraryExt)
             break
-          os.remove(oldLib)
         if os.path.isfile(self.linkerObj): os.remove(self.linkerObj)
         del self.dynamicLinker
     return
   def checkMPICompilerOverride(self):
     '''Check if --with-mpi-dir is used along with CC CXX or FC compiler options.
     This usually prevents mpi compilers from being used - so issue a warning'''
-    
-    opts = ['with-cc','with-fc','with-cxx','CC','FC','CXX']
-    optsMatch = []
+
     if 'with-mpi-dir' in self.argDB:
-      for opt in opts:
-        if (opt in self.argDB  and self.argDB[opt] != '0'):
-          optsMatch.append(opt)
-    if optsMatch:
-      mesg = '''\
-Warning: [with-mpi-dir] option is used along with options: ''' + str(optsMatch) + '''
-This prevents configure from picking up MPI compilers from specified mpi-dir.
-
-Suggest using *only* [with-mpi-dir] option - and no other compiler option.
-This way - mpi compilers from '''+self.argDB['with-mpi-dir']+ ''' are used.'''
-      self.logPrintBox(mesg)
+      optcplrs = [(['with-cc','CC'],['mpicc','mpcc','hcc','mpcc_r']),
+              (['with-fc','FC'],['mpif90','mpif77','mpxlf95_r','mpxlf90_r','mpxlf_r','mpf90','mpf77']),
+              (['with-cxx','CXX'],['mpicxx','hcp','mpic++','mpiCC','mpCC_r'])]
+      for opts,cplrs in optcplrs:
+        for opt in opts:
+          if (opt in self.argDB  and self.argDB[opt] != '0'):
+            # check if corresponding mpi wrapper exists
+            for cplr in cplrs:
+              mpicplr = os.path.join(self.framework.argDB['with-mpi-dir'], 'bin', cplr)
+              if os.path.exists(mpicplr):
+                msg = '--'+opt+'='+self.argDB[opt]+' is specified with --with-mpi-dir='+self.framework.argDB['with-mpi-dir']+'. However '+mpicplr+' exists and should be the prefered compiler! Suggest not specifying --'+opt+' option so that configure can use '+ mpicplr +' instead.'
+                raise RuntimeError(msg)
     return
 
   def resetEnvCompilers(self):
     ignoreEnv = ['CC','CFLAGS','CXX','CXXFLAGS','FC','FCFLAGS','F77','FFLAGS',
                  'F90','F90FLAGS','CPP','CPPFLAGS','CXXCPP','CXXCPPFLAGS',
-                 'LDFLAGS','LIBS','MPI_DIR']
+                 'LDFLAGS','LIBS','MPI_DIR','RM']
     for envVal in ignoreEnv:
       if envVal in os.environ:
-        self.logPrintBox('***** WARNING: '+envVal+' found in enviornment variables - ignoring ******')
+        self.logPrintBox('***** WARNING: '+envVal+' found in environment variables - ignoring ******')
         del os.environ[envVal]
     return
 

File config/BuildSystem/config/types.py

   def setupHelp(self, help):
     import nargs
     help.addArgument('Types', '-known-endian=<big or little>', nargs.Arg(None, None, 'Are bytes stored in big or little endian?'))
+    help.addArgument('Visibility', '-with-visibility=<bool>', nargs.Arg(None, 0, 'Use compiler visibility flags to limit symbol visibility'))
     return
 
   def setupDependencies(self, framework):
       self.framework.log.write(typeName+' found\n')
     return found
 
+  def check__int64(self):
+    '''Checks if __int64 exists. This is primarily for windows.'''
+    if self.check('__int64'):
+      self.addDefine('HAVE___INT64',1)
+    return
+
   def checkSizeTypes(self):
     '''Checks for types associated with sizes, such as size_t.'''
     self.check('size_t', 'int')
     self.addDefine('BITS_PER_BYTE', bits)
     return
 
+
+  def checkVisibility(self):
+    if self.framework.argDB['with-visibility']:
+      if not self.checkCompile('','__attribute__((visibility ("default"))) int foo(void);'):
+        raise RuntimeError('Cannot use visibility attributes')
+      self.addDefine('USE_VISIBILITY',1)
+
   def configure(self):
+    self.executeTest(self.check__int64)
     self.executeTest(self.checkSizeTypes)
     self.executeTest(self.checkFileTypes)
     self.executeTest(self.checkIntegerTypes)
     self.executeTest(self.checkEndian)
     map(lambda type: self.executeTest(self.checkSizeof, type), ['char','void *', 'short', 'int', 'long', 'long long', 'float', 'double', 'size_t'])
     self.executeTest(self.checkBitsPerByte)
-
-
+    self.executeTest(self.checkVisibility)
     return

File config/BuildSystem/docs/manual.xml

 enable communication with <command>make</command>. Individual configure modules use the
 <methodname>addDefine</methodname> method to add C <methodname>#define</methodname> statements to a configuration header
 and the <methodname>addSubstitution</methodname> to setup substitution rules for specified files. For instance, to
-activate the ParMetis package, we might provide
+activate the parmetis package, we might provide
 <programlisting>
   self.addDefine('HAVE_PARMETIS', 1)
 </programlisting>
 <emphasis>prefixes</emphasis> for the defines and substitutions. The are strings, unique to each module, which are
 prepended with an underscore to each identifier defined or substituted. These are set on a per object basis using the
 <varname>headerPrefix</varname> and <varname>substPrefix</varname> members. For instance, in our
-ParMetis example, if we instead used the code
+parmetis example, if we instead used the code
 <programlisting>
   self.headerPrefix = 'MATT'
   self.addDefine('HAVE_PARMETIS', 1)
 <para>Extending in a different direction, we allow makefile structures to be specified directly rather than through
 substitutions. Using <methodname>addMakeMacro</methodname>, we can add variable definitions to the configuration
 makefile, whereas <methodname>addMakeRule</methodname> allows the user to specify a make target, complete with
-dependencies and action. As an example, we will replace our ParMetis example from above with the following code
+dependencies and action. As an example, we will replace our parmetis example from above with the following code
 <programlisting>
   self.addMakeMacro('PARMETIS_INCLUDE', ' '.join([self.libraries.getIncludeArgument(i)
                                                   for i in self.include]))
 </programlisting>
 which will produce
 <programlisting>
-  PARMETIS_INCLUDE = -I/home/knepley/petsc-dev/externalpackages/ParMetis/include
-  PARMETIS_LIB = -L/home/knepley/petsc-dev/externalpackages/ParMetis/lib/linux-gnu -lparmetis -lmetis
+  PARMETIS_INCLUDE = -I/home/knepley/petsc-dev/externalpackages/parmetis/build/Darwin-x86_64/include
+  PARMETIS_LIB = -L/home/knepley/petsc-dev/externalpackages/parmetis/build/Darwin-x86_64/lib -lparmetis -lmetis
 </programlisting>
 in the file specified by the <varname>makeMacroHeader</varname> member variable, and
 <programlisting>

File config/BuildSystem/emacsclient.py

File contents unchanged.

File config/BuildSystem/install.old/installerclass.py

   def checkPython(self):
     import sys
 
-    if not hasattr(sys, 'version_info') or float(sys.version_info[0]) != 2 or float(sys.version_info[1]) < 3:
-      raise RuntimeError('BuildSystem requires Python2 version 2.3 or higher. Get Python at http://www.python.org')
+    if not hasattr(sys, 'version_info') or float(sys.version_info[0]) != 2 or float(sys.version_info[1]) < 4:
+      raise RuntimeError('BuildSystem requires Python2 version 2.4 or higher. Get Python at http://www.python.org')
     return
 
   def checkNumeric(self):

File config/BuildSystem/logger.py

               os.rename(self.logName, self.logName+'.bkp')
               Logger.defaultLog = file(self.logName, 'w')
             except OSError:
-              print 'WARNING: Cannot backup log file, appending instead.'
+              sys.stdout.write('WARNING: Cannot backup log file, appending instead.\n')
               Logger.defaultLog = file(self.logName, 'a')
         else:
           Logger.defaultLog = file(self.logName, 'w')

File config/BuildSystem/patch.py

+""" Patch utility to apply unified diffs
+
+    Brute-force line-by-line non-recursive parsing
+
+    Copyright (c) 2008-2011 anatoly techtonik
+    Available under the terms of MIT license
+
+    Project home: http://code.google.com/p/python-patch/
+
+
+    $Id: patch.py 150 2011-10-07 09:31:02Z techtonik $
+    $HeadURL: http://python-patch.googlecode.com/svn/trunk/patch.py $
+"""
+
+__author__ = "techtonik.rainforce.org"
+__version__ = "1.11.10-dev"
+
+import copy
+import logging
+import re
+# cStringIO doesn't support unicode in 2.5
+from StringIO import StringIO
+import urllib2
+
+from os.path import exists, isabs, isfile, abspath, normpath
+import os
+
+
+#------------------------------------------------
+# Logging is controlled by logger named after the
+# module name (e.g. 'patch' for patch.py module)
+
+debugmode = False
+
+logger = logging.getLogger(__name__)
+
+debug = logger.debug
+info = logger.info
+warning = logger.warning
+
+#------------------------------------------------
+
+# constants for Patch/PatchSet types
+
+DIFF = PLAIN = "plain"
+GIT = "git"
+HG = MERCURIAL = "mercurial"
+SVN = SUBVERSION = "svn"
+# mixed type is only actual when PatchSet contains
+# Patches of different type
+MIXED = MIXED = "mixed"
+
+
+def fromfile(filename):
+  """ Parse patch file and return PatchSet() object
+      XXX error reporting
+  """
+  debug("reading %s" % filename)
+  fp = open(filename, "rb")
+  patchset = PatchSet(fp)
+  fp.close()
+  return patchset
+
+
+def fromstring(s):
+  """ Parse text string and return PatchSet() object
+  """
+  return PatchSet( StringIO(s) )
+
+
+def fromurl(url):
+  """ Read patch from URL
+  """
+  return PatchSet( urllib2.urlopen(url) )
+
+
+class Hunk(object):
+  """ Parsed hunk data container (hunk starts with @@ -R +R @@) """
+
+  def __init__(self):
+    self.startsrc=None #: line count starts with 1
+    self.linessrc=None
+    self.starttgt=None
+    self.linestgt=None
+    self.invalid=False
+    self.text=[]
+
+#  def apply(self, estream):
+#    """ write hunk data into enumerable stream
+#        return strings one by one until hunk is
+#        over
+#
+#        enumerable stream are tuples (lineno, line)
+#        where lineno starts with 0
+#    """
+#    pass
+
+
+class Patch(object):
+  """ Patch for a single file """
+  def __init__(self):
+    self.source = None
+    self.target = None
+    self.hunks = []
+    self.hunkends = []
+    self.header = []
+
+    self.type = None
+
+
+class PatchSet(object):
+
+  def __init__(self, stream=None):
+    self.name = None   # descriptive name of the PatchSet
+
+    # list of Patch objects
+    self.items = []
+
+    #: patch set type - one of constants
+    self.type = None
+
+    if stream:
+      self.parse(stream)
+
+  def __len__(self):
+    return len(self.items)
+
+  def parse(self, stream):
+    """ parse unified diff
+        return True on success
+    """
+    lineends = dict(lf=0, crlf=0, cr=0)
+    nexthunkno = 0    #: even if index starts with 0 user messages number hunks from 1
+
+    p = None
+    hunk = None
+    # hunkactual variable is used to calculate hunk lines for comparison
+    hunkactual = dict(linessrc=None, linestgt=None)
+
+
+    class wrapumerate(enumerate):
+      """Enumerate wrapper that uses boolean end of stream status instead of
+      StopIteration exception, and properties to access line information.
+      """
+
+      def __init__(self, *args, **kwargs):
+        # we don't call parent, it is magically created by __new__ method
+
+        self._exhausted = False
+        self._lineno = False     # after end of stream equal to the num of lines
+        self._line = False       # will be reset to False after end of stream
+
+      def next(self):
+        """Try to read the next line and return True if it is available,
+           False if end of stream is reached."""
+        if self._exhausted:
+          return False
+
+        try:
+          self._lineno, self._line = super(wrapumerate, self).next()
+        except StopIteration:
+          self._exhausted = True
+          self._line = False
+          return False
+        return True
+
+      @property
+      def is_empty(self):
+        return self._exhausted
+
+      @property
+      def line(self):
+        return self._line
+
+      @property
+      def lineno(self):
+        return self._lineno
+
+    # define states (possible file regions) that direct parse flow
+    headscan  = True  # start with scanning header
+    filenames = False # lines starting with --- and +++
+
+    hunkhead = False  # @@ -R +R @@ sequence
+    hunkbody = False  #
+    hunkskip = False  # skipping invalid hunk mode
+
+    hunkparsed = False # state after successfully parsed hunk
+
+    # regexp to match start of hunk, used groups - 1,3,4,6
+    re_hunk_start = re.compile("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?")
+
+    errors = 0
+    # temp buffers for header and filenames info
+    header = []
+    srcname = None
+    tgtname = None
+
+    # start of main cycle
+    # each parsing block already has line available in fe.line
+    fe = wrapumerate(stream)
+    while fe.next():
+
+      # -- deciders: these only switch state to decide who should process
+      # --           line fetched at the start of this cycle
+      if hunkparsed:
+        hunkparsed = False
+        if re_hunk_start.match(fe.line):
+            hunkhead = True
+        elif fe.line.startswith("--- "):
+            filenames = True
+        else:
+            headscan = True
+      # -- ------------------------------------
+
+      # read out header
+      if headscan:
+        print fe.line
+        while not fe.is_empty and not fe.line.startswith("--- "):
+            header.append(fe.line)
+            fe.next()
+        if fe.is_empty:
+            if p == None:
+              errors += 1
+              warning("warning: no patch data is found")
+            else:
+              info("%d unparsed bytes left at the end of stream" % len(''.join(header)))
+              # TODO check for \No new line at the end..
+              # TODO test for unparsed bytes
+              # otherwise error += 1
+            # this is actually a loop exit
+            continue
+
+        headscan = False
+        # switch to filenames state
+        filenames = True
+
+      line = fe.line
+      lineno = fe.lineno
+
+
+      # hunkskip and hunkbody code skipped until definition of hunkhead is parsed
+      if hunkbody:
+        # process line first
+        if re.match(r"^[- \+\\]", line):
+            # gather stats about line endings
+            if line.endswith("\r\n"):
+              p.hunkends["crlf"] += 1
+            elif line.endswith("\n"):
+              p.hunkends["lf"] += 1
+            elif line.endswith("\r"):
+              p.hunkends["cr"] += 1
+
+            if line.startswith("-"):
+              hunkactual["linessrc"] += 1
+            elif line.startswith("+"):
+              hunkactual["linestgt"] += 1
+            elif not line.startswith("\\"):
+              hunkactual["linessrc"] += 1
+              hunkactual["linestgt"] += 1
+            hunk.text.append(line)
+            # todo: handle \ No newline cases
+        else:
+            warning("invalid hunk no.%d at %d for target file %s" % (nexthunkno, lineno+1, p.target))
+            # add hunk status node
+            hunk.invalid = True
+            p.hunks.append(hunk)
+            errors += 1
+            # switch to hunkskip state
+            hunkbody = False
+            hunkskip = True
+
+        # check exit conditions
+        if hunkactual["linessrc"] > hunk.linessrc or hunkactual["linestgt"] > hunk.linestgt:
+            warning("extra lines for hunk no.%d at %d for target %s" % (nexthunkno, lineno+1, p.target))
+            # add hunk status node
+            hunk.invalid = True
+            p.hunks.append(hunk)
+            errors += 1
+            # switch to hunkskip state
+            hunkbody = False
+            hunkskip = True
+        elif hunk.linessrc == hunkactual["linessrc"] and hunk.linestgt == hunkactual["linestgt"]:
+            # hunk parsed successfully
+            p.hunks.append(hunk)
+            # switch to hunkparsed state
+            hunkbody = False
+            hunkparsed = True
+
+            # detect mixed window/unix line ends
+            ends = p.hunkends
+            if ((ends["cr"]!=0) + (ends["crlf"]!=0) + (ends["lf"]!=0)) > 1:
+              warning("inconsistent line ends in patch hunks for %s" % p.source)
+            if debugmode:
+              debuglines = dict(ends)
+              debuglines.update(file=p.target, hunk=nexthunkno)
+              debug("crlf: %(crlf)d  lf: %(lf)d  cr: %(cr)d\t - file: %(file)s hunk: %(hunk)d" % debuglines)
+            # fetch next line
+            continue
+
+      if hunkskip:
+        if re_hunk_start.match(line):
+          # switch to hunkhead state
+          hunkskip = False
+          hunkhead = True
+        elif line.startswith("--- "):
+          # switch to filenames state
+          hunkskip = False
+          filenames = True
+          if debugmode and len(self.items) > 0:
+            debug("- %2d hunks for %s" % (len(p.hunks), p.source))
+
+      if filenames:
+        if line.startswith("--- "):
+          if srcname != None:
+            # XXX testcase
+            warning("skipping false patch for %s" % srcname)
+            srcname = None
+            # XXX header += srcname
+            # double source filename line is encountered
+            # attempt to restart from this second line
+          re_filename = "^--- ([^\t]+)"
+          match = re.match(re_filename, line)
+          # todo: support spaces in filenames
+          if match:
+            srcname = match.group(1).strip()
+          else:
+            warning("skipping invalid filename at line %d" % lineno)
+            errors += 1
+            # XXX p.header += line
+            # switch back to headscan state
+            filenames = False
+            headscan = True
+        elif not line.startswith("+++ "):
+          if srcname != None:
+            warning("skipping invalid patch with no target for %s" % srcname)
+            errors += 1
+            srcname = None
+            # XXX header += srcname
+            # XXX header += line
+          else:
+            # this should be unreachable
+            warning("skipping invalid target patch")
+          filenames = False
+          headscan = True
+        else:
+          if tgtname != None:
+            # XXX seems to be a dead branch
+            warning("skipping invalid patch - double target at line %d" % lineno)
+            errors += 1
+            srcname = None
+            tgtname = None
+            # XXX header += srcname
+            # XXX header += tgtname
+            # XXX header += line
+            # double target filename line is encountered
+            # switch back to headscan state
+            filenames = False
+            headscan = True
+          else:
+            re_filename = "^\+\+\+ ([^\t]+)"
+            match = re.match(re_filename, line)
+            if not match:
+              warning("skipping invalid patch - no target filename at line %d" % lineno)
+              errors += 1
+              srcname = None
+              # switch back to headscan state
+              filenames = False
+              headscan = True
+            else:
+              if p: # for the first run p is None
+                self.items.append(p)
+              p = Patch()
+              p.source = srcname
+              srcname = None
+              p.target = match.group(1).strip()
+              p.header = header
+              header = []
+              # switch to hunkhead state
+              filenames = False
+              hunkhead = True
+              nexthunkno = 0
+              p.hunkends = lineends.copy()
+              continue
+
+      if hunkhead:
+        match = re.match("^@@ -(\d+)(,(\d+))? \+(\d+)(,(\d+))?", line)
+        if not match:
+          if not p.hunks:
+            warning("skipping invalid patch with no hunks for file %s" % p.source)
+            errors += 1
+            # XXX review switch
+            # switch to headscan state
+            hunkhead = False
+            headscan = True
+            continue
+          else:
+            # TODO review condition case
+            # switch to headscan state
+            hunkhead = False
+            headscan = True
+        else:
+          hunk = Hunk()
+          hunk.startsrc = int(match.group(1))
+          hunk.linessrc = 1
+          if match.group(3): hunk.linessrc = int(match.group(3))
+          hunk.starttgt = int(match.group(4))