Commits

Jed Brown committed b95f98c Merge

Merge subtree 'buildsystem/master'

Comments (0)

Files changed (41)

config/BuildSystem/build/framework.py

           for d in dirs:
             if not d in directories: directories.append(d)
     return directories
-    
+
   def t_updateBootstrap(self):
     '''Create a bootstrap tarball and copy it to the FTP site'''
     import install.installerclass
     raise RuntimeError('Need to fix the path')
     return
 
-    
+
   def t_updateWebsite(self):
     '''Print all the SIDL dependencies as HTML and move to the website'''
     for f in self.executeTarget('printSIDLHTML'):

config/BuildSystem/checkdlllibs.py

           print 'Loading '+os.path.join(dir, f)
           SIDL.Loader.loadLibrary(os.path.join(dir, f))
 
-    
+
 if __name__ ==  '__main__':
   if len(sys.argv) > 1: sys.exit('Usage: checkdlllibs.py')
   checkDLLLibs()

config/BuildSystem/config/__init__.py

-all = ['base', 'compilers', 'framework', 'functions', 'headers', 'libraries', 'types']
+all = ['base', 'compilers', 'framework', 'functions', 'headers', 'libraries', 'types', 'atomics']

config/BuildSystem/config/atomics.py

+import config.base
+
+import os
+
+class Configure(config.base.Configure):
+  def __init__(self, framework):
+    config.base.Configure.__init__(self, framework)
+    self.headerPrefix = 'PETSC'
+    return
+
+  def setupDependencies(self, framework):
+    config.base.Configure.setupDependencies(self, framework)
+    self.setCompilers = framework.require('config.setCompilers', self)
+    self.libraries    = framework.require('config.libraries', self)
+    return
+
+  def configureCPURelax(self):
+    ''' Definitions for cpu relax assembly instructions '''
+    # Definition for cpu_relax()
+    # From Linux documentation
+    # cpu_relax() call can lower power consumption or yield to a hyperthreaded
+    # twin processor; it also happens to serve as a compiler barrier
+
+    # x86
+    if self.checkCompile('', 'asm volatile("rep; nop" ::: "memory");'):
+      self.addDefine('CPU_RELAX()','asm volatile("rep; nop" ::: "memory")')
+      return
+    # PowerPC
+    if self.checkCompile('','do { HMT_low; HMT_medium; __asm__ __volatile__ ("":::"memory"); } while (0)'):
+      self.addDefine('CPU_RELAX()','do { HMT_low; HMT_medium; __asm__ __volatile__ ("":::"memory"); } while (0)')
+      return
+    elif self.checkCompile('','__asm__ __volatile__ ("":::"memory");'):
+      self.addDefine('CPU_RELAX()','__asm__ __volatile__ ("":::"memory")')
+      return
+
+  def configureMemoryBarriers(self):
+    ''' Definitions for memory barrier instructions'''
+    # ---- Definitions for x86_64 -----
+    # General Memory Barrier
+    if self.checkCompile('','asm volatile("mfence":::"memory")'):
+      self.addDefine('MEMORY_BARRIER()','asm volatile("mfence":::"memory")')
+    # Read Memory Barrier
+    if self.checkCompile('','asm volatile("lfence":::"memory")'):
+      self.addDefine('READ_MEMORY_BARRIER()','asm volatile("lfence":::"memory")')
+    # Write Memory Barrier
+    if self.checkCompile('','asm volatile("sfence":::"memory")'):
+      self.addDefine('WRITE_MEMORY_BARRIER()','asm volatile("sfence":::"memory")')
+    return
+
+  def configure(self):
+    self.executeTest(self.configureCPURelax)
+    self.executeTest(self.configureMemoryBarriers)
+    return

config/BuildSystem/config/base.py

 
   The Framework will first instantiate the object and call setupDependencies(). All require()
   calls should be made in that method.
-  
+
   The Framework will then call configure(). If it succeeds, the object will be marked as configured.
 
 Generic test execution
     self.framework       = framework
     self.defines         = {}
     self.makeRules       = {}
-    self.makeMacros      = {}        
+    self.makeMacros      = {}
     self.typedefs        = {}
     self.prototypes      = {}
     self.subst           = {}
   def checkExecutable(self, dir, name):
     prog  = os.path.join(dir, name)
     # also strip any \ before spaces, braces, so that we can specify paths the way we want them in makefiles.
-    prog  = prog.replace('\ ',' ').replace('\(','(').replace('\)',')') 
+    prog  = prog.replace('\ ',' ').replace('\(','(').replace('\)',')')
     found = 0
     self.framework.log.write('Checking for program '+prog+'...')
     if os.path.isfile(prog) and os.access(prog, os.X_OK):
       (output, error, status) = Configure.executeShellCommand(command, log = self.framework.log)
     except RuntimeError, e:
       self.framework.log.write('ERROR while running executable: '+str(e)+'\n')
-    if os.path.isfile(self.compilerObj): 
+    if os.path.isfile(self.compilerObj):
       try:
         os.remove(self.compilerObj)
       except RuntimeError, e:
         self.framework.log.write('ERROR while removing object file: '+str(e)+'\n')
-    if cleanup and os.path.isfile(self.linkerObj): 
+    if cleanup and os.path.isfile(self.linkerObj):
       try:
         if os.path.exists('/usr/bin/cygcheck.exe'): time.sleep(1)
         os.remove(self.linkerObj)

config/BuildSystem/config/compilerOptions.py

       try:
         output   = self.executeShellCommand(compiler + ' -show')[0]
         compiler = output.split(' ')[0]
+        self.framework.addMakeMacro('MPICC_SHOW',output.strip().replace('\n','\\\\n'))
       except:
         pass
 
       try:
         output   = self.executeShellCommand(compiler+' -show')[0]
         compiler = output.split(' ')[0]
+        self.framework.addMakeMacro('MPICXX_SHOW',output.strip().replace('\n','\\\\n'))
       except:
         pass
-    
+
     flags = []
     # GNU g++
     if config.setCompilers.Configure.isGNU(compiler) or config.setCompilers.Configure.isClang(compiler):
       try:
         output   = self.executeShellCommand(compiler+' -show')[0]
         compiler = output.split(' ')[0]
+        self.framework.addMakeMacro('MPIFC_SHOW',output.strip().replace('\n','\\\\n'))
       except:
         pass
 
             version = output.split('\r\n')[1]
           else:
             version = output.split('\n')[0]
-          
+
     except RuntimeError, e:
       self.framework.log.write('Could not determine compiler version: '+str(e))
     self.framework.log.write('getCompilerVersion: '+str(compiler)+' '+str(version)+'\n')

config/BuildSystem/config/compilers.py

         self.addDefine(language.upper()+'_RESTRICT', kw)
         self.popLanguage()
         return
-    # did not find restrict 
+    # did not find restrict
     self.addDefine(language.upper()+'_RESTRICT', ' ')
     self.logPrint('No '+str(language)+' restrict keyword', 4, 'compilers')
     self.popLanguage()
     # since doing that causes problems on other systems.
     if output.find('XL_CONFIG') >= 0:
       output = output.replace(',', ' ')
-      
+
     # Parse output
     argIter = iter(output.split())
     clibs = []
           continue
         # Check for system libraries
         m = re.match(r'^-l(ang.*|crt[0-9].o|crtbegin.o|c|gcc|cygwin|crt[0-9].[0-9][0-9].[0-9].o)$', arg)
-        if m: 
+        if m:
           self.logPrint('Skipping system library: '+arg, 4, 'compilers')
           continue
         # Check for special library arguments
           lib = argIter.next()
           if lib.startswith('"') and lib.endswith('"') and lib.find(' ') == -1: lib = lib[1:-1]
           lib = os.path.abspath(lib)
-          if lib in ['/usr/lib','/lib','/usr/lib64','/lib64']: continue          
-          if not lib in rpathflags:          
+          if lib in ['/usr/lib','/lib','/usr/lib64','/lib64']: continue
+          if not lib in rpathflags:
             rpathflags.append(lib)
             self.logPrint('Found '+arg+' library: '+lib, 4, 'compilers')
             clibs.append(self.setCompilers.CSharedLinkerFlag+lib)
         m = re.match(r'^-R.*$', arg)
         if m:
           lib = os.path.abspath(arg[2:])
-          if not lib in rpathflags:          
+          if not lib in rpathflags:
             rpathflags.append(lib)
             self.logPrint('Found -R library: '+lib, 4, 'compilers')
             clibs.append(self.setCompilers.CSharedLinkerFlag+lib)
     # since doing that causes problems on other systems.
     if output.find('XL_CONFIG') >= 0:
       output = output.replace(',', ' ')
-      
+
     # Parse output
     argIter = iter(output.split())
     cxxlibs = []
           continue
         # Check for system libraries
         m = re.match(r'^-l(ang.*|crt[0-9].o|crtbegin.o|c|gcc|cygwin|crt[0-9].[0-9][0-9].[0-9].o)$', arg)
-        if m: 
+        if m:
           self.logPrint('Skipping system library: '+arg, 4, 'compilers')
           continue
         # Check for special library arguments
         m = re.match(r'^-L.*$', arg)
         if m:
           arg = '-L'+os.path.abspath(arg[2:])
-          if arg in ['-L/usr/lib','-L/lib','-L/usr/lib64','-L/lib64']: continue                    
+          if arg in ['-L/usr/lib','-L/lib','-L/usr/lib64','-L/lib64']: continue
           if not arg in lflags:
             lflags.append(arg)
             self.logPrint('Found library directory: '+arg, 4, 'compilers')
           if lib.startswith('"') and lib.endswith('"') and lib.find(' ') == -1: lib = lib[1:-1]
           lib = os.path.abspath(lib)
           if lib in ['/usr/lib','/lib','/usr/lib64','/lib64']: continue
-          if not lib in rpathflags:          
+          if not lib in rpathflags:
             rpathflags.append(lib)
             self.logPrint('Found '+arg+' library: '+lib, 4, 'compilers')
             cxxlibs.append(self.setCompilers.CSharedLinkerFlag+lib)
 
     However, the Fortran 77 intrinsic and run-time libraries must be
     linked in as well, but the C++ compiler/linker does not know how to
