enable darwin static builds
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Tue May 05 12:00:29 2009 +0200 (9 months ago)
changeset 44388d9f6e489f94
parent 4437 3e4e052d5058
child 4439 e2fc73a10bad
enable darwin static builds
wscript
     1.1 --- a/wscript	Mon May 04 20:22:08 2009 +0200
     1.2 +++ b/wscript	Tue May 05 12:00:29 2009 +0200
     1.3 @@ -295,8 +295,7 @@
     1.4          if env['PLATFORM'].startswith('linux') and \
     1.5                  env['CXX_NAME'] == 'gcc':
     1.6              if os.uname()[4] == 'i386':
     1.7 -                conf.report_optional_feature("static", "Static build", True,
     1.8 -                                             "Enabled by user request")
     1.9 +                conf.report_optional_feature("static", "Static build", True, '')
    1.10                  env['ENABLE_STATIC_NS3'] = True
    1.11              elif os.uname()[4] == 'x86_64':
    1.12                  if env['ENABLE_PYTHON_BINDINGS'] and \
    1.13 @@ -307,11 +306,12 @@
    1.14                                                       "option. Try --disable-python or upgrade your " \
    1.15                                                       "compiler.")
    1.16                  else:
    1.17 -                    conf.report_optional_feature("static", "Static build", True,
    1.18 -                                                 "Enabled by user request. Try --disable-python " \
    1.19 -                                                     "to get higher performance.")
    1.20 -                    env['ENABLE_STATIC_NS3'] = True
    1.21 -                    
    1.22 +                    conf.report_optional_feature("static", "Static build", True, '')
    1.23 +                    env['ENABLE_STATIC_NS3'] = True                    
    1.24 +        elif env['PLATFORM'].startswith('darwin') and \
    1.25 +                env['CXX_NAME'] == 'gcc':
    1.26 +                conf.report_optional_feature("static", "Static build", True, '')
    1.27 +                env['ENABLE_STATIC_NS3'] = True
    1.28          else:
    1.29              conf.report_optional_feature("static", "Static build", False,
    1.30                                           "Unsupported platform")
    1.31 @@ -387,9 +387,13 @@
    1.32      program.uselib_local = 'ns3'
    1.33      program.ns3_module_dependencies = ['ns3-'+dep for dep in dependencies]
    1.34      if program.env['ENABLE_STATIC_NS3']:
    1.35 -        program.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic')
    1.36 -        program.env.append_value('LINKFLAGS', '-lns3')
    1.37 -        program.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive')
    1.38 +        if sys.platform == 'darwin':
    1.39 +            program.env.append_value('LINKFLAGS', '-Wl,-all_load')
    1.40 +            program.env.append_value('LINKFLAGS', '-lns3')
    1.41 +        else:
    1.42 +            program.env.append_value('LINKFLAGS', '-Wl,--whole-archive,-Bstatic')
    1.43 +            program.env.append_value('LINKFLAGS', '-lns3')
    1.44 +            program.env.append_value('LINKFLAGS', '-Wl,-Bdynamic,--no-whole-archive')
    1.45      return program
    1.46  
    1.47  def add_scratch_programs(bld):