summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-02-24 13:26:29 +1300
committerJeremy Allison <jra@samba.org>2015-10-09 20:14:06 +0200
commit1dc05386f20481596ee7360d6f4e628a16675d3f (patch)
tree3145de0a4c237250602e75504620635ea8dbf41d
parentf25a5c9e84e802bc7005d6bd400cbf784fb30fdf (diff)
downloadsamba-1dc05386f20481596ee7360d6f4e628a16675d3f.tar.gz
build: Move __attribute__ ((destructor)) and ((constructor)) tests to wafsamba
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>
-rwxr-xr-xbuildtools/wafsamba/wscript34
-rw-r--r--lib/uid_wrapper/wscript34
-rw-r--r--nsswitch/wb_common.c2
-rw-r--r--source3/wscript6
4 files changed, 35 insertions, 41 deletions
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index d6bb6885a1c..422b74254ff 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -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
diff --git a/lib/uid_wrapper/wscript b/lib/uid_wrapper/wscript
index 016b33a4a73..8e3950fa5a8 100644
--- a/lib/uid_wrapper/wscript
+++ b/lib/uid_wrapper/wscript
@@ -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('''
diff --git a/nsswitch/wb_common.c b/nsswitch/wb_common.c
index 139f0106669..da1a84476e8 100644
--- a/nsswitch/wb_common.c
+++ b/nsswitch/wb_common.c
@@ -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)
diff --git a/source3/wscript b/source3/wscript
index 9ff9c2040d0..3118f59d628 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -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',