-    add these Fortran 77 libraries. 
+    add these Fortran 77 libraries.
 
     This code was translated from the autoconf macro which was packaged in
     its current form by Matthew D. Langston <langston@SLAC.Stanford.EDU>.
     However, nearly all of this macro came from the OCTAVE_FLIBS macro in
     octave-2.0.13/aclocal.m4, and full credit should go to John W. Eaton
     for writing this extremely useful macro.'''
-    if not hasattr(self.setCompilers, 'CC') or not hasattr(self.setCompilers, 'FC'): 
+    if not hasattr(self.setCompilers, 'CC') or not hasattr(self.setCompilers, 'FC'):
       return
     self.pushLanguage('FC')
     oldFlags = self.setCompilers.LDFLAGS
           continue
         # Check for system libraries
         m = re.match(r'^-l(ang.*|crt[0-9].o|crtbegin.o|c|gcc|cygwin|crt[0-9].[0-9][0-9].[0-9].o)$', arg)
-        if m: 
+        if m:
           self.logPrint('Found system library therefor skipping: '+arg, 4, 'compilers')
           continue
         # Check for canonical library argument
           self.logPrint('Found canonical library: '+lib, 4, 'compilers')
           flibs.append(lib)
           continue
+        # intel windows compilers can use -libpath argument
+        if arg.find('-libpath:')>=0:
+          self.logPrint('Skipping win32 ifort option: '+arg)
+          continue
         # Check for special library arguments
         m = re.match(r'^-l.*$', arg)
         if m:
           # HP Fortran prints these libraries in a very strange way
           if arg == '-l:libU77.a':  arg = '-lU77'
           if arg == '-l:libF90.a':  arg = '-lF90'
-          if arg == '-l:libIO77.a': arg = '-lIO77'                      
+          if arg == '-l:libIO77.a': arg = '-lIO77'
           if not arg in lflags:
             if arg == '-lkernel32':
               continue
         m = re.match(r'^-L.*$', arg)
         if m:
           arg = '-L'+os.path.abspath(arg[2:])
-          if arg in ['-L/usr/lib','-L/lib','-L/usr/lib64','-L/lib64']: continue          
+          if arg in ['-L/usr/lib','-L/lib','-L/usr/lib64','-L/lib64']: continue
           if not arg in lflags:
             lflags.append(arg)
             self.logPrint('Found library directory: '+arg, 4, 'compilers')
             if os.path.isdir(l):
               lib1 = '-L'+os.path.abspath(l)
               if lib1 in ['-L/usr/lib','-L/lib','-L/usr/lib64','-L/lib64']: continue
-              if not arg in lflags:              
+              if not arg in lflags:
                 flibs.append(lib1)
                 lflags.append(lib1)
                 self.logPrint('Handling HPUX list of directories: '+l, 4, 'compilers')
       elif os.path.isfile(os.path.join(testdir, 'configtest.mod')) or os.path.isfile(os.path.join(testdir, 'CONFIGTEST.mod')):
         if os.path.isfile(os.path.join(testdir, 'configtest.mod')): modname = 'configtest.mod'
         if os.path.isfile(os.path.join(testdir, 'CONFIGTEST.mod')): modname = 'CONFIGTEST.mod'
-        self.logPrint('Fortran module output flag '+flag+' found', 3, 'compilers')        
+        self.logPrint('Fortran module output flag '+flag+' found', 3, 'compilers')
         self.setCompilers.fortranModuleOutputFlag = flag
         found = 1
       else:

config/BuildSystem/config/framework.py

             rest = apply(os.path.join, nextDirs[1:])
           else:
             rest = None
-          dirs.extend(self.listDirs(os.path.join(base, dir),rest ))            
+          dirs.extend(self.listDirs(os.path.join(base, dir),rest ))
     return dirs
 
   def getTmpDir(self):
     if output.find('your evaluation license will expire') > -1 and output.lower().find('error') == -1:
       output = ''
     lines = output.splitlines()
-    # IBM: 
+    # IBM:
     lines = filter(lambda s: not s.startswith('cc_r:'), lines)
     # PGI: Ignore warning about temporary license
     lines = filter(lambda s: s.find('license.dat') < 0, lines)
     # 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('INFO: linux target') < 0, lines)
     # Lahey/Fujitsu
     lines = filter(lambda s: s.find('Encountered 0 errors') < 0, lines)
     output = reduce(lambda s, t: s+t, lines, '')
     return output
-  
+
   def filterCompileOutput(self, output):
     if self.argDB['ignoreCompileOutput']:
       output = ''
       lines = filter(lambda s: s.find('Encountered 0 errors') < 0, lines)
       output = reduce(lambda s, t: s+t, lines, '')
     return output
-        
+
   ###############################################
   # Output Mechanisms
   def addSubstitutionFile(self, inName, outName = ''):
         else:
           print pair[0]+'  --->  '+str(self.argDB[pair[1]])
     return
-  
+
 
   def storeSubstitutions(self, argDB):
     '''Store all the substitutions in the argument database'''
       f.write(name+': '+dependencies+'\n')
       for r in rule:
         f.write('\t'+r+'\n')
-      f.write('\n')            
+      f.write('\n')
     else:
       f.write(name+': '+dependencies+'\n\n')
     return

config/BuildSystem/config/functions.py

     if 'known-memcmp-ok' in self.framework.argDB:
       if self.framework.argDB['known-memcmp-ok'] == 0:
         raise RuntimeError('Failed to find 8-bit clean memcmp(). Cannot proceed')
-      else: 
+      else:
         return
     if not self.framework.argDB['with-batch']:
       if not self.checkRun('#include <string.h>\nvoid exit(int);\n\n', 'char c0 = 0x40;\nchar c1 = (char) 0x80;\nchar c2 = (char) 0x81;\nexit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1);\n'):

config/BuildSystem/config/headers.py

     include = include.replace('\\)',')').replace(')', '\\)')
     if include[0] == '-':
       return [include]
-    
+
     self.pushLanguage('FC')
     string = self.setCompilers.fortranModuleIncludeFlag+include
     self.popLanguage()
     self.framework.log.write('Checking for header files ' +str(hfiles)+ ' in '+str(incl)+'\n')
     for hfile in hfiles:
       flagsArg = self.getPreprocessorFlagsArg()
-      self.logPrint('Checking include with compiler flags var '+flagsArg)
+      self.logPrint('Checking include with compiler flags var '+flagsArg+' '+str(incl+otherIncludes))
       #oldFlags = self.compilers.CPPFLAGS
       oldFlags = getattr(self.compilers, flagsArg)
       #self.compilers.CPPFLAGS += ' '+' '.join([self.getIncludeArgument(inc) for inc in incl+otherIncludes])

config/BuildSystem/config/libraries.py

       - If the path ends in ".lib" return it unchanged
       - If the path is absolute and the filename is "lib"<name>, return -L<dir> -l<name>
       - If the filename is "lib"<name>, return -l<name>
-      - If the path ends in ".so" return it unchanged       
+      - If the path ends in ".so" return it unchanged
       - If the path is absolute, return it unchanged
       - Otherwise return -l<library>'''
     if not library:
 
   def toString(self,libs):
     '''Converts a list of libraries to a string suitable for a linker'''
-    return ' '.join([self.getLibArgument(lib) for lib in libs])
+    newlibs = []
+    frame = 0
+    for lib in libs:
+      if frame:
+        newlibs += [lib]
+        frame   = 0
+      elif lib == '-framework':
+        newlibs += [lib]
+        frame = 1
+      else:
+        newlibs += self.getLibArgumentList(lib)
+    return ' '.join(newlibs)
 
   def toStringNoDupes(self,libs):
     '''Converts a list of libraries to a string suitable for a linker, removes duplicates'''
     newlibs = []
+    frame = 0
     for lib in libs:
-      newlibs += self.getLibArgumentList(lib)
+      if frame:
+        newlibs += [lib]
+        frame   = 0
+      elif lib == '-framework':
+        newlibs += [lib]
+        frame = 1
+      else:
+        newlibs += self.getLibArgumentList(lib)
     libs = newlibs
     newlibs = []
-    removedashl = 0
     for j in libs:
       # do not remove duplicate -l, because there is a tiny chance that order may matter
       if j in newlibs and not ( j.startswith('-l') or j == '-framework') : continue
-      # handle special case of -framework frameworkname
-      if j == '-framework': removedashl = 1
-      elif removedashl:
-        j = j[2:]
-        removedashl = 0
-        
       newlibs.append(j)
     return ' '.join(newlibs)
 

config/BuildSystem/config/package.py

     import nargs
     help.addArgument(self.PACKAGE,'-with-'+self.package+'=<bool>',nargs.ArgBool(None,self.required+self.lookforbydefault,'Indicate if you wish to test for '+self.name))
     help.addArgument(self.PACKAGE,'-with-'+self.package+'-dir=<dir>',nargs.ArgDir(None,None,'Indicate the root directory of the '+self.name+' installation'))
-    if hasattr(self, 'usePkgConfig'):
-      help.addArgument(self.PACKAGE, '-with-'+self.package+'-pkg-config=<dir>', nargs.ArgDir(None, None, 'Indicate the root directory of the '+self.name+' installation'))
+    help.addArgument(self.PACKAGE, '-with-'+self.package+'-pkg-config=<dir>', nargs.Arg(None, None, 'Look for '+self.name+' using pkg-config utility optional directory to look in'))
     help.addArgument(self.PACKAGE,'-with-'+self.package+'-include=<dirs>',nargs.ArgDirList(None,None,'Indicate the directory of the '+self.name+' include files'))
     help.addArgument(self.PACKAGE,'-with-'+self.package+'-lib=<libraries: e.g. [/Users/..../lib'+self.package+'.a,...]>',nargs.ArgLibrary(None,None,'Indicate the '+self.name+' libraries'))
     if self.download and not self.download[0] == 'redefine':
     self.PACKAGE          = self.name.upper()
     self.package          = self.name.lower()
     self.downloadname     = self.name
+    self.pkgname          = self.name
     self.downloadfilename = self.downloadname;
     return
 
     return []
 
   def getInstallDir(self):
+    if not self.arch:  raise RuntimeError('Why the hell is self.arch not defined for this package -- '+self.package+'\n')
     self.installDir = os.path.join(self.defaultInstallDir, self.arch)
     self.confDir    = os.path.join(self.installDir, 'conf')
     self.includeDir = os.path.join(self.installDir, 'include')
         yield('Download '+self.PACKAGE, d, l, self.getIncludeDirs(d, self.includedir))
       raise RuntimeError('Downloaded '+self.package+' could not be used. Please check install in '+d+'\n')
 
