# -*- mode: python; -*-
# NOTE: This file is auto-generated by "zlib_get_sources.sh" - DO NOT EDIT

Import("env")
Import("get_option")

env = env.Clone(NINJA_GENSOURCE_INDEPENDENT=True)

# Enabling the function sanitizer (part of ubsan) references symbols defined in a separate file when compiled with
# dynamic linking in Clang. The C program definitions setup in SCons do not link this separate file.
# Disable function sanitizer to avoid triggering symbol resolution errors when libraries defined in this
# environment are used by C programs (in this case, wiredtiger).
if get_option("link-model") == "dynamic" and 'undefined' in (get_option('sanitize')
                                                             or '').split(','):
    if env.AddToCCFLAGSIfSupported("-fno-sanitize=function"):
        env.AppendUnique(LINKFLAGS=["-fno-sanitize=function"])

env.Append(CPPDEFINES=["HAVE_STDARG_H"])
if not env.TargetOSIs('windows'):
    env.Append(CPPDEFINES=["HAVE_UNISTD_H"])

env.Library(
    target="zlib",
    source=[
        'adler32.c',
        'crc32.c',
        'compress.c',
        'deflate.c',
        'infback.c',
        'inffast.c',
        'inflate.c',
        'inftrees.c',
        'trees.c',
        'uncompr.c',
        'zutil.c',
    ],
    LIBDEPS_TAGS=[
        'init-no-global-side-effects',
    ],
)
