waf: check the linker accepts a set of ldflags before using them
authorAndrew Tridgell <tridge@samba.org>
Thu, 21 Oct 2010 07:36:41 +0000 (18:36 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 21 Oct 2010 08:45:49 +0000 (08:45 +0000)
Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Thu Oct 21 08:45:49 UTC 2010 on sn-devel-104

buildtools/wafsamba/samba_autoconf.py

index 8cab1285956b075547c1d6a08d6882c74bd73b45..ea2ef0980687720e77117343ab1a6976d9c1bfa9 100644 (file)
@@ -436,6 +436,15 @@ def CHECK_CFLAGS(conf, cflags):
                       ccflags=cflags,
                       msg="Checking compiler accepts %s" % cflags)
 
+@conf
+def CHECK_LDFLAGS(conf, ldflags):
+    '''check if the given ldflags are accepted by the linker
+    '''
+    return conf.check(fragment='int main(void) { return 0; }\n',
+                      execute=0,
+                      ldflags=ldflags,
+                      msg="Checking linker accepts %s" % ldflags)
+
 
 @conf
 def CONFIG_SET(conf, option):
@@ -619,7 +628,7 @@ def ADD_LDFLAGS(conf, flags, testflags=False):
     if testflags:
         ok_flags=[]
         for f in flags.split():
-            if CHECK_CFLAGS(conf, f):
+            if CHECK_LDFLAGS(conf, f):
                 ok_flags.append(f)
         flags = ok_flags
     if not 'EXTRA_LDFLAGS' in conf.env: