From 1625dc4b5683ddc06fa6bf77b5b21eed7093862d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 9 Dec 2022 14:48:06 +0100 Subject: [PATCH] tsocket: Fix the build on FreeBSD FreeBSD does not have TCP_USER_TIMEOUT Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/tsocket/wscript | 36 ++++++++++++++++++++++++++++++++++++ lib/tsocket/wscript_build | 21 --------------------- selftest/tests.py | 7 ++++--- wscript | 1 + 4 files changed, 41 insertions(+), 24 deletions(-) create mode 100644 lib/tsocket/wscript delete mode 100644 lib/tsocket/wscript_build diff --git a/lib/tsocket/wscript b/lib/tsocket/wscript new file mode 100644 index 00000000000..fa284a78f25 --- /dev/null +++ b/lib/tsocket/wscript @@ -0,0 +1,36 @@ +#!/usr/bin/env python + +def configure(conf): + conf.CHECK_CODE(''' + #include + int main(void) { return TCP_USER_TIMEOUT; } + ''', + 'HAVE_TCP_USER_TIMEOUT', + addmain=False, + msg='Checking for TCP_USER_TIMEOUT') + +def build(bld): + bld.SAMBA_SUBSYSTEM( + 'LIBTSOCKET', + source='tsocket.c tsocket_helpers.c tsocket_bsd.c', + public_deps='talloc tevent iov_buf socket-blocking', + public_headers='tsocket.h tsocket_internal.h' + ) + + bld.SAMBA_BINARY( + 'test_tsocket_bsd_addr', + source='tests/test_bsd_addr.c', + deps='cmocka replace LIBTSOCKET', + local_include=False, + for_selftest=True + ) + + bld.SAMBA_BINARY( + 'test_tstream', + source='tests/test_tstream.c tests/socketpair_tcp.c', + deps='cmocka replace LIBTSOCKET', + local_include=False, + enabled=bld.CONFIG_SET('HAVE_TCP_USER_TIMEOUT'), + for_selftest=True + ) + diff --git a/lib/tsocket/wscript_build b/lib/tsocket/wscript_build deleted file mode 100644 index 73adcb9628d..00000000000 --- a/lib/tsocket/wscript_build +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env python - - -bld.SAMBA_SUBSYSTEM('LIBTSOCKET', - source='tsocket.c tsocket_helpers.c tsocket_bsd.c', - public_deps='talloc tevent iov_buf socket-blocking', - public_headers='tsocket.h tsocket_internal.h', - ) - -bld.SAMBA_BINARY('test_tsocket_bsd_addr', - source='tests/test_bsd_addr.c', - deps='cmocka replace LIBTSOCKET', - local_include=False, - for_selftest=True) - -bld.SAMBA_BINARY('test_tstream', - source='tests/test_tstream.c tests/socketpair_tcp.c', - deps='cmocka replace LIBTSOCKET', - local_include=False, - for_selftest=True) - diff --git a/selftest/tests.py b/selftest/tests.py index 60efa5679f8..2cafe2faa4e 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -469,9 +469,10 @@ plantestsuite("samba.unittests.credentials", "none", [os.path.join(bindir(), "default/auth/credentials/test_creds")]) plantestsuite("samba.unittests.tsocket_bsd_addr", "none", [os.path.join(bindir(), "default/lib/tsocket/test_tsocket_bsd_addr")]) -plantestsuite("samba.unittests.tsocket_tstream", "none", - [os.path.join(bindir(), "default/lib/tsocket/test_tstream")], - environ={'SOCKET_WRAPPER_DIR': ''}) +if ("HAVE_TCP_USER_TIMEOUT" in config_hash): + plantestsuite("samba.unittests.tsocket_tstream", "none", + [os.path.join(bindir(), "default/lib/tsocket/test_tstream")], + environ={'SOCKET_WRAPPER_DIR': ''}) plantestsuite("samba.unittests.adouble", "none", [os.path.join(bindir(), "test_adouble")]) plantestsuite("samba.unittests.gnutls_aead_aes_256_cbc_hmac_sha512", "none", diff --git a/wscript b/wscript index b556aa0cbe2..08995fbe4ec 100644 --- a/wscript +++ b/wscript @@ -348,6 +348,7 @@ def configure(conf): conf.RECURSE('source3') conf.RECURSE('lib/texpect') + conf.RECURSE('lib/tsocket') conf.RECURSE('python') if conf.env.with_ctdb: conf.RECURSE('ctdb') -- 2.11.4.GIT