+    if 'with-'+self.package+'-pkg-config' in self.framework.argDB:
+      if self.framework.argDB['with-'+self.package+'-pkg-config']:
+        #  user provided path to look for pkg info
+        if 'PKG_CONFIG_PATH' in os.environ: path = os.environ['PKG_CONFIG_PATH']
+        else: path = None
+        os.environ['PKG_CONFIG_PATH'] = self.framework.argDB['with-'+self.package+'-pkg-config']
+
+      l,err,ret  = config.base.Configure.executeShellCommand('pkg-config '+self.pkgname+' --libs', timeout=5, log = self.framework.log)
+      l = l.strip()
+      i,err,ret  = config.base.Configure.executeShellCommand('pkg-config '+self.pkgname+' --variable=includedir', timeout=5, log = self.framework.log)
+      i = i.strip()
+      if self.framework.argDB['with-'+self.package+'-pkg-config']:
+        if path: os.environ['PKG_CONFIG_PATH'] = path
+        else: os.environ['PKG_CONFIG_PATH'] = ''
+      yield('pkg-config located libraries and includes '+self.PACKAGE, None, l, i)
+      raise RuntimeError('pkg-config could not locate correct includes and libraries for '+self.package)
+
+
     if 'with-'+self.package+'-dir' in self.framework.argDB:
       d = self.framework.argDB['with-'+self.package+'-dir']
       # error if package-dir is in externalpackages
       self.framework.argDB['with-'+self.package] = 1
     if 'with-'+self.package+'-dir' in self.framework.argDB or 'with-'+self.package+'-include' in self.framework.argDB or 'with-'+self.package+'-lib' in self.framework.argDB:
       self.framework.argDB['with-'+self.package] = 1
-    if hasattr(self, 'usePkgConfig') and 'with-'+self.package+'-pkg-config' in self.framework.argDB:
+    if 'with-'+self.package+'-pkg-config' in self.framework.argDB:
       self.framework.argDB['with-'+self.package] = 1
-      self.usePkgConfig()
 
     self.consistencyChecks()
     if self.framework.argDB['with-'+self.package]:
     self.includes         - names of header files to locate               [list of strings]
     self.liblist          - names of library files to locate              [list of lists of strings]
     self.functions        - names of functions to locate in libraries     [list of strings]
-    self.cxx              - whether C++ is required for this package      [bool]
+    self.cxx              - whether C++ compiler, (this does not require that PETSc be built with C++, should it?) is required for this package      [bool]
     self.functionsFortran - whether to mangle self.functions symbols      [bool]
   Most of these instance variables determine the behavior of the location/installation and the testing stages.
   Ideally, a package subclass would extend only the __init__ method and parameterize the remainder of
     self.setupDownload()
     return Package.checkDownload(self,requireDownload)
 
+  def formGNUConfigureExtraArgs(self):
+    '''Intended to be overridden by subclasses'''
+    args = []
+    return args
+
   def formGNUConfigureDepArgs(self):
     '''Add args corresponding to --with-<deppackage>=<deppackage-dir>.'''
     args = []
     else:
         args.append('--disable-shared')
     args.extend(self.formGNUConfigureDepArgs())
+    args.extend(self.formGNUConfigureExtraArgs())
     return args
 
   def Install(self):

config/BuildSystem/config/packages/BlasLapack.py

     self.f2cblaslapack = framework.require('config.packages.f2cblaslapack', self)
     return
 
-  
+
   def __str__(self):
     return 'BLAS/LAPACK: '+self.libraries.toString(self.lib)+'\n'
 
     calls      = ['','']
     for routine in range(len(routines)):
       routines[routine] = self.getPrefix()+routines[routine]
-       
+
     if fortranMangle=='stdcall':
       if routines == ['dgetrs','dgeev']:
         prototypes = ['void __stdcall DGETRS(char*,int,int*,int*,double*,int*,int*,double*,int*,int*);',
     '''Checking for BLAS and LAPACK symbols'''
 
     #check for BLASLAPACK_STDCALL calling convention!!!!
-    
+
     if blasLibrary is None:
       self.separateBlas = 0
       blasLibrary       = lapackLibrary
       if isinstance(self.framework.argDB['download-f-blas-lapack'], str):
         self.download= [self.framework.argDB['download-f-blas-lapack']]
       self.fblaslapack = 1
-      
+
       if not hasattr(self.compilers, 'FC'):
         raise RuntimeError('Cannot request f-blas-lapack without Fortran compiler, maybe you want --download-f2cblaslapack=1?')
-      libdir = self.downLoadBlasLapack('f','f')            
+      if self.defaultPrecision == '__float128':
+        raise RuntimeError('Cannot use --download-f-blas-lapack with precision __float128, maybe you want --download-f2cblaslapack?')
+      libdir = self.downLoadBlasLapack('f','f')
       yield ('Downloaded BLAS/LAPACK library', os.path.join(libdir,'libfblas.a'), os.path.join(libdir,'libflapack.a'), 1)
-      raise RuntimeError('Could not use downloaded f-blas-lapack?')
+      raise RuntimeError('Could not use downloaded f-blas-lapack.')
     # Try specified BLASLAPACK library
     if 'with-blas-lapack-lib' in self.framework.argDB:
       yield ('User specified BLAS/LAPACK library', None, self.framework.argDB['with-blas-lapack-lib'], 1)
       yield ('User specified AMD ACML lib dir', None, os.path.join(dir,'lib','libacml.a'), 1)
       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)      
+      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 ('Default compiler locations with gfortran', None, ['liblapack.a', 'libblas.a','libgfortran.a'], 1)
     # Try MacOSX location
     dir = os.path.join('/Library', 'Frameworks', 'Intel_MKL.framework','Libraries','32')
-    yield ('MacOSX with Intel MKL', None, [os.path.join(dir,'libmkl_lapack.a'),'libmkl_ia32.a','libguide.a'], 1)    
+    yield ('MacOSX with Intel MKL', None, [os.path.join(dir,'libmkl_lapack.a'),'libmkl_ia32.a','libguide.a'], 1)
     yield ('MacOSX BLAS/LAPACK library', None, os.path.join('/System', 'Library', 'Frameworks', 'vecLib.framework', 'vecLib'), 1)
     # Sun locations
     yield ('Sun sunperf BLAS/LAPACK library', None, ['libsunperf.a','libsunmath.a','libm.a'], 1)
         yield ('Microsoft Windows, Intel MKL library', None, os.path.join(mkldir,'mkl_c_dll.lib'), 1)
         yield ('Microsoft Windows, Intel MKL stdcall library', None, os.path.join(mkldir,'mkl_s_dll.lib'), 1)
         mkldir = os.path.join(mklpath, 'em64t', 'lib')
-        yield ('Microsoft Windows, em64t Intel MKL library', None, os.path.join(mkldir,'mkl_dll.lib'), 1)      
+        yield ('Microsoft Windows, em64t Intel MKL library', None, os.path.join(mkldir,'mkl_dll.lib'), 1)
         mkldir = os.path.join(mklpath, 'ia64', 'lib')
         yield ('Microsoft Windows, ia64 Intel MKL library', None, os.path.join(mkldir,'mkl_dll.lib'), 1)
     if self.framework.argDB['download-f-blas-lapack'] == 2:
       if not hasattr(self.compilers, 'FC'):
         raise RuntimeError('Cannot request f-blas-lapack without Fortran compiler, maybe you want --download-f2cblaslapack=1?')
-      libdir = self.downLoadBlasLapack('f','f')            
+      libdir = self.downLoadBlasLapack('f','f')
       yield ('Downloaded BLAS/LAPACK library', os.path.join(libdir,'libfblas.a'), os.path.join(libdir,'libflapack.a'), 1)
     return
 
     blasDir = self.packageDir
 
     g = open(os.path.join(blasDir,'tmpmakefile'),'w')
-    f = open(os.path.join(blasDir,'makefile'),'r')    
+    f = open(os.path.join(blasDir,'makefile'),'r')
     line = f.readline()
     while line:
       if line.startswith('CC  '):
         self.setCompilers.pushLanguage('FC')
         line = 'FOPTFLAGS  = '+self.setCompilers.getCompilerFlags().replace('-Mfree','')+'\n'
         noopt = self.checkNoOptFlag()
-        self.setCompilers.popLanguage()       
+        self.setCompilers.popLanguage()
       if line.startswith('FNOOPT'):
         self.setCompilers.pushLanguage('FC')
         line = 'FNOOPT = '+noopt+' '+self.getSharedFlag(self.setCompilers.getCompilerFlags())+' '+self.getPrecisionFlag(self.setCompilers.getCompilerFlags())+' '+self.getWindowsNonOptFlags(self.setCompilers.getCompilerFlags())+'\n'
         line = 'RANLIB = '+self.setCompilers.RANLIB+'\n'
       if line.startswith('RM  '):
         line = 'RM = '+self.programs.RM+'\n'
-      
+
 
       if line.startswith('include'):
         line = '\n'
       output,err,ret  = config.base.Configure.executeShellCommand('cd '+blasDir+' && mv -f lib'+f2c+'blas.'+self.setCompilers.AR_LIB_SUFFIX+' lib'+f2c+'lapack.'+self.setCompilers.AR_LIB_SUFFIX+' '+ libdir, timeout=30, log = self.framework.log)
     except RuntimeError, e:
       raise RuntimeError('Error moving '+blasDir+' libraries: '+str(e))
-
-    if self.framework.argDB['with-iphone']:
-      # Build version of C BLAS/LAPACK suitable for the iPhone
-      # Note: regular libraries are also built because iPhone libraries cannot be tested with ./configure
-      debug = 'Debug'
-      debugdir = 'Debug-iphonesimulator'
-      if not self.compilerFlags.debugging:
-        debug = 'Release'
-        debugdir = 'Release-iphoneos'
-      try:
-        output,err,ret  = config.base.Configure.executeShellCommand('cd '+os.path.join(blasDir,'BlasLapack')+' && xcodebuild -configuration '+debug, timeout=3000, log = self.framework.log)
-      except RuntimeError, e:
-        raise RuntimeError('Error making iPhone version of BLAS/LAPACK on '+blasDir+': '+str(e))
-      try:
-        output,err,ret  = config.base.Configure.executeShellCommand('mv -f '+os.path.join(blasDir,'BlasLapack','build',debugdir,'libBlasLapack.a')+' '+libdir, timeout=30, log = self.framework.log)
-      except RuntimeError, e:
-        raise RuntimeError('Error copying iPhone version of BLAS/LAPACK libraries on '+blasDir+': '+str(e))
-      
     try:
       output,err,ret  = config.base.Configure.executeShellCommand('cd '+blasDir+' && cp -f tmpmakefile '+os.path.join(self.confDir, self.name), timeout=30, log = self.framework.log)
     except RuntimeError, e:
       pass
     return libdir
