1From 54fbeaa68a59f536819d1cfb2e9204176fbff54b Mon Sep 17 00:00:00 2001
2From: Peter Seiderer <ps.report@gmx.net>
3Date: Thu, 16 Dec 2021 23:27:35 +0100
4Subject: [PATCH] wscript: remove checks for bsd/string.h, fixes host-compile
5 failure
6
7Fixes the following host-compile failure while cross-compiling
8in case target libbsd is found:
9
10  [2/2] Compiling build/host/ntpd/ntp_parser.tab.c
11  In file included from ../../include/ntp.h:15,
12                   from .../build/ntpsec-1_2_1/ntpd/ntp_parser.y:16:
13  ../../include/ntp_stdlib.h:20:10: fatal error: bsd/string.h: No such file or directory
14     20 | #include <bsd/string.h>
15        |          ^~~~~~~~~~~~~~
16  compilation terminated.
17
18Signed-off-by: Peter Seiderer <ps.report@gmx.net>
19---
20 include/ntp_stdlib.h |  4 ----
21 wscript              | 14 --------------
22 2 files changed, 18 deletions(-)
23
24diff --git a/include/ntp_stdlib.h b/include/ntp_stdlib.h
25index fe4d78e5c..73d97084f 100644
26--- a/include/ntp_stdlib.h
27+++ b/include/ntp_stdlib.h
28@@ -16,10 +16,6 @@
29 #include "ntp_malloc.h"
30 #include "ntp_syslog.h"
31
32-#ifdef HAVE_BSD_STRING_H
33-#include <bsd/string.h>
34-#endif
35-
36 #ifdef __GNUC__
37 #define NTP_PRINTF(fmt, args) __attribute__((__format__(__printf__, fmt, args)))
38 #else
39diff --git a/wscript b/wscript
40index 641073f00..aa04b1d1c 100644
41--- a/wscript
42+++ b/wscript
43@@ -660,19 +660,6 @@ int main(int argc, char **argv) {
44                        prerequisites=ft[1], use=ft[2],
45                        mandatory=ft[3])
46
47-    # check for BSD versions outside of libc
48-    if not ctx.get_define("HAVE_STRLCAT"):
49-        ret = probe_function(ctx, function='strlcat',
50-                             prerequisites=['bsd/string.h'])
51-        if ret:
52-            ctx.define("HAVE_STRLCAT", 1, comment="Using bsd/strlcat")
53-
54-    if not ctx.get_define("HAVE_STRLCPY"):
55-        ret = probe_function(ctx, function='strlcpy',
56-                             prerequisites=['bsd/string.h'])
57-        if ret:
58-            ctx.define("HAVE_STRLCPY", 1, comment="Using bsd/strlcpy")
59-
60     # Nobody uses the symbol, but this seems like a good sanity check.
61     ctx.check_cc(header_name="stdbool.h", mandatory=True,
62                  comment="Sanity check.")
63@@ -691,7 +678,6 @@ int main(int argc, char **argv) {
64     optional_headers = (
65         "alloca.h",
66         ("arpa/nameser.h", ["sys/types.h"]),
67-        "bsd/string.h",     # bsd emulation
68         ("ifaddrs.h", ["sys/types.h"]),
69         ("linux/if_addr.h", ["sys/socket.h"]),
70         ("linux/rtnetlink.h", ["sys/socket.h"]),
71--
722.34.1
73
74