/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 955 by johnpye, Sat Dec 9 03:45:47 2006 UTC revision 957 by johnpye, Sun Dec 10 02:21:06 2006 UTC
# Line 180  opts.Add(PackageOption( Line 180  opts.Add(PackageOption(
180      ,default_prefix      ,default_prefix
181  ))  ))
182    
183    #------ install location for python extensions ------
184    
185    # (removed for the moment)
186    
187  #------ cunit --------  #------ cunit --------
188  # Where was CUNIT installed?  # Where was CUNIT installed?
189  opts.Add(PackageOption(  opts.Add(PackageOption(
# Line 939  def CheckMath(context): Line 943  def CheckMath(context):
943      return is_ok      return is_ok
944    
945  #----------------  #----------------
946    # libpython test
947    
948    libpython_test_text = """
949    #include <Python.h>
950    int main(void){
951        PyObject *p;
952        p = Py_None;
953        return 0;
954    }
955    """
956    
957    def CheckPythonLib(context):
958        context.Message('Checking for libpython... ')
959    
960        if platform.system()=="Windows":
961            python_lib='python%d%d'
962        else:
963            python_lib='python%d.%d'
964        python_lib = python_lib % (sys.version_info[0],sys.version_info[1])
965    
966        python_cpppath = [distutils.sysconfig.get_python_inc()]
967        cfig = distutils.sysconfig.get_config_vars()    
968        
969        lastLIBS = context.env.get('LIBS')
970        lastLIBPATH = context.env.get('LIBPATH')
971        lastCPPPATH = context.env.get('CPPPATH')
972    
973        python_libpath = []
974    
975        if cfig['LDLIBRARY']==cfig['LIBRARY']:
976            print "static library only?"
977            python_libpath += [cfig['LIBPL']]
978    
979        context.env.AppendUnique(LIBS=[python_lib])
980        context.env.AppendUnique(LIBPATH=python_libpath)
981        context.env.AppendUnique(CPPPATH=python_cpppath)
982        result = context.TryLink(libpython_test_text,".c");
983    
984        context.Result(result)
985    
986        if(result):
987            context.env.Append(PYTHON_LIBPATH=python_libpath)
988            context.env.Append(PYTHON_LIB=[python_lib])
989            context.env.Append(PYTHON_CPPPATH=python_cpppath)
990    
991        context.env['LIBS'] = lastLIBS
992        context.env['LIBPATH'] = lastLIBPATH
993        context.env['CPPPATH'] = lastCPPPATH
994    
995        return result
996    
997    #----------------
998  # IDA test  # IDA test
999    
1000  sundials_version_major_required = 2  sundials_version_major_required = 2
# Line 1189  conf = Configure(env Line 1245  conf = Configure(env
1245      , custom_tests = {      , custom_tests = {
1246          'CheckMath' : CheckMath          'CheckMath' : CheckMath
1247          , 'CheckSwigVersion' : CheckSwigVersion          , 'CheckSwigVersion' : CheckSwigVersion
1248            , 'CheckPythonLib' : CheckPythonLib
1249          , 'CheckCUnit' : CheckCUnit          , 'CheckCUnit' : CheckCUnit
1250          , 'CheckDMalloc' : CheckDMalloc          , 'CheckDMalloc' : CheckDMalloc
1251          , 'CheckTcl' : CheckTcl          , 'CheckTcl' : CheckTcl
# Line 1291  if env['STATIC_TCLTK']: Line 1348  if env['STATIC_TCLTK']:
1348  # Python... obviously we're already running python, so we just need to  # Python... obviously we're already running python, so we just need to
1349  # check that we can link to the python library OK:  # check that we can link to the python library OK:
1350    
1351  if platform.system()=="Windows":  if not conf.CheckPythonLib():
1352      python_lib='python%d%d'      without_python_reason = 'libpython2.x not found or not linkable'
1353  else:      with_python = False
     python_lib='python%d.%d'  
 python_lib = python_lib % (sys.version_info[0],sys.version_info[1])  
1354    
1355  # SWIG version  # SWIG version
1356    
1357  if not conf.CheckSwigVersion():  if with_python and not conf.CheckSwigVersion():
1358      without_python_reason = 'SWIG >= 1.3.24 is required'      without_python_reason = 'SWIG >= 1.3.24 is required'
1359      with_python = False      with_python = False
1360    
# Line 1417  conf.env.Append(CPPDEFINES=env['PACKAGE_ Line 1472  conf.env.Append(CPPDEFINES=env['PACKAGE_
1472    
1473  conf.Finish()  conf.Finish()
1474    
 env.Append(PYTHON_LIBPATH=[distutils.sysconfig.PREFIX+"/libs"])  
 env.Append(PYTHON_LIB=[python_lib])  
 env.Append(PYTHON_CPPPATH=[distutils.sysconfig.get_python_inc()])  
   
1475  #---------------------------------------  #---------------------------------------
1476  # SUBSTITUTION DICTIONARY for .in files  # SUBSTITUTION DICTIONARY for .in files
1477    

Legend:
Removed from v.955  
changed lines
  Added in v.957

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22