-  
+
   def configureLibrary(self):
     self.functionalBlasLapack = []
     self.foundBlas   = 0
         import glob
         blib = glob.glob('/usr/lib/libblas.*')
         if blib != [] and not (os.path.isfile('/usr/lib/libblas.so') or os.path.isfile('/usr/lib/libblas.a')):
-          raise RuntimeError('Incomplete BLAS install? Perhaps blas package is installed - but blas-dev/blas-devel is required.')
+          raise RuntimeError('Incomplete BLAS install; Perhaps blas package is installed - but blas-dev/blas-devel is required?')
         if hasattr(self.compilers, 'FC'): C = 'f'
         else: C = 'c'
         raise RuntimeError('Could not find a functional BLAS. Run with --with-blas-lib=<lib> to indicate the library containing BLAS.\n Or --download-'+C+'-blas-lapack=1 to have one automatically downloaded and installed\n')
         import glob
         llib = glob.glob('/usr/lib/liblapack.*')
         if llib != [] and not (os.path.isfile('/usr/lib/liblapack.so') or os.path.isfile('/usr/lib/liblapack.a')):
-          raise RuntimeError('Incomplete LAPACK install? Perhaps lapack package is installed - but lapack-dev/lapack-devel is required.')
+          raise RuntimeError('Incomplete LAPACK install; Perhaps lapack package is installed - but lapack-dev/lapack-devel is required?')
         if hasattr(self.compilers, 'FC'): C = 'f'
         else: C = 'c'
         raise RuntimeError('Could not find a functional LAPACK. Run with --with-lapack-lib=<lib> to indicate the library containing LAPACK.\n Or --download-'+C+'-blas-lapack=1 to have one automatically downloaded and installed\n')
+
+    #  allow user to dictate which blas/lapack mangling to use (some blas/lapack libraries, like on Apple, provide several)
+    if 'known-blaslapack-mangling' in self.argDB:
+      self.mangling = self.argDB['known-blaslapack-mangling']
+
     if self.mangling == 'underscore':
         self.addDefine('BLASLAPACK_UNDERSCORE', 1)
     elif self.mangling == 'caps':
 
   def checkPESSL(self):
     '''Check for the IBM PESSL library - and error out - if used instead of ESSL'''
-    if self.libraries.check(self.lapackLibrary, 'pdgemm'):
+    if self.libraries.check(self.lapackLibrary, 'ipessl'):
       raise RuntimeError('Cannot use PESSL instead of ESSL!')
     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','geqrf']:
+      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','steqr']:
         prefix = self.getPrefix()
         if self.f2c:
           if self.mangling == 'underscore':

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.downloadpath      = 'http://ftp.mcs.anl.gov/pub/fathom/'
     self.downloadname      = 'moab'
     self.downloadfilename  = 'moab'
-    self.downloadversion   = '3.99-10-18-2010'
+    self.downloadversion   = 'nightly'
     self.downloadext       = 'tar.gz'
 
     self.functions         = ['iMesh_newMesh']
 
   def setupDependencies(self, framework):
     config.package.GNUPackage.setupDependencies(self, framework)
-    self.mpi             = framework.require('config.packages.MPI', self)
-    self.hdf5            = framework.require('config.packages.hdf5', self)
-    self.netcdf          = framework.require('config.packages.netcdf', self)
-    self.odeps           = [self.mpi, self.hdf5, self.netcdf]
+    self.mpi       = framework.require('config.packages.MPI', self)
+    self.hdf5      = framework.require('config.packages.hdf5', self)
+    self.netcdf    = framework.require('config.packages.netcdf', self)
+#    self.netcdfcxx = framework.require('config.packages.netcdf-cxx', self)
+    self.odeps     = [self.mpi, self.hdf5, self.netcdf]
     return
 
 

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.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_openmpi   = ['http://www.open-mpi.org/software/ompi/v1.6/downloads/openmpi-1.6.3.tar.gz']
+    self.download_mpich     = ['http://www.mpich.org/static/tarballs/3.0.2/mpich-3.0.2.tar.gz',
+                               'http://ftp.mcs.anl.gov/pub/petsc/externalpackages/mpich-3.0.2.tar.gz']
+    self.download_mpich_sol = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/mpich2-1.5.tar.gz']
     self.download           = ['redefine']
     self.functions          = ['MPI_Init', 'MPI_Comm_create']
     self.includes           = ['mpi.h']
     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-shared=<bool>',                     nargs.ArgBool(None, 1, 'Install MPICH with shared libraries'))
     help.addArgument('MPI', '-with-mpiuni-fortran-binding=<bool>',               nargs.ArgBool(None, 1, 'Build the MPIUni Fortran bindings'))
     return
 
     if self.checkLink('#include <mpi.h>\n', 'if (MPI_Allreduce(MPI_IN_PLACE,0, 1, MPI_INT, MPI_SUM, MPI_COMM_SELF));\n'):
       self.haveInPlace = 1
       self.addDefine('HAVE_MPI_IN_PLACE', 1)
+    if self.checkLink('#include <mpi.h>\n', 'int count=2; int blocklens[2]={0,1}; MPI_Aint indices[2]={0,1}; MPI_Datatype old_types[2]={0,1}; MPI_Datatype *newtype = 0;\n \
+                                             if (MPI_Type_create_struct(count, blocklens, indices, old_types, newtype));\n'):
+      self.haveTypeCreateStruct = 1
+    else:
+      self.haveTypeCreateStruct = 0
+      self.framework.addDefine('MPI_Type_create_struct(count,lens,displs,types,newtype)', 'MPI_Type_struct((count),(lens),(displs),(types),(newtype))')
+    if self.checkLink('#include <mpi.h>\n', 'MPI_Comm_errhandler_fn * p_err_fun = 0; MPI_Errhandler * p_errhandler = 0; if (MPI_Comm_create_errhandler(p_err_fun,p_errhandler));\n'):
+      self.haveCommCreateErrhandler = 1
+    else:
+      self.haveCommCreateErrhandler = 0
+      self.framework.addDefine('MPI_Comm_create_errhandler(p_err_fun,p_errhandler)', 'MPI_Errhandler_create((p_err_fun),(p_errhandler))')
+    if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_set_errhandler(MPI_COMM_WORLD,MPI_ERRORS_RETURN));\n'):
+      self.haveCommSetErrhandler = 1
+    else:
+      self.haveCommSetErrhandler = 0
+      self.framework.addDefine('MPI_Comm_set_errhandler(comm,p_errhandler)', 'MPI_Errhandler_set((comm),(p_errhandler))')
     self.compilers.CPPFLAGS = oldFlags
     self.compilers.LIBS = oldLibs
     return
     oldLibs  = self.compilers.LIBS
     self.compilers.CPPFLAGS += ' '+self.headers.toString(self.include)
     self.compilers.LIBS = self.libraries.toString(self.lib)+' '+self.compilers.LIBS
-    if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_f2c(MPI_COMM_WORLD));\n'):
+    if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_f2c((MPI_Fint)0));\n'):
       self.commf2c = 1
       self.addDefine('HAVE_MPI_COMM_F2C', 1)
     if self.checkLink('#include <mpi.h>\n', 'if (MPI_Comm_c2f(MPI_COMM_WORLD));\n'):
     self.addDefine('HAVE_MPI_COMM_C2F', 1)
     self.addDefine('HAVE_MPI_FINT', 1)
     self.addDefine('HAVE_MPI_IN_PLACE', 1)
+    self.framework.addDefine('MPI_Type_create_struct(count,lens,displs,types,newtype)', 'MPI_Type_struct((count),(lens),(displs),(types),(newtype))')
+    self.framework.addDefine('MPI_Comm_create_errhandler(p_err_fun,p_errhandler)', 'MPI_Errhandler_create((p_err_fun),(p_errhandler))')
+    self.framework.addDefine('MPI_Comm_set_errhandler(comm,p_errhandler)', 'MPI_Errhandler_set((comm),(p_errhandler))')
     if not self.argDB['with-mpiuni-fortran-binding']:
       self.framework.addDefine('MPIUNI_AVOID_MPI_NAMESPACE', 1)
       self.usingMPIUniFortranBinding = 0
     if self.framework.argDB['download-openmpi'] and self.framework.argDB['prefix']:
       raise RuntimeError('Currently --download-openmpi option does not work with --prefix install.\nSuggest installing OpenMPI separately, and then configuring PETSc with --with-mpi-dir option.')
 
+    if self.framework.argDB['download-mpich'] and self.framework.argDB['prefix']:
+      raise RuntimeError('Currently --download-mpich option does not work with --prefix install.\nSuggest installing MPICH separately, and then configuring PETSc with --with-mpi-dir option.')
+
     # Check for MPICH
     if self.framework.argDB['download-mpich']:
       if config.setCompilers.Configure.isCygwin() and not config.setCompilers.Configure.isGNU(self.setCompilers.CC):
         raise RuntimeError('Sorry, cannot download-install MPICH on Windows. Sugest installing windows version of MPICH manually')
       self.liblist      = [[]]
-      self.download         = self.download_mpich
+      if config.setCompilers.Configure.isSolaris():
+        self.download         = self.download_mpich_sol
+      else:
+        self.download         = self.download_mpich
       self.downloadname     = 'mpich'
       self.downloadfilename = 'mpich'
       return config.package.Package.checkDownload(self, requireDownload)
     if not self.framework.argDB['with-shared-libraries']:
       args.append('--enable-shared=no')
       args.append('--enable-static=yes')
+    # openmpi install breaks with papi-5?
+    args.append('--disable-vt')
     args = ' '.join(args)
 
     f = file(os.path.join(self.packageDir, 'args.petsc'), 'w')
         raise RuntimeError('Error running configure on OPENMPI/MPI: '+str(e))
       try:
         self.logPrintBox('Compiling OPENMPI/MPI; this may take several minutes')
-        output,err,ret  = config.base.Configure.executeShellCommand('cd '+openmpiDir+' && make install', timeout=6000, log = self.framework.log)
-        output,err,ret  = config.base.Configure.executeShellCommand('cd '+openmpiDir+' && make clean', timeout=200, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+openmpiDir+' && '+self.programs.make+' clean', timeout=200, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+openmpiDir+' && '+self.programs.make+' -j ' + str(self.programs.make_np)+' all', timeout=6000, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+openmpiDir+' && '+self.programs.make+' install', timeout=6000, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+openmpiDir+' && '+self.programs.make+' clean', timeout=200, log = self.framework.log)
       except RuntimeError, e:
         raise RuntimeError('Error running make on OPENMPI/MPI: '+str(e))
       if not os.path.isdir(os.path.join(installDir,'lib')):
     else:
       args.append('--disable-f77')
       args.append('--disable-fc')
