wscript
changeset 11661 68c0e7f87bdf
parent 11650 7f374ac3b2f8
child 11675 d12d2c296132
equal deleted inserted replaced
11660:47325a00bda8 11661:68c0e7f87bdf
   113                 i = 0
   113                 i = 0
   114         i = i+1
   114         i = i+1
   115 
   115 
   116     if i != 1:
   116     if i != 1:
   117         print()
   117         print()
       
   118 
       
   119 # return types of some APIs differ in Python 2/3 (type string vs class bytes)
       
   120 # This method will decode('utf-8') a byte object in Python 3, 
       
   121 # and do nothing in Python 2
       
   122 def maybe_decode(input):
       
   123     if sys.version_info < (3,):
       
   124         return input
       
   125     else:
       
   126         try:
       
   127             return input.decode('utf-8')
       
   128         except:
       
   129             sys.exc_clear()
       
   130             return input
   118 
   131 
   119 def options(opt):
   132 def options(opt):
   120     # options provided by the modules
   133     # options provided by the modules
   121     opt.load('compiler_c')
   134     opt.load('compiler_c')
   122     opt.load('compiler_cxx')
   135     opt.load('compiler_cxx')
   349             env.append_value("LINKFLAGS", "-Wl,--enable-auto-import")
   362             env.append_value("LINKFLAGS", "-Wl,--enable-auto-import")
   350 
   363 
   351         cxx = env['CXX']
   364         cxx = env['CXX']
   352         cxx_check_libstdcxx = cxx + ['-print-file-name=libstdc++.so']
   365         cxx_check_libstdcxx = cxx + ['-print-file-name=libstdc++.so']
   353         p = subprocess.Popen(cxx_check_libstdcxx, stdout=subprocess.PIPE)
   366         p = subprocess.Popen(cxx_check_libstdcxx, stdout=subprocess.PIPE)
   354         libstdcxx_location = os.path.dirname(p.stdout.read().strip())
   367         libstdcxx_output = maybe_decode(p.stdout.read().strip())
       
   368         libstdcxx_location = os.path.dirname(libstdcxx_output)
   355         p.wait()
   369         p.wait()
   356         if libstdcxx_location:
   370         if libstdcxx_location:
   357             conf.env.append_value('NS3_MODULE_PATH', libstdcxx_location)
   371             conf.env.append_value('NS3_MODULE_PATH', libstdcxx_location)
   358 
   372 
   359         if Options.platform in ['linux']:
   373         if Options.platform in ['linux']: