/[ascend]/trunk/SConstruct
ViewVC logotype

Diff of /trunk/SConstruct

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

revision 684 by johnpye, Wed Jun 21 14:50:17 2006 UTC revision 705 by johnpye, Tue Jun 27 02:37:49 2006 UTC
# Line 527  class KeepContext: Line 527  class KeepContext:
527      def __init__(self,context,varprefix,static=False):      def __init__(self,context,varprefix,static=False):
528          self.keep = {}          self.keep = {}
529          for k in ['LIBS','LIBPATH','CPPPATH','LINKFLAGS']:          for k in ['LIBS','LIBPATH','CPPPATH','LINKFLAGS']:
530              if context.env.has_key(k):              #print "Keeping env %s = %s" % (k,context.env.get(k))
531                  self.keep[k] = context.env[k]              self.keep[k]=context.env.get(k)
             else:  
                 self.keep[k] = None  
532                    
533          if context.env.has_key(varprefix+'_CPPPATH'):          if context.env.has_key(varprefix+'_CPPPATH'):
534              context.env.Append(CPPPATH=[env[varprefix+'_CPPPATH']])              context.env.Append(CPPPATH=[env[varprefix+'_CPPPATH']])
# Line 549  class KeepContext: Line 547  class KeepContext:
547    
548              if context.env.has_key(varprefix+'_LIB'):              if context.env.has_key(varprefix+'_LIB'):
549                  context.env.Append(LIBS=[env[varprefix+'_LIB']])                  context.env.Append(LIBS=[env[varprefix+'_LIB']])
550                  #print "Adding '"+str(libs_add)+"' to libs"                  #print "Adding '"+str(env[varprefix+'_LIB'])+"' to libs"    
551    
552      def restore(self,context):      def restore(self,context):
553          #print "RESTORING CONTEXT"          #print "RESTORING CONTEXT"
# Line 561  class KeepContext: Line 559  class KeepContext:
559                      #print "Clearing "+str(k)                      #print "Clearing "+str(k)
560                      del context.env[k];                      del context.env[k];
561              else:              else:
562                  #print "Restoring "+str(k)+" to '"+self.keep[k]+"'"                              #print "Restoring %s to '%s'" %(k,self.keep.get(k))
563                  context.env[k]=self.keep[k];                  context.env[k]=self.keep[k];
564    
565  def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False):  def CheckExtLib(context,libname,text,ext='.c',varprefix=None,static=False):
# Line 578  def CheckExtLib(context,libname,text,ext Line 576  def CheckExtLib(context,libname,text,ext
576      if varprefix==None:      if varprefix==None:
577          varprefix = libname.upper()          varprefix = libname.upper()
578            
579        #print "LIBS is currently:",context.env.get('LIBS')
580      keep = KeepContext(context,varprefix,static)      keep = KeepContext(context,varprefix,static)
581    
582      if not context.env.has_key(varprefix+'_LIB'):      if not context.env.has_key(varprefix+'_LIB'):
583          # if varprefix_LIB were in env, KeepContext would          # if varprefix_LIB were in env, KeepContext would
584          # have appended it already          # have appended it already
585          context.env.Append(LIBS=libname)          context.env.Append(LIBS=[libname])
586    
587      is_ok = context.TryLink(text,ext)      is_ok = context.TryLink(text,ext)
588            
# Line 592  def CheckExtLib(context,libname,text,ext Line 591  def CheckExtLib(context,libname,text,ext
591      keep.restore(context)      keep.restore(context)
592    
593  #   print "Restored CPPPATH="+str(context.env['CPPPATH'])  #   print "Restored CPPPATH="+str(context.env['CPPPATH'])
594  #   print "Restored LIBS="+libname  #   print "Restored LIBS="+str(context.env['LIBS'])
595  #   print "Restored LIBPATH="+str(context.env['LIBPATH'])  #   print "Restored LIBPATH="+str(context.env['LIBPATH'])
596    
597      context.Result(is_ok)      context.Result(is_ok)
# Line 692  def CheckCUnit(context): Line 691  def CheckCUnit(context):
691  # MATH test  # MATH test
692    
693  math_test_text = """  math_test_text = """
694    #ifndef _ALL_SOURCE
695    # define _ALL_SOURCE
696    #endif
697    #ifndef _XOPEN_SOURCE
698    # define _XOPEN_SOURCE
699    #endif
700    #ifndef _XOPEN_SOURCE_EXTENDED
701    # define _XOPEN_SOURCE_EXTENDED 1
702    #endif
703  #include <math.h>  #include <math.h>
704  int main(void){  int main(void){
705      double x;      double x = 1.0; double y = 1.0; int i = 1;
706      x = sinh(0.1);      acosh(x); asinh(x); atanh(x); cbrt(x); expm1(x); erf(x); erfc(x); isnan(x);
707        j0(x); j1(x); jn(i,x); ilogb(x); logb(x); log1p(x); rint(x);
708        y0(x); y1(x); yn(i,x);
709    #ifdef _THREAD_SAFE
710        gamma_r(x,&i);
711        lgamma_r(x,&i);
712    #else
713    gamma(x);
714        lgamma(x);
715    #endif
716        hypot(x,y); nextafter(x,y); remainder(x,y); scalb(x,y);
717      return 0;      return 0;
718  }  }
719  """  """
720    
721  def CheckMath(context):  def CheckMath(context):
722      return CheckExtLib(context,'m',math_test_text)      context.Message('Checking for IEE math library... ')
723        libsave=context.env.get('LIBS');
724        context.env.AppendUnique(LIBS=['m'])
725        is_ok=context.TryLink(math_test_text,".c")
726        context.Result(is_ok)
727        if not is_ok:
728            context.env['LIBS']=libsave
729        return is_ok
730    
731  #----------------  #----------------
732  # IDA test  # IDA test
733    
# Line 961  if with_cunit: Line 987  if with_cunit:
987      if not conf.CheckCUnit():      if not conf.CheckCUnit():
988          without_cunit_reason = 'CUnit not found'          without_cunit_reason = 'CUnit not found'
989          with_cunit = False          with_cunit = False
990            #print "CUNIT NOT FOUND, LIBS=",conf.env.get('LIBS')
991    
992  # IDA  # IDA
993    
# Line 1386  env.Default(default_targets) Line 1413  env.Default(default_targets)
1413    
1414  print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])  print "Building targets:"," ".join([str(i) for i in BUILD_TARGETS])
1415    
1416    # vim: set syntax=python:
1417    

Legend:
Removed from v.684  
changed lines
  Added in v.705

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