1From d302d9a4ac6eb2bbafd248064a878ba287d636b8 Mon Sep 17 00:00:00 2001 2From: Peter Kjellerstedt <pkj@axis.com> 3Date: Tue, 28 Apr 2020 02:05:33 +0200 4Subject: [PATCH] Add options to configure the use of libbsd 5 6Upstream-Status: Inappropriate [oe deterministic build specific] 7 8Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> 9 10Rebase to 4.14.4 11Signed-off-by: Yi Zhao <yi.zhao@windriver.com> 12--- 13 buildtools/wafsamba/wscript | 7 +++++++ 14 lib/replace/wscript | 29 +++++++++++++++-------------- 15 lib/texpect/wscript | 8 +++++++- 16 3 files changed, 29 insertions(+), 15 deletions(-) 17 18diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript 19index 30cb366..d167551 100644 20--- a/buildtools/wafsamba/wscript 21+++ b/buildtools/wafsamba/wscript 22@@ -145,6 +145,13 @@ Currently the only tested value is 'smbtorture,smbd/smbd' for Samba'''), 23 help=("Disable use of gettext"), 24 action="store_true", dest='disable_gettext', default=False) 25 26+ opt.add_option('--with-libbsd', 27+ help=("Enable use of libbsd"), 28+ action="store_true", dest='enable_libbsd') 29+ opt.add_option('--without-libbsd', 30+ help=("Disable use of libbsd"), 31+ action="store_false", dest='enable_libbsd', default=False) 32+ 33 gr = opt.option_group('developer options') 34 35 gr.add_option('-C', 36diff --git a/lib/replace/wscript b/lib/replace/wscript 37index 9dd9b48..a22ae59 100644 38--- a/lib/replace/wscript 39+++ b/lib/replace/wscript 40@@ -444,20 +444,21 @@ def configure(conf): 41 42 strlcpy_in_bsd = False 43 44- # libbsd on some platforms provides strlcpy and strlcat 45- if not conf.CHECK_FUNCS('strlcpy strlcat'): 46- if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', 47- checklibc=True): 48- strlcpy_in_bsd = True 49- if not conf.CHECK_FUNCS('getpeereid'): 50- conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') 51- if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): 52- conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') 53- if not conf.CHECK_FUNCS('setproctitle_init'): 54- conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') 55- 56- if not conf.CHECK_FUNCS('closefrom'): 57- conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') 58+ if Options.options.enable_libbsd: 59+ # libbsd on some platforms provides strlcpy and strlcat 60+ if not conf.CHECK_FUNCS('strlcpy strlcat'): 61+ if conf.CHECK_FUNCS_IN('strlcpy strlcat', 'bsd', headers='bsd/string.h', 62+ checklibc=True): 63+ strlcpy_in_bsd = True 64+ if not conf.CHECK_FUNCS('getpeereid'): 65+ conf.CHECK_FUNCS_IN('getpeereid', 'bsd', headers='sys/types.h bsd/unistd.h') 66+ if not conf.CHECK_FUNCS_IN('setproctitle', 'setproctitle', headers='setproctitle.h'): 67+ conf.CHECK_FUNCS_IN('setproctitle', 'bsd', headers='sys/types.h bsd/unistd.h') 68+ if not conf.CHECK_FUNCS('setproctitle_init'): 69+ conf.CHECK_FUNCS_IN('setproctitle_init', 'bsd', headers='sys/types.h bsd/unistd.h') 70+ 71+ if not conf.CHECK_FUNCS('closefrom'): 72+ conf.CHECK_FUNCS_IN('closefrom', 'bsd', headers='bsd/unistd.h') 73 74 conf.CHECK_CODE(''' 75 struct ucred cred; 76diff --git a/lib/texpect/wscript b/lib/texpect/wscript 77index 44f92a8..79e8d09 100644 78--- a/lib/texpect/wscript 79+++ b/lib/texpect/wscript 80@@ -1,7 +1,13 @@ 81 #!/usr/bin/env python 82 83+from waflib import Options 84+ 85 def configure(conf): 86- conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers='pty.h util.h bsd/libutil.h libutil.h') 87+ hdrs = 'pty.h util.h' 88+ if Options.options.enable_libbsd: 89+ hdrs += ' bsd/libutil.h' 90+ hdrs += ' libutil.h' 91+ conf.CHECK_FUNCS_IN('openpty', 'util', checklibc=True, headers=hdrs) 92 93 def build(bld): 94 bld.SAMBA_BINARY('texpect', 95-- 962.25.1 97 98