build: In some case the flags for the sun studio linker are wrong
authorMatthieu Patou <mat@matws.net>
Sun, 31 Oct 2010 15:50:15 +0000 (18:50 +0300)
committerMatthieu Patou <mat@samba.org>
Sun, 31 Oct 2010 16:35:17 +0000 (16:35 +0000)
In this case we test if the -Wl,-h,%s works and if so use this form

Autobuild-User: Matthieu Patou <mat@samba.org>
Autobuild-Date: Sun Oct 31 16:35:17 UTC 2010 on sn-devel-104

buildtools/wafsamba/samba_conftests.py
buildtools/wafsamba/wscript

index 49cd4ff17c7a6748efe0d60f424f269f9b795c9f..4811614ab73701497a89909e34185dd39375e737 100644 (file)
@@ -93,6 +93,20 @@ def find_config_dir(conf):
         conf.fatal('cannot use the configuration test folder %r' % dir)
     return dir
 
+@conf
+def CHECK_SHLIB_INTRASINC_NAME_FLAGS(conf, msg):
+    '''
+        check if the waf default flags for setting the name of lib
+        are ok
+    '''
+
+    snip = '''
+int foo(int v) {
+    return v * 2;
+}
+'''
+    return conf.check(features='cc cshlib',vnum="1",fragment=snip,msg=msg)
+
 @conf
 def CHECK_SHLIB_W_PYTHON(conf, msg):
     '''check if we need -undefined dynamic_lookup'''
index 90aeb45582c5f3895156d9c12fa65844835f5181..b9b06abfe8afdf2865d58c92ea23354353543c42 100644 (file)
@@ -275,6 +275,16 @@ def configure(conf):
     else:
         conf.ADD_CFLAGS('-fPIC', testflags=True)
 
+    # On Solaris 8 with suncc (at least) the flags for the linker to define the name of the
+    # library are not always working (if the command line is very very long and with a lot
+    # files)
+
+    if conf.env['COMPILER_CC'] == "suncc":
+        save = conf.env['SONAME_ST']
+        conf.env['SONAME_ST'] = '-Wl,-h,%s'
+        if not conf.CHECK_SHLIB_INTRASINC_NAME_FLAGS("Checking if flags %s are ok" % conf.env['SONAME_ST']):
+            conf.env['SONAME_ST'] = save
+
     conf.CHECK_INLINE()
 
     # check for pkgconfig