buildtools/wafsamba: make sure CHECK_FUNC() and CHECK_VARIABLE() work with -O3 in...
authorStefan Metzmacher <metze@samba.org>
Tue, 13 Apr 2010 10:56:19 +0000 (12:56 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 13 Apr 2010 10:59:07 +0000 (12:59 +0200)
'CFLAGS="-O3" waf configure' was not detecting dlopen() needs -ldl.

metze

buildtools/wafsamba/samba_autoconf.py

index 9d0229e1479ae5553889dcf0734b6c43af2598b4..dca659596482e2502944fff577e380689c099fee 100644 (file)
@@ -188,9 +188,11 @@ def CHECK_VARIABLE(conf, v, define=None, always=False,
         msg="Checking for variable %s" % v
 
     return CHECK_CODE(conf,
+                      # we need to make sure the compiler doesn't
+                      # optimize it out...
                       '''
                       #ifndef %s
-                      void *_x; _x=(void *)&%s;
+                      void *_x; _x=(void *)&%s; return (int)_x;
                       #endif
                       return 0
                       ''' % (v, v),
@@ -264,7 +266,9 @@ def CHECK_FUNC(conf, f, link=True, lib=None, headers=None):
         if not ret:
             ret = CHECK_CODE(conf,
                              # it might be a macro
-                             'void *__x = (void *)%s' % f,
+                             # we need to make sure the compiler doesn't
+                             # optimize it out...
+                             'void *__x = (void *)%s; return (int)__x' % f,
                              execute=False,
                              link=True,
                              addmain=True,