Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/buildtools/wafsamba/wscript

    r740 r988  
    33# this is a base set of waf rules that everything else pulls in first
    44
    5 import sys, wafsamba, Configure, Logs
    6 import Options, os, preproc
    7 from samba_utils import *
     5import os, sys
     6import wafsamba, Configure, Logs, Options, Utils
     7from samba_utils import os_path_relpath
    88from optparse import SUPPRESS_HELP
    99
     
    2828                   action="store", dest='BUNDLED_LIBS', default='')
    2929
     30    gr.add_option('--private-libraries',
     31                   help=("comma separated list of normally public libraries to build instead as private libraries. May include !LIBNAME to disable making a library private. Can be 'NONE' or 'ALL' [auto]"),
     32                   action="store", dest='PRIVATE_LIBS', default='')
     33
    3034    extension_default = Options.options['PRIVATE_EXTENSION_DEFAULT']
    3135    gr.add_option('--private-library-extension',
     
    3842                   action="store", dest='PRIVATE_EXTENSION_EXCEPTION', default=extension_exception)
    3943
    40     builtin_defauilt = Options.options['BUILTIN_LIBRARIES_DEFAULT']
     44    builtin_default = Options.options['BUILTIN_LIBRARIES_DEFAULT']
    4145    gr.add_option('--builtin-libraries',
    42                    help=("command separated list of libraries to build directly into binaries [%s]" % builtin_defauilt),
    43                    action="store", dest='BUILTIN_LIBRARIES', default=builtin_defauilt)
     46                   help=("command separated list of libraries to build directly into binaries [%s]" % builtin_default),
     47                   action="store", dest='BUILTIN_LIBRARIES', default=builtin_default)
    4448
    4549    gr.add_option('--minimum-library-version',
     
    4751                   action="store", dest='MINIMUM_LIBRARY_VERSION', default='')
    4852
    49     gr.add_option('--disable-shared',
    50                    help=("Disable all use of shared libraries"),
    51                    action="store_true", dest='disable_shared', default=False)
    5253    gr.add_option('--disable-rpath',
    5354                   help=("Disable use of rpath for build binaries"),
     
    7475                   action="store", dest='PRIVATELIBDIR', default=None)
    7576
     77    opt.add_option('--with-libiconv',
     78                   help='additional directory to search for libiconv',
     79                   action='store', dest='iconv_open', default='/usr/local',
     80                   match = ['Checking for library iconv', 'Checking for iconv_open', 'Checking for header iconv.h'])
     81    opt.add_option('--without-gettext',
     82                   help=("Disable use of gettext"),
     83                   action="store_true", dest='disable_gettext', default=False)
     84
    7685    gr = opt.option_group('developer options')
    7786
     
    8291                   help='enable automatic reconfigure on build',
    8392                   action='store_true', dest='enable_auto_reconfigure')
     93    gr.add_option('--enable-debug',
     94                   help=("Turn on debugging symbols"),
     95                   action="store_true", dest='debug', default=False)
    8496    gr.add_option('--enable-developer',
    8597                   help=("Turn on developer warnings and debugging"),
    8698                   action="store_true", dest='developer', default=False)
     99    def picky_developer_callback(option, opt_str, value, parser):
     100        parser.values.developer = True
     101        parser.values.picky_developer = True
    87102    gr.add_option('--picky-developer',
    88103                   help=("Treat all warnings as errors (enable -Werror)"),
    89                    action="store_true", dest='picky_developer', default=False)
     104                   action="callback", callback=picky_developer_callback,
     105                   dest='picky_developer', default=False)
    90106    gr.add_option('--fatal-errors',
    91107                   help=("Stop compilation on first error (enable -Wfatal-errors)"),
     
    103119                   help=("mark version with + if local git changes"),
    104120                   action='store_true', dest='GIT_LOCAL_CHANGES', default=False)
     121    gr.add_option('--address-sanitizer',
     122                   help=("Enable address sanitizer compile and linker flags"),
     123                   action="store_true", dest='address_sanitizer', default=False)
    105124
    106125    gr.add_option('--abi-check',
     
    121140                  help=("check symbols in object files against project rules"),
    122141                  action='store_true', dest='SYMBOLCHECK', default=False)
     142
     143    gr.add_option('--dup-symbol-check',
     144                  help=("check for duplicate symbols in object files and system libs (must be configured with --enable-developer)"),
     145                  action='store_true', dest='DUP_SYMBOLCHECK', default=False)
    123146
    124147    gr.add_option('--why-needed',
     
    153176                   help=SUPPRESS_HELP,
    154177                   action='store', dest='AUTOCONF_HOST', default='')
     178    opt.add_option('--target',
     179                   help=SUPPRESS_HELP,
     180                   action='store', dest='AUTOCONF_TARGET', default='')
    155181    opt.add_option('--program-prefix',
    156182                   help=SUPPRESS_HELP,
     
    159185                   help=SUPPRESS_HELP,
    160186                   action='store_true', dest='AUTOCONF_DISABLE_DEPENDENCY_TRACKING', default=False)
     187    opt.add_option('--disable-silent-rules',
     188                   help=SUPPRESS_HELP,
     189                   action='store_true', dest='AUTOCONF_DISABLE_SILENT_RULES', default=False)
    161190
    162191    gr = opt.option_group('dist options')
     
    168197                   type='string', action='store', dest='TAG_RELEASE')
    169198
    170 
    171 @wafsamba.runonce
     199    opt.add_option('--extra-python', type=str,
     200                    help=("build selected libraries for the specified "
     201                          "additional version of Python "
     202                          "(example: --extra-python=/usr/bin/python3)"),
     203                    metavar="PYTHON", dest='EXTRA_PYTHON', default=None)
     204
     205
     206@Utils.run_once
    172207def configure(conf):
    173208    conf.env.hlist = []
     
    182217    conf.check_tool('gnu_dirs')
    183218    conf.check_tool('wafsamba')
     219    conf.check_tool('print_commands')
    184220
    185221    conf.CHECK_CC_ENV()
    186222
    187223    conf.check_tool('compiler_cc')
     224
     225    conf.CHECK_STANDARD_LIBPATH()
    188226
    189227    # we need git for 'waf dist'
     
    192230    # older gcc versions (< 4.4) does not work with gccdeps, so we have to see if the .d file is generated
    193231    if Options.options.enable_gccdeps:
     232        # stale file removal - the configuration may pick up the old .pyc file
     233        p = os.path.join(conf.srcdir, 'buildtools/wafsamba/gccdeps.pyc')
     234        if os.path.exists(p):
     235            os.remove(p)
     236
    194237        from TaskGen import feature, after
    195238        @feature('testd')
     
    206249        try:
    207250            try:
    208                 conf.check(features='cc testd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD')
     251                conf.check(features='c testd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD')
    209252            except:
    210253                pass
     
    221264    conf.env.PRIVATELIBDIR = Options.options.PRIVATELIBDIR
    222265    conf.env.BUNDLED_LIBS = Options.options.BUNDLED_LIBS.split(',')
     266    conf.env.PRIVATE_LIBS = Options.options.PRIVATE_LIBS.split(',')
    223267    conf.env.BUILTIN_LIBRARIES = Options.options.BUILTIN_LIBRARIES.split(',')
    224     conf.env.DISABLE_SHARED = Options.options.disable_shared
    225268    conf.env.NONSHARED_BINARIES = Options.options.NONSHARED_BINARIES.split(',')
    226269
     
    236279    conf.env.AUTOCONF_HOST  = Options.options.AUTOCONF_HOST
    237280    conf.env.AUTOCONF_PROGRAM_PREFIX = Options.options.AUTOCONF_PROGRAM_PREFIX
     281
     282    conf.env.EXTRA_PYTHON = Options.options.EXTRA_PYTHON
    238283
    239284    if (conf.env.AUTOCONF_HOST and
     
    271316                    msg='Checking simple C program')
    272317
    273     # see if we can build shared libs
    274     if not conf.CHECK_LIBRARY_SUPPORT():
    275         conf.env.DISABLE_SHARED = True
     318    # Try to find the right extra flags for -Werror behaviour
     319    for f in ["-Werror",       # GCC
     320              "-errwarn=%all", # Sun Studio
     321              "-qhalt=w",     # IBM xlc
     322              "-w2",           # Tru64
     323             ]:
     324        if conf.CHECK_CFLAGS([f], '''
     325'''):
     326            if not 'WERROR_CFLAGS' in conf.env:
     327                conf.env['WERROR_CFLAGS'] = []
     328            conf.env['WERROR_CFLAGS'].extend([f])
     329            break
     330
     331    # check which compiler/linker flags are needed for rpath support
     332    if not conf.CHECK_LDFLAGS(['-Wl,-rpath,.']) and conf.CHECK_LDFLAGS(['-Wl,-R,.']):
     333        conf.env['RPATH_ST'] = '-Wl,-R,%s'
    276334
    277335    # check for rpath
    278     if not conf.env.DISABLE_SHARED and conf.CHECK_LIBRARY_SUPPORT(rpath=True):
     336    if conf.CHECK_LIBRARY_SUPPORT(rpath=True):
    279337        support_rpath = True
    280338        conf.env.RPATH_ON_BUILD   = not Options.options.disable_rpath_build
     
    296354            conf.env.PRIVATELIBDIR = conf.env.LIBDIR
    297355
    298     if (not conf.env.DISABLE_SHARED and
    299         not Options.options.disable_symbol_versions and
     356    if (not Options.options.disable_symbol_versions and
    300357        conf.CHECK_LIBRARY_SUPPORT(rpath=support_rpath,
    301358                                   version_script=True,
     
    305362        conf.env.HAVE_LD_VERSION_SCRIPT = False
    306363
    307     if sys.platform == "aix5":
     364    if conf.CHECK_CFLAGS(['-fvisibility=hidden'] + conf.env.WERROR_CFLAGS):
     365        conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
     366        conf.CHECK_CODE('''int main(void) { return 0; }
     367                           __attribute__((visibility("default"))) void vis_foo2(void) {}''',
     368                        cflags=conf.env.VISIBILITY_CFLAGS,
     369                        define='HAVE_VISIBILITY_ATTR', addmain=False)
     370
     371    # check HAVE_CONSTRUCTOR_ATTRIBUTE
     372    conf.CHECK_CODE('''
     373            void test_constructor_attribute(void) __attribute__ ((constructor));
     374
     375            void test_constructor_attribute(void)
     376            {
     377                return;
     378            }
     379
     380            int main(void) {
     381                return 0;
     382            }
     383            ''',
     384            'HAVE_CONSTRUCTOR_ATTRIBUTE',
     385            addmain=False,
     386            msg='Checking for library constructor support')
     387
     388        # check HAVE_DESTRUCTOR_ATTRIBUTE
     389    conf.CHECK_CODE('''
     390            void test_destructor_attribute(void) __attribute__ ((destructor));
     391
     392            void test_destructor_attribute(void)
     393            {
     394                return;
     395            }
     396
     397            int main(void) {
     398                return 0;
     399            }
     400            ''',
     401            'HAVE_DESTRUCTOR_ATTRIBUTE',
     402            addmain=False,
     403            msg='Checking for library destructor support')
     404
     405    if sys.platform.startswith('aix'):
    308406        conf.DEFINE('_ALL_SOURCE', 1, add_to_cflags=True)
    309407        # Might not be needed if ALL_SOURCE is defined
     
    335433
    336434    # check for pkgconfig
    337     conf.check_cfg(atleast_pkgconfig_version='0.0.0')
     435    conf.CHECK_CFG(atleast_pkgconfig_version='0.0.0')
    338436
    339437    conf.DEFINE('_GNU_SOURCE', 1, add_to_cflags=True)
    340438    conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1, add_to_cflags=True)
     439
     440    # on Tru64 certain features are only available with _OSF_SOURCE set to 1
     441    # and _XOPEN_SOURCE set to 600
     442    if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1':
     443        conf.DEFINE('_OSF_SOURCE', 1, add_to_cflags=True)
     444        conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
     445
     446    # SCM_RIGHTS is only avail if _XOPEN_SOURCE iѕ defined on IRIX
     447    if conf.env['SYSTEM_UNAME_SYSNAME'] == 'IRIX':
     448        conf.DEFINE('_XOPEN_SOURCE', 600, add_to_cflags=True)
     449        conf.DEFINE('_BSD_TYPES', 1, add_to_cflags=True)
     450
     451    # Try to find the right extra flags for C99 initialisers
     452    for f in ["", "-AC99", "-qlanglvl=extc99", "-qlanglvl=stdc99", "-c99"]:
     453        if conf.CHECK_CFLAGS([f], '''
     454struct foo {int x;char y;};
     455struct foo bar = { .y = 'X', .x = 1 };
     456'''):
     457            if f != "":
     458                conf.ADD_CFLAGS(f)
     459            break
    341460
    342461    # get the base headers we'll use for the rest of the tests
     
    344463                       add_headers=True)
    345464    conf.CHECK_HEADERS('strings.h inttypes.h stdint.h unistd.h minix/config.h', add_headers=True)
    346     conf.CHECK_HEADERS('ctype.h standards.h stdbool.h stdint.h stdarg.h vararg.h', add_headers=True)
     465    conf.CHECK_HEADERS('ctype.h', add_headers=True)
     466
     467    if sys.platform != 'darwin':
     468        conf.CHECK_HEADERS('standards.h', add_headers=True)
     469
     470    conf.CHECK_HEADERS('stdbool.h stdint.h stdarg.h vararg.h', add_headers=True)
    347471    conf.CHECK_HEADERS('limits.h assert.h')
    348472
    349473    # see if we need special largefile flags
    350     conf.CHECK_LARGEFILE()
     474    if not conf.CHECK_LARGEFILE():
     475        raise Utils.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8')
    351476
    352477    if 'HAVE_STDDEF_H' in conf.env and 'HAVE_STDLIB_H' in conf.env:
     
    365490        conf.define('SHLIBEXT', "so", quote=True)
    366491
    367     conf.CHECK_CODE('long one = 1; return ((char *)(&one))[0]',
    368                     execute=True,
    369                     define='WORDS_BIGENDIAN')
     492    # First try a header check for cross-compile friendlyness
     493    conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
     494                        #define B __BYTE_ORDER
     495                        #elif defined(BYTE_ORDER)
     496                        #define B BYTE_ORDER
     497                        #endif
     498
     499                        #ifdef __LITTLE_ENDIAN
     500                        #define LITTLE __LITTLE_ENDIAN
     501                        #elif defined(LITTLE_ENDIAN)
     502                        #define LITTLE LITTLE_ENDIAN
     503                        #endif
     504
     505                        #if !defined(LITTLE) || !defined(B) || LITTLE != B
     506                        #error Not little endian.
     507                        #endif
     508                        int main(void) { return 0; }""",
     509                            addmain=False,
     510                            headers="endian.h sys/endian.h",
     511                            define="HAVE_LITTLE_ENDIAN")
     512    conf.CHECK_CODE(code = """#ifdef __BYTE_ORDER
     513                        #define B __BYTE_ORDER
     514                        #elif defined(BYTE_ORDER)
     515                        #define B BYTE_ORDER
     516                        #endif
     517
     518                        #ifdef __BIG_ENDIAN
     519                        #define BIG __BIG_ENDIAN
     520                        #elif defined(BIG_ENDIAN)
     521                        #define BIG BIG_ENDIAN
     522                        #endif
     523
     524                        #if !defined(BIG) || !defined(B) || BIG != B
     525                        #error Not big endian.
     526                        #endif
     527                        int main(void) { return 0; }""",
     528                            addmain=False,
     529                            headers="endian.h sys/endian.h",
     530                            define="HAVE_BIG_ENDIAN")
     531
     532    if not conf.CONFIG_SET("HAVE_BIG_ENDIAN") and not conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
     533        # That didn't work!  Do runtime test.
     534        conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
     535            u.i = 0x01020304;
     536            return u.c[0] == 0x04 && u.c[1] == 0x03 && u.c[2] == 0x02 && u.c[3] == 0x01 ? 0 : 1;""",
     537                          addmain=True, execute=True,
     538                          define='HAVE_LITTLE_ENDIAN',
     539                          msg="Checking for HAVE_LITTLE_ENDIAN - runtime")
     540        conf.CHECK_CODE("""union { int i; char c[sizeof(int)]; } u;
     541            u.i = 0x01020304;
     542            return u.c[0] == 0x01 && u.c[1] == 0x02 && u.c[2] == 0x03 && u.c[3] == 0x04 ? 0 : 1;""",
     543                          addmain=True, execute=True,
     544                          define='HAVE_BIG_ENDIAN',
     545                          msg="Checking for HAVE_BIG_ENDIAN - runtime")
     546
     547    # Extra sanity check.
     548    if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
     549        Logs.error("Failed endian determination.  The PDP-11 is back?")
     550        sys.exit(1)
     551    else:
     552        if conf.CONFIG_SET("HAVE_BIG_ENDIAN"):
     553            conf.DEFINE('WORDS_BIGENDIAN', 1)
    370554
    371555    # check if signal() takes a void function
Note: See TracChangeset for help on using the changeset viewer.