summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-12-09 14:48:06 +0100
committerJeremy Allison <jra@samba.org>2022-12-12 21:16:33 +0000
commit1625dc4b5683ddc06fa6bf77b5b21eed7093862d (patch)
treeb8a0c7bc0e3472b6992984fbf819114bbd71b923
parent6d365777158e141384acf43667cf6a599c183356 (diff)
downloadsamba-1625dc4b5683ddc06fa6bf77b5b21eed7093862d.tar.gz
tsocket: Fix the build on FreeBSD
FreeBSD does not have TCP_USER_TIMEOUT Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/tsocket/wscript36
-rw-r--r--lib/tsocket/wscript_build21
-rw-r--r--selftest/tests.py7
-rw-r--r--wscript1
4 files changed, 41 insertions, 24 deletions
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 <netinet/tcp.h>
+ 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')