-    if self.framework.argDB['with-shared-libraries'] or self.framework.argDB['download-mpich-shared']:
+    if self.framework.argDB['download-mpich-shared']:
       args.append('--enable-shared') # --enable-sharedlibs can now be removed?
       if self.compilers.isGCC or config.setCompilers.Configure.isIntel(compiler):
         if config.setCompilers.Configure.isDarwin():
         raise RuntimeError('Error running configure on MPICH: '+str(e))
       try:
         self.logPrintBox('Running make on MPICH; this may take several minutes')
-        output,err,ret  = config.base.Configure.executeShellCommand('cd '+mpichDir+' && make && make install', timeout=6000, log = self.framework.log)
-        output,err,ret  = config.base.Configure.executeShellCommand('cd '+mpichDir+' && make clean', timeout=200, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+mpichDir+' && '+self.programs.make+' clean', timeout=200, log = self.framework.log)
+        makej_cmd = self.programs.make+' -j ' + str(self.programs.make_np)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+mpichDir+' && '+makej_cmd+' all', timeout=6000, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+mpichDir+' && '+self.programs.make+' install', timeout=6000, log = self.framework.log)
+        output,err,ret  = config.base.Configure.executeShellCommand('cd '+mpichDir+' && '+self.programs.make+' clean', timeout=200, log = self.framework.log)
       except RuntimeError, e:
         import sys
         if sys.platform.startswith('cygwin'):
     # Both MPICH and MVAPICH now depend on LD_LIBRARY_PATH for sharedlibraries.
     # So using LD_LIBRARY_PATH in configure - and -Wl,-rpath in makefiles
     if self.framework.argDB['with-shared-libraries']:
-      if 'LD_LIBRARY_PATH' in os.environ:
-        ldPath=os.environ['LD_LIBRARY_PATH']
-      else:
-        ldPath=''
-      if ldPath == '': ldPath = os.path.join(installDir,'lib')
-      else: ldPath += ':' + os.path.join(installDir,'lib')
-      os.environ['LD_LIBRARY_PATH'] = ldPath
-
+      config.setCompilers.Configure.addLdPath(os.path.join(installDir,'lib'))
     # Initialize to empty
     mpicc=''
     mpicxx=''
     # check if mpi.mod exists
     if self.compilers.fortranIsF90:
       self.framework.log.write('Checking for mpi.mod\n')
-      if self.libraries.check(self.lib,'', call = '       use mpi\n       integer ierr\n       call mpi_init(ierr)'):
+      if self.libraries.check(self.lib,'', call = '       use mpi\n       integer ierr,rank\n       call mpi_init(ierr)\n       call mpi_comm_rank(MPI_COMM_WORLD,rank,ierr)\n'):
         self.havef90module = 1
         self.addDefine('HAVE_MPI_F90MODULE', 1)
     self.compilers.CPPFLAGS = oldFlags
     self.executeTest(self.findMPIInc)
     if self.libraries.check(self.dlib, "MPI_Alltoallw") and self.libraries.check(self.dlib, "MPI_Type_create_indexed_block"):
       self.addDefine('HAVE_MPI_ALLTOALLW',1)
-    if self.libraries.check(self.dlib, "MPI_Comm_spawn"):
-      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"):
-      self.addDefine('HAVE_MPI_EXSCAN',1)
+    funcs = '''MPI_Comm_spawn MPI_Type_get_envelope MPI_Type_get_extent MPI_Type_dup MPI_Init_thread
+      MPIX_Iallreduce MPI_Iallreduce MPI_Ibarrier MPI_Finalized MPI_Exscan'''.split()
+    for f in funcs:
+      if self.libraries.check(self.dlib, f):
+        self.addDefine('HAVE_' + f.upper(),1)
+    if self.libraries.check(self.dlib, "MPIDI_CH3I_sock_set"):
+      self.addDefine('HAVE_MPICH_CH3_SOCK', 1)
+    if self.libraries.check(self.dlib, "MPIDI_CH3I_sock_fixed_nbc_progress"):
+      # Indicates that this bug was fixed: http://trac.mpich.org/projects/mpich/ticket/1785
+      self.addDefine('HAVE_MPICH_CH3_SOCK_FIXED_NBC_PROGRESS', 1)
 
 if __name__ == '__main__':
   import config.framework

config/BuildSystem/config/packages/PETSc.py

     if not isinstance(libraries, list): libraries = [libraries]
     oldLibs = self.compilers.LIBS
     self.libraries.pushLanguage(self.languages.clanguage)
-    found   = (self.libraries.check(libraries, 'PetscInitializeNoArguments', otherLibs = self.otherLibs, prototype = 'int PetscInitializeNoArguments(void);', cxxMangle = not self.languages.cSupport) and
-               self.libraries.check(libraries, 'VecDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_Vec *Vec;int VecDestroy(Vec*);', call = 'VecDestroy((Vec*) 0)', cxxMangle = not self.languages.cSupport) and
-               self.libraries.check(libraries, 'MatDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_Mat *Mat;int MatDestroy(Mat*);', call = 'MatDestroy((Mat*) 0)', cxxMangle = not self.languages.cSupport) and
-               self.libraries.check(libraries, 'DMDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_DM *DA;int DMDestroy(DA*);', call = 'DMDestroy((DA*) 0)', cxxMangle = not self.languages.cSupport) and
-               self.libraries.check(libraries, 'KSPDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_KSP *KSP;int KSPDestroy(KSP*);', call = 'KSPDestroy((KSP*) 0)', cxxMangle = not self.languages.cSupport) andPetscViewerASCIISynchronizedAllow
-               self.libraries.check(libraries, 'SNESDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_SNES *SNES;int SNESDestroy(SNES*);', call = 'SNESDestroy((SNES*) 0)', cxxMangle = not self.languages.cSupport) and
-               self.libraries.check(libraries, 'TSDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_TS *TS;int TSDestroy(TS*);', call = 'TSDestroy((TS*) 0)', cxxMangle = not self.languages.cSupport))
+    found   = (self.libraries.check(libraries, 'PetscInitializeNoArguments', otherLibs = self.otherLibs, prototype = 'int PetscInitializeNoArguments(void);') and
+               self.libraries.check(libraries, 'VecDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_Vec *Vec;int VecDestroy(Vec*);', call = 'VecDestroy((Vec*) 0)') and
+               self.libraries.check(libraries, 'MatDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_Mat *Mat;int MatDestroy(Mat*);', call = 'MatDestroy((Mat*) 0)') and
+               self.libraries.check(libraries, 'DMDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_DM *DA;int DMDestroy(DA*);', call = 'DMDestroy((DA*) 0)') and
+               self.libraries.check(libraries, 'KSPDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_KSP *KSP;int KSPDestroy(KSP*);', call = 'KSPDestroy((KSP*) 0)') and
+               self.libraries.check(libraries, 'SNESDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_SNES *SNES;int SNESDestroy(SNES*);', call = 'SNESDestroy((SNES*) 0)') and
+               self.libraries.check(libraries, 'TSDestroy', otherLibs = self.otherLibs, prototype = 'typedef struct _p_TS *TS;int TSDestroy(TS*);', call = 'TSDestroy((TS*) 0)'))
     self.libraries.popLanguage()
     self.compilers.LIBS = oldLibs
     return found
   def checkWorkingLink(self):
     '''Checking that we can link a PETSc executable'''
     self.pushLanguage(self.languages.clanguage)
-    if not self.checkPETScLink('#include <petsclog.h>\n', 'PetscLogDouble time;\nPetscErrorCode ierr;\n\nierr = PetscGetTime(&time); CHKERRQ(ierr);\n'):
+    if not self.checkPETScLink('#include <petsclog.h>\n', 'PetscLogDouble time;\nPetscErrorCode ierr;\n\nierr = PetscGetTime(&time);CHKERRQ(ierr);\n'):
       self.logPrint('PETSc cannot link, which indicates a problem with the PETSc installation')
       return 0
     self.logPrint('PETSc can link with '+self.languages.clanguage)
     if hasattr(self.compilers, 'CXX') and self.languages.clanguage == 'C':
       self.pushLanguage('C++')
       self.sourceExtension = '.C'
-      if not self.checkPETScLink('#define PETSC_USE_EXTERN_CXX\n#include <petsc.h>\n', 'PetscLogDouble time;\nPetscErrorCode ierr;\n\nierr = PetscGetTime(&time); CHKERRQ(ierr);\n'):
+      if not self.checkPETScLink('#define PETSC_USE_EXTERN_CXX\n#include <petsc.h>\n', 'PetscLogDouble time;\nPetscErrorCode ierr;\n\nierr = PetscGetTime(&time);CHKERRQ(ierr);\n'):
         self.logPrint('PETSc cannot link C++ but can link C, which indicates a problem with the PETSc installation')
         self.popLanguage()
         return 0
       self.popLanguage()
       self.logPrint('PETSc can link with C++')
-    
+
     if hasattr(self.compilers, 'FC'):
       self.pushLanguage('FC')
       self.sourceExtension = '.F'
   def checkSharedLibrary(self, libraries):
     '''Check that the libraries for PETSc are shared libraries'''
     if config.setCompilers.Configure.isDarwin():
-      # on Apple if you list the MPI libraries again you will generate multiply defined errors 
+      # on Apple if you list the MPI libraries again you will generate multiply defined errors
       # since they are already copied into the PETSc dynamic library.
       self.setOtherLibs([])
     self.pushLanguage(self.languages.clanguage)

config/BuildSystem/config/packages/UMFPACK.py

     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']]
+                      ['libumfpack.a','libcholmod.a','libcamd.a','libccolamd.a','libcolamd.a','libamd.a','libsuitesparseconfig.a','libmetis.a'],
+                      ['libumfpack.a','libcholmod.a','libcamd.a','libccolamd.a','libcolamd.a','libamd.a','libsuitesparseconfig.a','libmetis.a','librt.a']]
     self.functions = ['umfpack_di_report_info','umfpack_dl_symbolic','umfpack_dl_numeric','umfpack_dl_wsolve']
     self.includes  = ['umfpack.h']
     self.complex   = 1
     self.blasLapack = framework.require('config.packages.BlasLapack',self)
     self.deps       = [self.blasLapack]
     return
-          
+
   def Install(self):
     self.framework.log.write('umfpackDir = '+self.packageDir+' installDir '+self.installDir+'\n')
 
     g.write('INSTALL_LIB       = ' + self.libDir + '\n')
     g.write('INSTALL_INCLUDE   = ' + self.includeDir + '\n')
     g.close()
