/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 427 by johnpye, Tue Apr 4 04:13:34 2006 UTC revision 428 by johnpye, Tue Apr 4 06:41:25 2006 UTC
# Line 127  opts.Add(PackageOption( Line 127  opts.Add(PackageOption(
127      ,None      ,None
128  ))  ))
129    
130    # What is the name of the Tcl lib?
131    opts.Add(
132        'TCL_LIB'
133        ,"Name of Tcl lib (eg 'tcl' or 'tcl83')"
134        ,'tcl'
135    )
136    
137  # Where are the Tk includes?  # Where are the Tk includes?
138  opts.Add(PackageOption(  opts.Add(PackageOption(
139      'TK_CPPPATH'      'TK_CPPPATH'
# Line 141  opts.Add(PackageOption( Line 148  opts.Add(PackageOption(
148      ,None      ,None
149  ))  ))
150    
151    # What is the name of the Tk lib?
152    opts.Add(
153        'TK_LIB'
154        ,"Name of Tk lib (eg 'tk' or 'tk83')"
155        ,'tk'
156    )
157    
158  # TODO: OTHER OPTIONS?  # TODO: OTHER OPTIONS?
159  # TODO: flags for optimisation  # TODO: flags for optimisation
160  # TODO: turning on/off bintoken functionality  # TODO: turning on/off bintoken functionality
# Line 237  class KeepContext: Line 251  class KeepContext:
251          libpath_add = []          libpath_add = []
252          if context.env.has_key(varprefix+'_LIBPATH'):          if context.env.has_key(varprefix+'_LIBPATH'):
253              libpath_add = [env[varprefix+'_LIBPATH']]              libpath_add = [env[varprefix+'_LIBPATH']]
254                #print "Adding '"+str(libpath_add)+"' to lib path"
255    
256          cpppath_add = []          cpppath_add = []
257          if context.env.has_key(varprefix+'_CPPPATH'):          if context.env.has_key(varprefix+'_CPPPATH'):
258              cpppath_add = [env[varprefix+'_CPPPATH']]              cpppath_add = [env[varprefix+'_CPPPATH']]
259                    #print "Adding '"+str(cpppath_add)+"' to cpp path"
260    
261            libs_add = []
262            if context.env.has_key(varprefix+'_LIB'):
263                libs_add = [env[varprefix+'_LIB']]
264                #print "Adding '"+str(libs_add)+"' to libs"
265    
266          context.env.Append(          context.env.Append(
267              LIBPATH = libpath_add              LIBPATH = libpath_add
268              , CPPPATH = cpppath_add              , CPPPATH = cpppath_add
269                , LIBS = libs_add
270          )          )
271    
272      def restore(self,context):      def restore(self,context):
# Line 264  def CheckExtLib(context,libname,text,ext Line 286  def CheckExtLib(context,libname,text,ext
286            
287      keep = KeepContext(context,varprefix)      keep = KeepContext(context,varprefix)
288    
289      context.env.Append(LIBS=[libname])  #   print "TryLink with CPPPATH="+str(context.env['CPPPATH'])
290    #   print "TryLink with LIBS="+str(context.env['LIBS'])
291    #   print "TryLink with LIBPATH="+str(context.env['LIBPATH'])
292    
293        if not context.env.has_key(varprefix+'_LIB'):
294            context.env.AppendUnique(LIBS=libname)
295    
296      is_ok = context.TryLink(text,ext)      is_ok = context.TryLink(text,ext)
297        
298    #   print "Link success? ",(is_ok != 0)
299    
300      keep.restore(context)      keep.restore(context)
301    
302    #   print "Restored CPPPATH="+str(context.env['CPPPATH'])
303    #   print "Restored LIBS="+libname
304    #   print "Restored LIBPATH="+str(context.env['LIBPATH'])
305    
306      context.Result(is_ok)      context.Result(is_ok)
307      return is_ok      return is_ok
308    
# Line 323  def CheckTclVersion(context): Line 356  def CheckTclVersion(context):
356      if not is_ok:      if not is_ok:
357          context.Result("failed to run check")          context.Result("failed to run check")
358          return 0          return 0
     context.Result(output)  
359    
360      major,minor,patch = tuple(int(i) for i in output.split("."))      major,minor,patch = tuple(int(i) for i in output.split("."))
361      if major != 8 or minor > 3:      if major != 8 or minor > 3:
362            context.Result(output+" (bad version)")
363          # bad version          # bad version
364          return 0          return 0
365                    
366      # good version      # good version
367        context.Result(output+" (good)")
368      return 1      return 1
369    
370  #----------------  #----------------
# Line 345  int main(void){ Line 379  int main(void){
379  }  }
380  """  """
381  def CheckTk(context):  def CheckTk(context):
382      return CheckExtLib(context,'tk',tk_check_text)      return CheckExtLib(context,'tk',tcl_check_text)
383    
384    
385  def CheckTkVersion(context):  def CheckTkVersion(context):
386      keep = KeepContext(context,'TK')      keep = KeepContext(context,'TK')
# Line 397  if not conf.CheckFunc('isnan'): Line 432  if not conf.CheckFunc('isnan'):
432    
433  # Tcl/Tk  # Tcl/Tk
434    
435  if conf.CheckTcl() and conf.CheckTk():  if conf.CheckTcl():
436      if with_tcltk_gui and not conf.CheckTclVersion():      if with_tcltk_gui and conf.CheckTclVersion():
437            if conf.CheckTk():
438                if with_tcltk_gui and not conf.CheckTkVersion():
439                    without_tcltk_reason = "Require Tk version <= 8.3. See 'scons -h'"
440                    with_tcltk_gui = False
441            else:
442                without_tcltk_reason = "Tk not found."
443                with_tcltk_gui = False
444        else:
445          without_tcltk_reason = "Require Tcl <= 8.3 Tcl."          without_tcltk_reason = "Require Tcl <= 8.3 Tcl."
446          with_tcltk_gui = False          with_tcltk_gui = False
447    
     if with_tcltk_gui and not conf.CheckTkVersion():  
         without_tcltk_reason += "Require Tk version <= 8.3. See 'scons -h'"  
         with_tcltk_gui = False  
448  else:  else:
449      without_tcltk_reason = "Tcl/Tk not found."      without_tcltk_reason = "Tcl not found."
450      with_tcltk_gui = False      with_tcltk_gui = False
451    
452  # Python... obviously we're already running python, so we just need to  # Python... obviously we're already running python, so we just need to
# Line 457  if need_fortran: Line 497  if need_fortran:
497              conf.env.Replace(F77=detect_fortran)              conf.env.Replace(F77=detect_fortran)
498              conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')              conf.env.Replace(F77COM='$F77 $F77FLAGS -c -o $TARGET $SOURCE')
499              conf.env.Replace(F77FLAGS='')              conf.env.Replace(F77FLAGS='')
500              print "F77:",conf.env['F77']              #print "F77:",conf.env['F77']
501              print "F77COM:",conf.env['F77COM']              #print "F77COM:",conf.env['F77COM']
502              print "F77FLAGS:",conf.env['F77FLAGS']              #print "F77FLAGS:",conf.env['F77FLAGS']
503              fortran_builder = Builder(              fortran_builder = Builder(
504                  action='$F77COM'                  action='$F77COM'
505                  , suffix='.o'                  , suffix='.o'

Legend:
Removed from v.427  
changed lines
  Added in v.428

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