From 45322e68086cbfbb6eba3f4f30609ecd8a64d732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Jacke?= Date: Mon, 7 Jan 2019 01:05:19 +0100 Subject: [PATCH 2/2] waf: fix tri-state of --with-sendfile-support being auto the default --with-sendfile-support should be used automatically if it's found. Configure now also fails reliably for all platforms when sendfile was explicitly requested but failed to be detected. BUG: https://bugzilla.samba.org/show_bug.cgi?id=9707 Signed-off-by: Bjoern Jacke --- source3/wscript | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/source3/wscript b/source3/wscript index 67941258efe6..4da33afa31aa 100644 --- a/source3/wscript +++ b/source3/wscript @@ -47,7 +47,7 @@ def options(opt): opt.SAMBA3_ADD_OPTION('iprint', with_name="enable", without_name="disable") opt.SAMBA3_ADD_OPTION('pam') opt.SAMBA3_ADD_OPTION('quotas') - opt.SAMBA3_ADD_OPTION('sendfile-support') + opt.SAMBA3_ADD_OPTION('sendfile-support', default=None) opt.SAMBA3_ADD_OPTION('utmp') opt.SAMBA3_ADD_OPTION('avahi', with_name="enable", without_name="disable") opt.SAMBA3_ADD_OPTION('iconv') @@ -1258,7 +1258,7 @@ main() { addmain=False, execute=True) - if Options.options.with_sendfile_support: + if not Options.options.with_sendfile_support == False: if (host_os.rfind('linux') > -1) or (host_os.rfind('gnu') > -1) or (host_os.rfind('k*bsd*-gnu') > -1) or (host_os.rfind('kopensolaris*-gnu') > -1): conf.CHECK_CODE(''' int tofd, fromfd; @@ -1273,7 +1273,6 @@ main() { if conf.CONFIG_SET('_HAVE_SENDFILE'): conf.DEFINE('HAVE_SENDFILE', '1') conf.DEFINE('LINUX_SENDFILE_API', '1') - conf.DEFINE('WITH_SENDFILE', '1') elif (host_os.rfind('freebsd') > -1) or (host_os.rfind('dragonfly') > -1): conf.CHECK_CODE(''' #include @@ -1297,7 +1296,6 @@ main() { if conf.CONFIG_SET('_HAVE_SENDFILE'): conf.DEFINE('HAVE_SENDFILE', '1') conf.DEFINE('FREEBSD_SENDFILE_API', '1') - conf.DEFINE('WITH_SENDFILE', '1') elif (host_os.rfind('darwin') > -1): conf.CHECK_CODE(''' #include @@ -1320,7 +1318,6 @@ main() { if conf.CONFIG_SET('_HAVE_SENDFILE'): conf.DEFINE('HAVE_SENDFILE', '1') conf.DEFINE('DARWIN_SENDFILE_API', '1') - conf.DEFINE('WITH_SENDFILE', '1') elif (host_os.rfind('hpux') > -1) or (host_os.rfind('osf') > -1): conf.CHECK_CODE(''' #include @@ -1339,7 +1336,6 @@ main() { if conf.CONFIG_SET('_HAVE_SENDFILE'): conf.DEFINE('HAVE_SENDFILE', '1') conf.DEFINE('HPUX_SENDFILE_API', '1') - conf.DEFINE('WITH_SENDFILE', '1') elif (host_os.rfind('sunos') > -1): conf.CHECK_FUNCS_IN('sendfilev', 'sendfile') conf.CHECK_CODE(''' @@ -1366,7 +1362,6 @@ main() { if conf.CONFIG_SET('_HAVE_SENDFILEV'): conf.DEFINE('HAVE_SENDFILEV', '1') conf.DEFINE('SOLARIS_SENDFILE_API', '1') - conf.DEFINE('WITH_SENDFILE', '1') elif (host_os.rfind('aix') > -1): conf.CHECK_CODE(''' #include @@ -1388,8 +1383,9 @@ main() { if conf.CONFIG_SET('_HAVE_SENDFILE'): conf.DEFINE('HAVE_SENDFILE', '1') conf.DEFINE('AIX_SENDFILE_API', '1') - conf.DEFINE('WITH_SENDFILE', '1') + if Options.options.with_sendfile_support == True and not conf.CONFIG_SET('HAVE_SENDFILE'): + conf.fatal('sendfile support not found but it was requested !') # Check for getcwd allowing a NULL arg. conf.CHECK_CODE(''' #include -- 2.17.1