-    
+
     # Build UMFPACK
     if self.installNeeded(mkfile):
       try:

config/BuildSystem/config/packages/__init__.py

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

config/BuildSystem/config/packages/exodusii.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/exodusii-5.14-petsc.tgz']
-    self.liblist    = [['libexoIIv2for.a', 'libexodus.a'], ['libexoIIv2for.a', 'libexoIIv2c.a']]
+    self.download   = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/exodusii-5.22b.tar.gz']
+    self.liblist    = [['libexoIIv2for.a', 'libexodus.a'], ['libexoIIv2for.a', 'libexoIIv2c.a'], ['libexoIIv2c.a']]
     self.functions  = ['ex_close']
     self.includes   = ['exodusII.h']
     self.includedir = ['include', os.path.join('cbind', 'include'), os.path.join('forbind', 'include')]
     return
 
   def Install(self):
-    self.framework.log.write('exodusIIDir = '+self.packageDir+' installDir '+self.installDir+'\n')
+    self.logPrintBox('Compiling ExodusII; this may take several minutes')
+    import os
+    import shutil
+    configOpts     = []
+    configOpts.append('RANLIB="'+self.setCompilers.RANLIB+'"')
+    configOpts.append('AR="'+self.setCompilers.AR+' '+self.setCompilers.AR_FLAGS+'"')
+    configOpts.append('NETCDF="'+self.installDir+'"')
 
-    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')
-    g.write('CC_FLAGS = '+self.setCompilers.getCompilerFlags()+'\n')
+    configOpts.append('CC="'+self.setCompilers.getCompiler()+'"')
+    configOpts.append('CCOPTIONS="'+self.setCompilers.getCompilerFlags()+' -DADDC_ "')
     self.setCompilers.popLanguage()
 
-    self.setCompilers.pushLanguage('FC')
-    g.write('FC = '+self.setCompilers.getCompiler()+'\n')
-    g.write('FC_FLAGS = '+self.setCompilers.getCompilerFlags()+'\n')
+    if hasattr(self.setCompilers, 'FC'):
+      self.setCompilers.pushLanguage('FC')
+      configOpts.append('FC="'+self.setCompilers.getCompiler()+'"')
+      configOpts.append('F77OPTIONS="'+self.setCompilers.getCompilerFlags()+'"')
     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()
+    mkfile = 'make.inc'
+    g = open(os.path.join(self.packageDir, mkfile), 'w')
+    self.framework.log.write(repr(dir(self.setCompilers)))
+
+    args = ' '.join(configOpts)
+    fd = file(os.path.join(self.packageDir,'exodusii'), 'w')
+    fd.write(args)
+    fd.close()
 
-    if self.installNeeded(mkfile):
+    if self.installNeeded('exodusii'):
+      cincludes  = ['exodusII.h','exodusII_cfg.h','exodusII_int.h','exodusII_par.h']
+      fincludes  = ['exodusII.inc','exodusII_int.inc']
       try:
         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)
+        output,err,ret = config.base.Configure.executeShellCommand('cd '+self.packageDir+' && make -f Makefile.standalone libexodus.a '+args, timeout=2500, log = self.framework.log)
+        shutil.copy(os.path.join(self.packageDir,'libexodus.a'),os.path.join(self.installDir,'lib'))
+        for i in cincludes:
+          shutil.copy(os.path.join(self.packageDir,'cbind','include',i),os.path.join(self.installDir,'include'))
+        if hasattr(self.setCompilers, 'FC'):
+          output,err,ret = config.base.Configure.executeShellCommand('cd '+self.packageDir+' && make -f Makefile.standalone libexoIIv2for.a '+args, timeout=2500, log = self.framework.log)
+          shutil.copy(os.path.join(self.packageDir,'libexoIIv2for.a'),os.path.join(self.installDir,'lib'))
+          for i in fincludes:
+            shutil.copy(os.path.join(self.packageDir,'forbind','include',i),os.path.join(self.installDir,'include'))
       except RuntimeError, e:
         raise RuntimeError('Error running make on exodusII: '+str(e))
       self.postInstall(output+err, mkfile)

config/BuildSystem/config/packages/f2cblaslapack.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/f2cblaslapack-3.1.1.q.tar.gz']
+    self.download         = ['http://ftp.mcs.anl.gov/pub/petsc/externalpackages/f2cblaslapack-3.4.1.q.tar.gz']
     self.double           = 0
     self.worksonWindows   = 1
     self.downloadonWindows= 1

config/BuildSystem/config/packages/netcdf-cxx.py

+import config.package
+import os
+
+class Configure(config.package.GNUPackage):
+  def __init__(self, framework):
+    config.package.GNUPackage.__init__(self, framework)
+    self.downloadpath     = 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/'
+    self.downloadext      = 'tar.gz'
+    self.downloadversion  = '4-4.2'
+    self.functions        = []
+    self.includes         = ['netcdfcpp.h']
+    self.liblist          = [['libnetcdf_c++.a']]
+    self.cxx              = 1
+    return
+
+  def setupDownload(self):
+    '''Need this because the default puts a '-' between the name and the version number'''
+    self.download = [self.downloadpath+self.downloadname+self.downloadversion+'.'+self.downloadext]
+
+  def setupDependencies(self, framework):
+    config.package.GNUPackage.setupDependencies(self, framework)
+    self.mpi    = framework.require('config.packages.MPI', self)
+    self.hdf5   = framework.require('config.packages.hdf5', self)
+    self.netcdf = framework.require('config.packages.netcdf', self)
+    self.odeps  = [self.mpi, self.hdf5, self.netcdf]
+    self.deps   = [self.mpi]
+    return
+
+  def formGNUConfigureExtraArgs(self):
+    '''Specify archiver, libdir, disable DAP and HDF4, enable NetCDF4'''
+    args = []
+    args.append('AR="'+self.setCompilers.AR+'"')
+    args.append('ARFLAGS="'+self.setCompilers.AR_FLAGS+'"')
+    args.append('--libdir='+os.path.join(self.installDir,self.libdir))
+    return args

config/BuildSystem/config/packages/netcdf.py

 import config.package
-
-# Eventually, we should support HDF5:
-#   ./configure --enable-netcdf-4 --with-hdf5=/home/ed/local --with-zlib=/home/ed/local --prefix=/home/ed/local
+import os
 
 class Configure(config.package.GNUPackage):
   def __init__(self, framework):
     config.package.GNUPackage.__init__(self, framework)
     self.downloadpath    = 'http://www.unidata.ucar.edu/downloads/netcdf/ftp/'
     self.downloadext     = 'tar.gz'
-    self.downloadversion = '4.1.1'
+    self.downloadversion = '4.2.1.1'
     self.functions       = ['nccreate']
     self.includes        = ['netcdf.h']
-    self.liblist         = [['libnetcdf_c++.a','libnetcdf.a']]
+    self.liblist         = [['libnetcdf.a']]
     self.cxx             = 1
+    self.excludedDirs    = ['netcdf-cxx']
     return
 
   def setupDependencies(self, framework):
     self.mpi   = framework.require('config.packages.MPI', self)
     self.hdf5  = framework.require('config.packages.hdf5', self)
     self.odeps = [self.mpi, self.hdf5]
+    self.deps  = [self.mpi]
     return
 
-  def Install(self):
-    import os, sys
-
-    makeinc        = os.path.join(self.packageDir, 'make.inc')
-    installmakeinc = os.path.join(self.confDir, 'NetCDF')
-    configEnv      = []
-    configOpts     = []
-    # Unused flags: F90, CPPFLAGS, LIBS, FLIBS
-    g = open(makeinc, 'w')
-    g.write('AR             = '+self.setCompilers.AR+'\n')
-    g.write('ARFLAGS        = '+self.setCompilers.AR_FLAGS+'\n')
-    configEnv.append('AR="'+self.setCompilers.AR+'"')
-    configEnv.append('ARFLAGS="'+self.setCompilers.AR_FLAGS+'"')
-
-    g.write('NETCDF_ROOT    = '+self.packageDir+'\n')
-    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','')
-    cflags += ' ' + self.headers.toString(self.mpi.include)+' '+self.headers.toString('.')
-    g.write('CC             = '+self.setCompilers.getCompiler()+'\n')
-    g.write('CFLAGS         = '+cflags+'\n')
-    configEnv.append('CC="'+self.setCompilers.getCompiler()+'"')
-    configEnv.append('CFLAGS="'+cflags+'"')
-    self.setCompilers.popLanguage()
-
-    if hasattr(self.setCompilers, 'CXX'):
-      self.setCompilers.pushLanguage('Cxx')
-      cxxflags = self.setCompilers.getCompilerFlags().replace('-Wall','').replace('-Wshadow','')
-      cxxflags += ' ' + self.headers.toString(self.mpi.include)+' '+self.headers.toString('.')
-      g.write('CXX            = '+self.setCompilers.getCompiler()+'\n')
-      g.write('CXXFLAGS       = '+cflags+'\n')
-      configEnv.append('CXX="'+self.setCompilers.getCompiler()+'"')
-      configEnv.append('CXXFLAGS="'+cxxflags+'"')
-      self.setCompilers.popLanguage()
-    else:
-      configOpts.append('--disable-cxx')
-
-    if hasattr(self.setCompilers, 'FC'):
-      self.setCompilers.pushLanguage('FC')
-      fcflags = self.setCompilers.getCompilerFlags().replace('-Wall','').replace('-Wshadow','')
-      fcflags += ' ' + self.headers.toString(self.mpi.include)+' '+self.headers.toString('.')
-      g.write('FC             = '+self.setCompilers.getCompiler()+'\n')
-      g.write('FCFLAGS        = '+fcflags+'\n')
-      configEnv.append('FC="'+self.setCompilers.getCompiler()+'"')
-      configEnv.append('FCFLAGS="'+fcflags+'"')
-      if self.compilers.fortranIsF90:
-        configEnv.append('F90="'+self.setCompilers.getCompiler()+'"')
-      else:
-        configOpts.append('--disable-f90')
-      self.setCompilers.popLanguage()
-    else:
-      configOpts.append('--disable-f77')
-
-    if self.setCompilers.sharedLibraries:
-      configOpts.append('--enable-shared')
-    g.close()
-
-    if self.installNeeded('make.inc'):    # Now compile & install
-      try:
-        self.logPrintBox('Configuring NetCDF; this may take several minutes')
-        output,err,ret  = self.executeShellCommand('cd '+self.packageDir+' && '+' '.join(configEnv)+' ./configure '+' '.join(configOpts), timeout=2500, log = self.framework.log)
-        self.logPrintBox('Compiling & installing NetCDF; this may take several minutes')
-        output,err,ret  = self.executeShellCommand('cd '+self.packageDir+' && make clean && make && make install && make clean', timeout=2500, log = self.framework.log)
-      except RuntimeError, e:
-        raise RuntimeError('Error running make on NetCDF: '+str(e))
-      self.postInstall(output+err,'make.inc')
-    return self.installDir
+  def formGNUConfigureExtraArgs(self):
+    '''Specify archiver, libdir, disable DAP and HDF4, enable NetCDF4'''
+    args = []
+    args.append('AR="'+self.setCompilers.AR+'"')
+    args.append('ARFLAGS="'+self.setCompilers.AR_FLAGS+'"')
+    args.append('--libdir='+os.path.join(self.installDir,self.libdir))
+    args.append('--disable-dap')
+    args.append('--disable-hdf4')
+    args.append('--enable-netcdf-4')
+    return args

