build: Move __attribute__ ((destructor)) and ((constructor)) tests to wafsamba
authorAndrew Bartlett <abartlet@samba.org>
Tue, 24 Feb 2015 00:26:29 +0000 (13:26 +1300)
committerJeremy Allison <jra@samba.org>
Fri, 9 Oct 2015 18:14:06 +0000 (20:14 +0200)
This allows us to use them in talloc as well.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Adrian Cochrane <adrianc@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
buildtools/wafsamba/wscript
lib/uid_wrapper/wscript
nsswitch/wb_common.c
source3/wscript

index d6bb6885a1cc0fb7c05b874f89408144f988d4de..422b74254ff2e4c066c4534014316bcef01e2ca7 100755 (executable)
@@ -361,6 +361,40 @@ def configure(conf):
                         cflags=conf.env.VISIBILITY_CFLAGS,
                         define='HAVE_VISIBILITY_ATTR', addmain=False)
 
+    # check HAVE_CONSTRUCTOR_ATTRIBUTE
+    conf.CHECK_CODE('''
+            void test_constructor_attribute(void) __attribute__ ((constructor));
+
+            void test_constructor_attribute(void)
+            {
+                return;
+            }
+
+            int main(void) {
+                return 0;
+            }
+            ''',
+            'HAVE_CONSTRUCTOR_ATTRIBUTE',
+            addmain=False,
+            msg='Checking for library constructor support')
+
+        # check HAVE_DESTRUCTOR_ATTRIBUTE
+    conf.CHECK_CODE('''
+            void test_destructor_attribute(void) __attribute__ ((destructor));
+
+            void test_destructor_attribute(void)
+            {
+                return;
+            }
+
+            int main(void) {
+                return 0;
+            }
+            ''',
+            'HAVE_DESTRUCTOR_ATTRIBUTE',
+            addmain=False,
+            msg='Checking for library destructor support')
+
     if sys.platform.startswith('aix'):
         conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True)
         # Might not be needed if ALL_SOURCE is defined
index 016b33a4a73b4575ab5572b3f0e266c468097dad..8e3950fa5a88f8e5df35f35fcda3b6c1f7f3b28e 100644 (file)
@@ -35,40 +35,6 @@ def configure(conf):
             addmain=False,
             msg='Checking for thread local storage')
 
-        # check HAVE_CONSTRUCTOR_ATTRIBUTE
-        conf.CHECK_CODE('''
-            void test_constructor_attribute(void) __attribute__ ((constructor));
-
-            void test_constructor_attribute(void)
-            {
-                return;
-            }
-
-            int main(void) {
-                return 0;
-            }
-            ''',
-            'HAVE_CONSTRUCTOR_ATTRIBUTE',
-            addmain=False,
-            msg='Checking for library constructor support')
-
-        # check HAVE_DESTRUCTOR_ATTRIBUTE
-        conf.CHECK_CODE('''
-            void test_destructor_attribute(void) __attribute__ ((destructor));
-
-            void test_destructor_attribute(void)
-            {
-                return;
-            }
-
-            int main(void) {
-                return 0;
-            }
-            ''',
-            'HAVE_DESTRUCTOR_ATTRIBUTE',
-            addmain=False,
-            msg='Checking for library destructor support')
-
         if Options.options.address_sanitizer:
             # check HAVE_ADDRESS_SANITIZER_ATTRIBUTE
             conf.CHECK_CODE('''
index 139f0106669cc499d7d09cc6b3ef1c24256b5d02..da1a84476e8b88cf7f9a1896f0b93f714e1629e4 100644 (file)
@@ -88,7 +88,7 @@ static void winbind_close_sock(struct winbindd_context *ctx)
 
 /* Destructor for global context to ensure fd is closed */
 
-#if HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR
+#if HAVE_DESTRUCTOR_ATTRIBUTE
 __attribute__((destructor))
 #endif
 static void winbind_destructor(void)
index 9ff9c2040d0a3851ace1828754e44684a80c0c43..3118f59d6288479a7da8d754cb9726a3e08ceb3a 100644 (file)
@@ -1492,12 +1492,6 @@ main() {
         conf.env['CTDB_INCLUDE'] = conf.srcdir + '/ctdb/include'
         conf.env.with_ctdb = True
 
-    conf.CHECK_CODE('__attribute__((destructor)) static void cleanup(void) { }',
-                    'HAVE_FUNCTION_ATTRIBUTE_DESTRUCTOR',
-                    addmain=False,
-                    link=False,
-                    msg='Checking whether we can compile with __attribute__((destructor))')
-
     conf.CHECK_CODE('void seekdir(DIR *d, long loc) { return; }',
                     'SEEKDIR_RETURNS_VOID',
                     headers='sys/types.h dirent.h',