Jed Brown avatar Jed Brown committed 07020d0 Merge

Merge branch 'buildsystem-outgoing' of bitbucket:petsc/petsc

* 'buildsystem-outgoing' of /home/jed/petsc:
checkLink: use C++ linker for checkLink if package sets self.cxx
git change: update configure to support 'git' detection and git 'clone' detection

Comments (0)

Files changed (4)

   def filterLinkOutput(self, output):
     return self.framework.filterLinkOutput(output)
 
-  def outputLink(self, includes, body, cleanup = 1, codeBegin = None, codeEnd = None, shared = 0):
+  def outputLink(self, includes, body, cleanup = 1, codeBegin = None, codeEnd = None, shared = 0, linkLanguage=None):
     import sys
 
     (out, err, ret) = self.outputCompile(includes, body, cleanup = 0, codeBegin = codeBegin, codeEnd = codeEnd)
       return (out, ret)
 
     cleanup = cleanup and self.framework.doCleanup
+
+    if linkLanguage is not None and linkLanguage != self.language[-1]:
+      self.pushLanguage(linkLanguage)
     if shared == 'dynamic':
       cmd = self.getDynamicLinkerCmd()
     elif shared:
       cmd = self.getSharedLinkerCmd()
     else:
       cmd = self.getLinkerCmd()
+    if linkLanguage is not None and linkLanguage != self.language[-1]:
+      self.popLanguage()
+
     linkerObj = self.linkerObj
     def report(command, status, output, error):
       if error or status:
       if os.path.isfile(pdbfile): os.remove(pdbfile)
     return (out+err, ret)
 
-  def checkLink(self, includes = '', body = '', cleanup = 1, codeBegin = None, codeEnd = None, shared = 0):
-    (output, returnCode) = self.outputLink(includes, body, cleanup, codeBegin, codeEnd, shared)
+  def checkLink(self, includes = '', body = '', cleanup = 1, codeBegin = None, codeEnd = None, shared = 0, linkLanguage=None):
+    (output, returnCode) = self.outputLink(includes, body, cleanup, codeBegin, codeEnd, shared, linkLanguage)
     output = self.filterLinkOutput(output)
     return not (returnCode or len(output))
 

config/libraries.py

     # no match - assuming the given name is already in short notation
     return lib
 
-  def check(self, libName, funcs, libDir = None, otherLibs = [], prototype = '', call = '', fortranMangle = 0, cxxMangle = 0):
+  def check(self, libName, funcs, libDir = None, otherLibs = [], prototype = '', call = '', fortranMangle = 0, cxxMangle = 0, cxxLink = 0):
     '''Checks that the library "libName" contains "funcs", and if it does defines HAVE_LIB"libName"
        - libDir may be a list of directories
        - libName may be a list of library names'''
         self.setCompilers.LIBS = ' '+self.toString(otherLibs) +' '+ self.setCompilers.LIBS
       elif libName:
         self.setCompilers.LIBS = ' '+self.toString(libName) +' '+ self.setCompilers.LIBS
+      linklang = 'Cxx' if cxxLink else self.language[-1]
       self.pushLanguage(self.language[-1])
       found = 0
-      if self.checkLink(includes, body):
+      if self.checkLink(includes, body, linkLanguage=linklang):
         found = 1
         # add to list of found libraries
         if libName:

config/package.py

         if directory: self.framework.logPrint('Contents: '+str(os.listdir(directory)))
       else:
         self.framework.logPrint('Not checking for library in '+location+': '+str(lib)+' because no functions given to check for')
-      if self.executeTest(self.libraries.check,[lib, self.functions],{'otherLibs' : libs, 'fortranMangle' : self.functionsFortran, 'cxxMangle' : self.functionsCxx[0], 'prototype' : self.functionsCxx[1], 'call' : self.functionsCxx[2]}):
+      if self.executeTest(self.libraries.check,[lib, self.functions],{'otherLibs' : libs, 'fortranMangle' : self.functionsFortran, 'cxxMangle' : self.functionsCxx[0], 'prototype' : self.functionsCxx[1], 'call' : self.functionsCxx[2], 'cxxLink': self.cxx}):
         self.lib = lib
         self.framework.logPrint('Checking for headers '+location+': '+str(incl))
         if (not self.includes) or self.checkInclude(incl, self.includes, incls, timeout = 1800.0):
         if directory: self.framework.logPrint('Contents: '+str(os.listdir(directory)))
       else:
         self.framework.logPrint('Not checking for library in '+location+': '+str(lib)+' because no functions given to check for')
-      if self.executeTest(self.libraries.check,[lib, self.functions],{'otherLibs' : libs, 'fortranMangle' : self.functionsFortran, 'cxxMangle' : self.functionsCxx[0], 'prototype' : self.functionsCxx[1], 'call' : self.functionsCxx[2]}):
+      if self.executeTest(self.libraries.check,[lib, self.functions],{'otherLibs' : libs, 'fortranMangle' : self.functionsFortran, 'cxxMangle' : self.functionsCxx[0], 'prototype' : self.functionsCxx[1], 'call' : self.functionsCxx[2], 'cxxLink': self.cxx}):
         self.lib = lib
         self.framework.logPrint('Checking for headers '+location+': '+str(incl))
         if (not self.includes) or self.checkInclude(incl, self.includes, incls, timeout = 1800.0):

config/sourceControl.py

   def setupHelp(self, help):
     import nargs
 
+    help.addArgument('SourceControl', '-with-git=<prog>', nargs.Arg(None, 'git','Specify the Git executable'))
     help.addArgument('SourceControl', '-with-hg=<prog>',  nargs.Arg(None, 'hg', 'Specify the Mercurial executable'))
     help.addArgument('SourceControl', '-with-cvs=<prog>', nargs.Arg(None, 'cvs', 'Specify the CVS executable'))
     help.addArgument('SourceControl', '-with-svn=<prog>', nargs.Arg(None, 'svn', 'Specify the Subversion executable'))
     return
 
+  def configureGit(self):
+    '''Find the Git executable'''
+    if 'with-git' in self.framework.argDB and self.framework.argDB['with-git'] == '0':
+      return
+    self.getExecutable(self.framework.argDB['with-git'], resultName = 'git')
+    if hasattr(self,'git'):
+      try:
+        self.gitversion = self.executeShellCommand(self.git + ' --version')
+      except: pass
+    return
+
   def configureMercurial(self):
     '''Find the Mercurial executable'''
     if 'with-hg' in self.framework.argDB and self.framework.argDB['with-hg'] == '0':
     return
 
   def configure(self):
+    self.executeTest(self.configureGit)
     self.executeTest(self.configureMercurial)
     self.executeTest(self.configureCVS)
     self.executeTest(self.configureSubversion)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.