config/BuildSystem/config/programs.py

 *** Incomplete cygwin install detected . /usr/bin/make is missing. **************
 *** Please rerun cygwin-setup and select module "make" for install.**************''')
       else:
-        raise RuntimeError('Could not locate the make utility on your system, make sure\n it is in your path or use --with-make=/fullpathnameofmake\n and run ./configure again')    
+        raise RuntimeError('Could not locate the make utility on your system, make sure\n it is in your path or use --with-make=/fullpathnameofmake\n and run ./configure again')
     # Check for GNU make
     haveGNUMake = 0
     self.getExecutable('strings', getFullPath = 1)
           haveGNUMake = 1
       except RuntimeError, e:
         self.framework.log.write('Make check failed: '+str(e)+'\n')
-        
+
     # Setup make flags
     self.flags = ''
     if haveGNUMake:
       self.flags += ' --no-print-directory'
     self.addMakeMacro('OMAKE ', self.make+' '+self.flags)
-      
+
     # Check to see if make allows rules which look inside archives
     if haveGNUMake:
-      self.addMakeRule('libc','${LIBNAME}(${OBJSC} ${SOBJSC})')
+      self.addMakeRule('libc','${LIBNAME}(${OBJSC})')
+      self.addMakeRule('libcu','${LIBNAME}(${OBJSCU})')
     else:
       self.addMakeRule('libc','${OBJSC}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSC}')
+      self.addMakeRule('libcu','${OBJSCU}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSCU}')
     self.addMakeRule('libf','${OBJSF}','-${AR} ${AR_FLAGS} ${LIBNAME} ${OBJSF}')
 
     # check no of cores on the build machine [perhaps to do make '-j ncores']
     if not hasattr(self, 'mv'): raise RuntimeError('Could not locate mv executable')
     self.getExecutable('cp',   getFullPath = 1)
     if not hasattr(self, 'cp'): raise RuntimeError('Could not locate cp executable')
-    self.getExecutable('grep', getFullPath = 1)    
+    self.getExecutable('grep', getFullPath = 1)
     if not hasattr(self, 'grep'): raise RuntimeError('Could not locate grep executable')
     self.getExecutable('rm -f',getFullPath = 1, resultName = 'RM')
     if not hasattr(self, 'RM'): raise RuntimeError('Could not locate rm executable')
           raise RuntimeError('''\
 *** Fedora 8 Linux with broken diffutils-2.8.1-17.fc8 detected. ****************
 *** Run "sudo yum update diffutils" to get the latest bugfixed version. ********''')
-        raise RuntimeError(self.diff+' executable does not properly handle -w (whitespace) option')        
+        raise RuntimeError(self.diff+' executable does not properly handle -w (whitespace) option')
       self.diff = self.diff + ' -w'
       self.addMakeMacro('DIFF',self.diff)
     else:
     if not self.framework.argDB['with-make'] == '0':
       self.executeTest(self.configureMake)
       self.executeTest(self.configureMkdir)
-      self.executeTest(self.configurePrograms)    
+      self.executeTest(self.configurePrograms)
     return

config/BuildSystem/config/setCompilers.py

     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, None, 'Specify the C++ compiler options'))
-    help.addArgument('Compilers', '-CXX_CXXFLAGS=<string>', nargs.Arg(None, '',   'Specify the C++ compiler-only options'))
+    help.addArgument('Compilers', '-CXXFLAGS=<string>',     nargs.Arg(None, None, 'Specify the C++ compiler options, also passed to linker'))
+    help.addArgument('Compilers', '-CXX_CXXFLAGS=<string>', nargs.Arg(None, '',   'Specify the C++ compiler-only options, not passed to linker'))
     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', '-CUDAC=<prog>',         nargs.Arg(None, None, 'Specify the CUDA compiler'))
     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'))
 ##    help.addArgument('Compilers', '-CC_LD=<prog>',           nargs.Arg(None, None, 'Specify the linker for C only'))
 ##    help.addArgument('Compilers', '-CXX_LD=<prog>',          nargs.Arg(None, None, 'Specify the linker for C++ only'))
   isCompaqF90 = staticmethod(isCompaqF90)
 
   def isSun(compiler):
-    '''Returns true if the compiler is a Sun compiler'''
+    '''Returns true if the compiler is a Sun/Oracle compiler'''
     try:
-      (output, error, status) = config.base.Configure.executeShellCommand(compiler+' -flags')
+      (output, error, status) = config.base.Configure.executeShellCommand(compiler+' -V',checkCommand = noCheck)
       output = output + error
-      if output.find('Unrecognised option --help passed to ld') >=0:    # NAG f95 compiler
-        return 0
-      if output.find('http://www.sun.com') >= 0 or output.find('http://docs.sun.com') >=0:
+      if output.find(' Sun ') >= 0:
         return 1
     except RuntimeError:
       pass
       pass
     return 0
   isCray = staticmethod(isCray)
-  
+
   def isCrayVector(compiler):
     '''Returns true if the compiler is a Cray compiler for a Cray Vector system'''
     try:
       pass
     return 0
   isCrayVector = staticmethod(isCrayVector)
-  
+
 
   def isPGI(compiler):
     '''Returns true if the compiler is a PGI compiler'''
     return 0
   isAIXAR = staticmethod(isAIXAR)
 
-  
+
   def isLinux():
     '''Returns true if system is linux'''
     (output, error, status) = config.base.Configure.executeShellCommand('uname -s')
     return 0
   isWindows = staticmethod(isWindows)
 
+  def addLdPath(path):
+    import os
+    if 'LD_LIBRARY_PATH' in os.environ:
+      ldPath=os.environ['LD_LIBRARY_PATH']
+    else:
+      ldPath=''
+    if ldPath == '': ldPath = path
+    else: ldPath += ':' + path
+    os.environ['LD_LIBRARY_PATH'] = ldPath
+    return
+  addLdPath = staticmethod(addLdPath)
+
   def useMPICompilers(self):
     if ('with-cc' in self.argDB and self.argDB['with-cc'] != '0') or 'CC' in self.argDB:
       return 0
       if (not vendor) and self.framework.argDB['with-gnu-compilers']:
         yield 'gcc'
         if Configure.isGNU('cc'):
-          yield 'cc'     
+          yield 'cc'
       if not self.vendor is None:
         if not vendor and not Configure.isGNU('cc'):
           yield 'cc'
           yield 'xlc'
         if vendor == 'intel' or not vendor:
           yield 'icc'
-          yield 'ecc'          
+          yield 'ecc'
           yield 'win32fe icl'
         if vendor == 'microsoft' or not vendor:
           yield 'win32fe cl'
       if self.framework.argDB['with-gnu-compilers']:
         yield 'gcc'
         if Configure.isGNU('cc'):
-          yield 'cc'     
+          yield 'cc'
     return
 
   def checkCCompiler(self):
       if not self.vendor is None:
         if vendor == 'nvidia' or not vendor:
           yield 'nvcc'
-      yield 'nvcc'     
+      yield 'nvcc'
     return
 
   def checkCUDACompiler(self):
       raise RuntimeError('Keyword --with-c++ is WRONG, use --with-cxx')
     if self.framework.argDB.has_key('with-CC'):
       raise RuntimeError('Keyword --with-CC is WRONG, use --with-cxx')
-    
+
     if self.framework.argDB.has_key('with-cxx'):
       if self.framework.argDB['with-cxx'] == 'gcc': raise RuntimeError('Cannot use C compiler gcc as the C++ compiler passed in with --with-cxx')
       if self.isWindows(self.framework.argDB['with-cxx']):
           yield 'mpic++'
         if not self.vendor is None:
           yield 'mpCC_r'
-          yield 'mpCC'          
+          yield 'mpCC'
         self.usedMPICompilers = 0
       vendor = self.vendor
       if (not vendor) and self.framework.argDB['with-gnu-compilers']:
           yield 'xlC'
         if vendor == 'intel' or not vendor:
           yield 'icpc'
-          yield 'ccpc'          
+          yield 'ccpc'
           yield 'icc'
-          yield 'ecc'          
+          yield 'ecc'
           yield 'win32fe icl'
         if vendor == 'microsoft' or not vendor:
           yield 'win32fe cl'
           yield 'mpif77'
         if not self.vendor is None:
           yield 'mpxlf_r'
-          yield 'mpxlf'          
+          yield 'mpxlf'
           yield 'mpf90'
           yield 'mpf77'
         self.usedMPICompilers = 0
           yield 'win32fe ifl'
           yield 'ifort'
           yield 'ifc'
-          yield 'efc'          
+          yield 'efc'
         if vendor == 'portland' or not vendor:
           yield 'pgf90'
           yield 'pgf77'
       languages.append('FC')
     for language in languages:
       self.pushLanguage(language)
-      for testFlag in ['-PIC', '-fPIC', '-KPIC','-qpic']:
+      #different compilers are sensitive to the order of testing these flags. So separete out GCC test.
+      if config.setCompilers.Configure.isGNU(self.getCompiler()): testFlags = ['-fPIC']
+      else: testFlags = ['-PIC', '-fPIC', '-KPIC','-qpic']
+      for testFlag in testFlags:
         try:
           self.framework.logPrint('Trying '+language+' compiler flag '+testFlag)
           if not self.checkLinkerFlag(testFlag):
   def getArchiverFlags(self, archiver):
     prog = os.path.basename(archiver).split(' ')[0]
     flag = ''
-    if 'AR_FLAGS' in self.framework.argDB: 
+    if 'AR_FLAGS' in self.framework.argDB:
       flag = self.framework.argDB['AR_FLAGS']
     elif prog.endswith('ar'):
       flag = 'cr'
     if prog.endswith('ar') and not (self.isSolarisAR(prog) or self.isAIXAR(prog)):
       self.FAST_AR_FLAGS = 'Scq'
     else:
-      self.FAST_AR_FLAGS = flag      
+      self.FAST_AR_FLAGS = flag
     self.framework.addMakeMacro('FAST_AR_FLAGS',self.FAST_AR_FLAGS )
     return flag
-  
+
   def generateArchiverGuesses(self):
     defaultAr = None
     if 'with-ar' in self.framework.argDB:
     yield ('ar',self.getArchiverFlags('ar'),'ranlib -c')
     yield ('ar',self.getArchiverFlags('ar'),'ranlib')
     yield ('ar',self.getArchiverFlags('ar'),'true')
-    # IBM with 64 bit pointers 
+    # IBM with 64 bit pointers
     yield ('ar','-X64 '+self.getArchiverFlags('ar'),'ranlib -c')
     yield ('ar','-X64 '+self.getArchiverFlags('ar'),'ranlib')
     yield ('ar','-X64 '+self.getArchiverFlags('ar'),'true')
     yield ('win32fe tlib',self.getArchiverFlags('win32fe tlib'),'true')
     yield ('win32fe lib',self.getArchiverFlags('win32fe lib'),'true')
     return
-  
+
   def checkArchiver(self):
     '''Check that the archiver exists and can make a library usable by the compiler'''
     objName    = os.path.join(self.tmpDir, 'conf1.o')
       #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')
     if hasattr(self, 'CXX') and self.mainLanguage == 'Cxx':
       # C++ compiler default
       yield (self.CXX, ['-shared'], 'so')
       flag = '-L'
       self.pushLanguage(language)
       # test '-R' before '-rpath' as sun compilers [c,fortran] don't give proper errors with wrong options.
-      if not Configure.isDarwin():      
+      if not Configure.isDarwin():
         testFlags = ['-Wl,-rpath,', '-R','-rpath ' , '-Wl,-R,']
       else:
         testFlags = []
                 raise RuntimeError(msg)
     return
 
+  def requireMpiLdPath(self):
+    '''OpenMPI wrappers require LD_LIBRARY_PATH set'''
+    if 'with-mpi-dir' in self.argDB:
+      libdir = os.path.join(self.argDB['with-mpi-dir'], 'lib')
+      if os.path.exists(os.path.join(libdir,'libopen-rte.so')):
+        Configure.addLdPath(libdir)
+        self.logPrint('Adding to LD_LIBRARY_PATH '+libdir)
+    return
+
+  def printEnvVariables(self):
+    buf = '**** printenv ****'
+    for key,val in os.environ.iteritems():
+      buf += '\n'+str(key)+'='+str(val)
+    self.logPrint(buf)
+    return
+
   def resetEnvCompilers(self):
     ignoreEnv = ['CC','CFLAGS','CXX','CXXFLAGS','FC','FCFLAGS','F77','FFLAGS',
                  'F90','F90FLAGS','CPP','CPPFLAGS','CXXCPP','CXXCPPFLAGS',
                  'LDFLAGS','LIBS','MPI_DIR','RM']
     for envVal in ignoreEnv:
       if envVal in os.environ:
-        self.logPrintBox('***** WARNING: '+envVal+' found in environment variables - ignoring ******')
+        self.logPrintBox('***** WARNING: '+envVal+' (set to '+os.environ[envVal]+') found in environment variables - ignoring \n use ./configure '+envVal+'=$'+envVal+' if you really want to use that value ******')
         del os.environ[envVal]
     return
 
   def configure(self):
+    self.executeTest(self.printEnvVariables)
     self.executeTest(self.resetEnvCompilers)
     self.executeTest(self.checkMPICompilerOverride)
+    self.executeTest(self.requireMpiLdPath)
     self.executeTest(self.checkVendor)
     self.executeTest(self.checkInitialFlags)
     self.executeTest(self.checkCCompiler)

config/BuildSystem/config/types.py

     self.headers   = framework.require('config.headers', self)
     return
 
-  def check(self, typeName, defaultType = None):
+  def check(self, typeName, defaultType = None, includes = []):
     '''Checks that "typeName" exists, and if not defines it to "defaultType" if given'''
     self.framework.log.write('Checking for type: '+typeName+'\n')
     include = '''
 #if STDC_HEADERS
 #include <stdlib.h>
 #include <stddef.h>
