build: optionally enable builtin popt
[nivanova/samba-autobuild/.git] / lib / popt / wscript
1 import Options
2
3 def set_options(opt):
4     opt.add_option('--with-included-popt',
5                    help=("use bundled popt library, not from system"),
6                    action="store_true", dest='INCLUDED_POPT', default=False)
7
8 def configure(conf):
9     conf.CHECK_HEADERS('float.h')
10     if not Options.options.INCLUDED_POPT:
11         if (conf.CHECK_HEADERS('popt.h') and
12             conf.CHECK_FUNCS_IN('poptGetContext', 'popt')):
13             conf.DEFINE('HAVE_SYSTEM_POPT', 1)
14
15 def build(bld):
16     if not bld.CONFIG_SET('HAVE_SYSTEM_POPT'):
17         bld.SAMBA_SUBSYSTEM('LIBPOPT',
18                             source='findme.c popt.c poptconfig.c popthelp.c poptparse.c',
19                             cflags='-DDBL_EPSILON=__DBL_EPSILON__'
20                             )
21         bld.TARGET_ALIAS('LIBPOPT', 'popt')
22     else:
23         bld.TARGET_ALIAS('popt', 'LIBPOPT')