From 14f1cc651b21cee6c97a6eb0284cfb98ea7ca3c1 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 18 Aug 2014 11:42:27 +0200 Subject: [PATCH] build: fix configure to honour --without-dmapi Previously, --without-dmapi would still autodetect and link a useable dmapi library. This change allows to build without dmapi support even when a dmapi library is found. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10369 Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Michael Adam Signed-off-by: Stefan Metzmacher (cherry picked from commit 2afacf940f21759c08bcc4a6e906428595966a19) --- source3/wscript | 72 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/source3/wscript b/source3/wscript index 4e48266..659b316 100644 --- a/source3/wscript +++ b/source3/wscript @@ -190,27 +190,32 @@ main() { Logs.warn('no suitable FAM library found') # check for DMAPI libs - Logs.info("Checking for DMAPI library existence") - conf.env['dmapi_lib'] = '' - samba_dmapi_lib = '' - if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'): - samba_dmapi_lib = 'dm' + if Options.options.with_dmapi == False: + have_dmapi = False else: - if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'): - samba_dmapi_lib = 'jfsdm' + have_dmapi = True + Logs.info("Checking for DMAPI library existence") + samba_dmapi_lib = '' + if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'dm'): + samba_dmapi_lib = 'dm' else: - if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'): - samba_dmapi_lib = 'dmapi' + if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'jfsdm'): + samba_dmapi_lib = 'jfsdm' else: - if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'): - samba_dmapi_lib = 'xdsm' - # only bother to test headers and compilation when a candidate - # library has been found - if Options.options.with_dmapi == True and samba_dmapi_lib == '': - conf.fatal('DMAPI support requested, but no suitable DMAPI library found') - else: - conf.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h') - conf.CHECK_CODE(''' + if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'dmapi'): + samba_dmapi_lib = 'dmapi' + else: + if conf.CHECK_FUNCS_IN('dm_get_eventlist', 'xdsm'): + samba_dmapi_lib = 'xdsm' + # only bother to test headers and compilation when a candidate + # library has been found + if samba_dmapi_lib == '': + have_dmapi = False + broken_dmapi = "no suitable DMAPI library found" + + if have_dmapi: + conf.CHECK_HEADERS('sys/dmi.h xfs/dmapi.h sys/jfsdmapi.h sys/dmapi.h dmapi.h') + conf.CHECK_CODE(''' #include /* needed by Tru64 */ #include /* needed by AIX */ #ifdef HAVE_XFS_DMAPI_H @@ -240,17 +245,28 @@ int main(int argc, char **argv) return 0; } ''', - 'USE_DMAPI', - addmain=False, - execute=False, - lib=samba_dmapi_lib, - msg='Checking whether DMAPI lib '+samba_dmapi_lib+' can be used') - - if conf.CONFIG_SET('USE_DMAPI'): - conf.env['dmapi_lib'] = samba_dmapi_lib + 'USEABLE_DMAPI_LIBRARY', + addmain=False, + execute=False, + lib=samba_dmapi_lib, + msg='Checking whether DMAPI lib '+samba_dmapi_lib+' can be used') + if not conf.CONFIG_SET('USEABLE_DMAPI_LIBRARY'): + have_dmapi = False + broken_dmapi = "no usable DMAPI library found" + + if have_dmapi: + Logs.info("Building with DMAPI support.") + conf.env['dmapi_lib'] = samba_dmapi_lib + conf.DEFINE('USE_DMAPI', 1) + else: + if Options.options.with_dmapi == False: + Logs.info("Building without DMAPI support (--without-dmapi).") + elif Options.options.with_dmapi == True: + Logs.error("DMAPI support not available: " + broken_dmapi) + conf.fatal('DMAPI support requested but not found.'); else: - if Options.options.with_dmapi == True: - conf.fatal('DMAPI support requested but not found'); + Logs.warn("Building without DMAPI support: " + broken_dmapi) + conf.env['dmapi_lib'] = '' # Check for various members of the stat structure conf.CHECK_STRUCTURE_MEMBER('struct stat', 'st_blocks', define='HAVE_STAT_ST_BLOCKS', -- 1.9.1