+%s
 #endif
-    '''
+    ''' % ('\n'.join(['#include<%s>' % inc for inc in includes]))
     found = self.checkCompile(include,typeName+' a;')
     if not found and defaultType:
       self.addTypedef(defaultType, typeName)
       self.framework.log.write(typeName+' found\n')
     return found
 
+  def check_siginfo_t(self):
+    '''Checks if siginfo_t exists in signal.h. This check is for windows, and C89 check.'''
+    if self.check('siginfo_t', includes = ['signal.h']):
+      self.addDefine('HAVE_SIGINFO_T',1)
+    return
+
   def check__int64(self):
     '''Checks if __int64 exists. This is primarily for windows.'''
     if self.check('__int64'):
 
   def checkUID(self):
     '''Checks for uid_t and gid_t, and defines them if necessary'''
-    if not self.outputPreprocess('sys/types.h').find('uid_t'):
+    if self.outputPreprocess('#include <sys/types.h>').find('uid_t') < 0:
       self.addDefine('uid_t', 'int')
       self.addDefine('gid_t', 'int')
     return
       self.addDefine('USE_VISIBILITY',1)
 
   def configure(self):
+    self.executeTest(self.check_siginfo_t)
     self.executeTest(self.check__int64)
     self.executeTest(self.checkSizeTypes)
     self.executeTest(self.checkFileTypes)

config/BuildSystem/emacsclient.py

 
 def edit(astring):
   filename = os.path.join('/tmp', pwd.getpwuid(os.getuid())[0]+'-emacsclient')
-  
+
   f = open(filename,'w')
   f.write(astring)
   f.close()

config/BuildSystem/getsplicers.py

 
       line = fd.readline()
     fd.close()
-  
+
 def getSplicers(directories):
   splicedimpls = {'.c' : {}, '.h' : {}, '.cc' : {}, '.hh' : {}, '.py' : {}, '.m' : {}}
 
   f    = open('splicerblocks', 'w')
   cPickle.dump(splicedimpls,f)
   f.close()
-    
+
 if __name__ ==  '__main__':
   if len(sys.argv) > 2: sys.exit('Usage: getsplicers.py <directory>')
   getSplicers(sys.argv[1:-1])

config/BuildSystem/install.old/bootstrap.py

       os.putenv('BK_HOST',hostname+'org')
     elif hostname.find('.') == -1:
       os.putenv('BK_HOST',hostname+'.org')
-                
+
     # If self.bkPath is set, check it
     if self.bkPath:
       if os.path.isdir(self.bkPath):
 
   def tab(self,size):
     self.tabsize = size
-    
+
   def write(self,mess):
     import re
     nmess = mess.split('\n')
         self.stdscr.addstr(self.y+i,self.x,amess[0:self.w])
       curses.textpad.rectangle(self.stdscr,self.y-1,self.x-1,self.y+self.h+1,self.x+self.w+1)
       self.stdscr.refresh()
-       
+
 #-----------------------------------------------------------------------------------------------------------------------
-    
+
 class CursesInstall (BootstrapInstall):
   def __init__(self):
     self.bkPath      = None
     ch = choices.index(ch)
     return ch
   SelectFromSubList = staticmethod(SelectFromSubList)
-    
+
   def SelectFromList(stdscr,list,my = 1,text = 'Select desired value'):
     charactors = []
     for i in range(0,10):
       self.OpenURL = self.OpenURL_Netscape
     elif not self.browser.find("galeon") == -1:
       self.OpenURL = self.OpenURL_Galeon
-                  
+
     if self.OpenURL('http://www.mcs.anl.gov/petsc'):
       stdscr.clear()
       CursesInstall.CenterAddStr(stdscr,1,'Unable to open browser '+self.browser)
         else:
           if BootstrapInstall.installBitkeeper(self): return 1
           CursesInstall.CenterAddStr(stdscr, 8, 'Directory does not contain the bk command', curses.A_BLINK)
-          self.bkPath = CursesInstall.CenterGetStr(stdscr, 5, text = self.bkPath)    
+          self.bkPath = CursesInstall.CenterGetStr(stdscr, 5, text = self.bkPath)
     return 1
 
   def installBitkeeper(self):
     if not BootstrapInstall.installBitkeeper(self):
       return curses.wrapper(self.cursesIndicateBKMissing)
     return 1
-        
+
   def cursesInstallDirectory(self, stdscr):
     '''The installation directory defaults to the current directory, unless we are in HOME, in which case we create "petsc-3.0"
        - Return True if creation succeeds
     CursesInstall.CenterAddStr(stdscr, 3, 'Removing any previous ASE demons')
     stdscr.refresh()
     BootstrapInstall.cleanup(self)
-    
+
   def cleanup(self):
     '''Display nice message while running cleanup'''
     return curses.wrapper(installer.cursesCleanup)
-                          
+
   def cursesAlreadyInstalled(self, stdscr):
     stdscr.clear()
     CursesInstall.CenterAddStr(stdscr, 1, 'Looks like BuildSystem is already installed at')
     CursesInstall.CenterAddStr(stdscr, 2, self.installPath+'/sidl/BuildSystem')
     CursesInstall.CenterAddStr(stdscr, 4, 'Use '+self.installPath+'/sidl/BuildSystem/install/gui.py')
     CursesInstall.CenterAddStr(stdscr, 5, 'to install additional projects after bootstrap finishes')
-    CursesInstall.CenterAddStr(stdscr, 7, 'OR')    
+    CursesInstall.CenterAddStr(stdscr, 7, 'OR')
     CursesInstall.CenterAddStr(stdscr, 9, 'Remove all directories in '+self.installPath)
     CursesInstall.CenterAddStr(stdscr, 10, 'and rerun this installer for a complete reinstall')
     CursesInstall.CenterAddStr(stdscr, 11, '(hit return to continue)')
     if not os.path.exists(os.path.join(os.getenv('HOME'),'.bk','accepted')):
       os.putenv('BK_LICENSE','ACCEPTED')
     return BootstrapInstall.installBuildSystem(self)
-      
+
   def installBuildSystem(self):
     '''Check for BuildSystem and install it if it is not present.
        - Return True if installation succeeds'''
       return curses.wrapper(self.cursesAlreadyInstalled)