Пример #1
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Check support of the given list of compiler/linker flags.

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg('Checking for %s: %s' % (flagtype, flag))
        try:
            if flagtype == 'cflags':
                conf.check_cc(cflags=flag)
            elif flagtype == 'cxxflags':
                conf.check_cxx(cxxflags=flag)
            elif flagtype == 'linkflags':
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg('no', color='YELLOW')
        else:
            conf.end_msg('yes')
            ret.append(flag)

    return ret
Пример #2
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Tries the given list of compiler/linker flags if they are supported by the
    current compiler, and returns the list of supported flags

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg('Checking for %s: %s' % (flagtype, flag))
        try:
            if flagtype == 'cflags':
                conf.check_cc(cflags=flag)
            elif flagtype == 'cxxflags':
                conf.check_cxx(cxxflags=flag)
            elif flagtype == 'linkflags':
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg('no', color='YELLOW')
        else:
            conf.end_msg('yes')
            ret.append(flag)

    return ret
Пример #3
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Tries the given list of compiler/linker flags if they are supported by the
    current compiler, and returns the list of supported flags

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg("Checking for %s: %s" % (flagtype, flag))
        try:
            if flagtype == "cflags":
                conf.check_cc(cflags=flag)
            elif flagtype == "cxxflags":
                conf.check_cxx(cxxflags=flag)
            elif flagtype == "linkflags":
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg("no", color="YELLOW")
        else:
            conf.end_msg("yes")
            ret.append(flag)

    return ret
Пример #4
0
def mkspec_try_flags(conf, flagtype, flaglist):
    """
    Check support of the given list of compiler/linker flags.

    :param flagtype: The flag type, cflags, cxxflags or linkflags
    :param flaglist: The list of flags to be checked

    :return: The list of supported flags
    """
    ret = []

    for flag in flaglist:
        conf.start_msg("Checking for %s: %s" % (flagtype, flag))
        try:
            if flagtype == "cflags":
                conf.check_cc(cflags=flag)
            elif flagtype == "cxxflags":
                conf.check_cxx(cxxflags=flag)
            elif flagtype == "linkflags":
                conf.check_cxx(linkflags=flag)
        except conf.errors.ConfigurationError:
            conf.end_msg("no", color="YELLOW")
        else:
            conf.end_msg("yes")
            ret.append(flag)

    return ret
Пример #5
0
def _check_default_arch(conf,
                        start_msg,
                        fragment,
                        output_var,
                        compile_filename="test.c",
                        features="c cprogram"):
    env = conf.env

    if not "FILE_BIN" in conf.env:
        file_bin = conf.find_program(["file"], var="FILE_BIN")
    else:
        file_bin = conf.env.FILE_BIN

    conf.start_msg(start_msg)
    ret = conf.check_cc(fragment=fragment,
                        compile_filename=compile_filename,
                        features=features)
    task_gen = conf.test_bld.groups[0][0]
    obj_filename = task_gen.tasks[0].outputs[0].abspath()
    out = conf.cmd_and_log([file_bin, obj_filename])
    m = FILE_MACHO_RE.search(out)
    if m is None:
        conf.fatal("Could not determine arch from output %r" % out)
    else:
        default_arch = m.group(1)
        conf.env[output_var] = default_arch
        conf.end_msg(default_arch)
Пример #6
0
def check_cc_arch(conf):
    env = conf.env
    archs = []

    for arch in ARCHS:
        env.stash()
        try:
            env.append_value('CFLAGS', ['-arch', arch])
            env.append_value('LINKFLAGS', ['-arch', arch])
            try:
                conf.check_cc(fragment=SNIP_EMPTY_PROGRAM, msg="Checking for %r suport" % arch)
                archs.append(arch)
            except conf.errors.ConfigurationError:
                pass
        finally:
            env.revert()

    env["ARCH_CC"] = archs
Пример #7
0
def check_ssl(conf):
    if not conf.check_cfg(package='openssl', args=['--cflags', '--libs'], uselib_store='SSL', mandatory=False):
        libcrypto = conf.check_cc(lib='crypto',
                                  header_name='openssl/crypto.h',
                                  define_name='HAVE_SSL',
                                  uselib_store='SSL')
    else:
        conf.define("HAVE_SSL", 1)
    if not conf.get_define ("HAVE_SSL"):
        conf.fatal("Cannot find SSL libraries")
Пример #8
0
def check_cc_arch(conf):
    env = conf.env
    archs = []

    for arch in ARCHS:
        env.stash()
        try:
            env.append_value('CFLAGS', ['-arch', arch])
            env.append_value('LINKFLAGS', ['-arch', arch])
            try:
                conf.check_cc(fragment=SNIP_EMPTY_PROGRAM,
                              msg="Checking for %r suport" % arch)
                archs.append(arch)
            except conf.errors.ConfigurationError:
                pass
        finally:
            env.revert()

    env["ARCH_CC"] = archs
Пример #9
0
def find_mpi_cc(conf):
	cc=conf.find_program(['mpiicc','mpicc','cc'],var='MPI_CC')
	cc=conf.cmd_to_list(cc)
	
	# Verify actual MPI implementation
	conf.env.stash()
	conf.env.CC = cc
	conf.env.LINK_CC = cc
	conf.check_cc(fragment=mpi_test)
	conf.env.revert()

	# MPI variables in global ConfigSet
	conf.env.MPI_CC_NAME='mpicc'
	conf.env.MPI_CC=cc

	# An MPI-Specific ConfigSet
	conf.setenv('mpicc', conf.env)

	# Compiler Options (use mpicc)
	conf.env.CC = cc
	conf.env.LINK_CC = cc
	#conf.env.CFLAGS = '-Wextra'

	# Linker Options (Remove '-Wl,-B[static,dynamic]')
	conf.env.LINKFLAGS_cstlib = []
	conf.env.LINKFLAGS_cxxstlib = []
	conf.env.SHLIB_MARKER = []
	conf.env.STLIB_MARKER = []

	# MT sucks on Intel
	if str(cc).endswith('mpiicc'):
		conf.env.append_unique('CFLAGS', ['-mt_mpi'])
		conf.env.append_unique('LDFLAGS', ['-mt_mpi'])

	# done with MPI-Specific ConfigSet
	conf.setenv('')
Пример #10
0
def _check_default_arch(conf, start_msg, fragment, output_var, compile_filename="test.c", features="c cprogram"):
    env = conf.env

    if not "FILE_BIN" in conf.env:
        file_bin = conf.find_program(["file"], var="FILE_BIN")
    else:
        file_bin = conf.env.FILE_BIN

    conf.start_msg(start_msg)
    ret = conf.check_cc(fragment=fragment, compile_filename=compile_filename, features=features)
    task_gen = conf.test_bld.groups[0][0]
    obj_filename = task_gen.tasks[0].outputs[0].abspath()
    out = conf.cmd_and_log([file_bin, obj_filename])
    m = FILE_MACHO_RE.search(out)
    if m is None:
        conf.fatal("Could not determine arch from output %r" % out)
    else:
        default_arch = m.group(1)
        conf.env[output_var] = default_arch
        conf.end_msg(default_arch)
Пример #11
0
def configure(conf):
    conf.load('compiler_c intltool')

    path, version = get_pkg_path_and_version("pidgin")
    conf.env.PIDGIN_PATH = path
    conf.env.PURPLE_PATH = join(path, "libpurple")
    conf.env.PURPLE_VERSION = version

    if conf.env.PURPLE_SSL:
        # Order matters: It seems like ssl-gnutls has to be loaded before
        # core-ssl to be found (see ssl.c:probe_ssl_plugins)
        conf.env.PURPLE_PLUGINS += ["ssl-" + conf.env.PURPLE_SSL, "ssl"]

        conf.env.append_value("LIB_PURPLE_BUILD", ["gnutls"])

    plugins = conf.env.PURPLE_PLUGINS

    conf.check_cfg(atleast_pkgconfig_version='0.1')
    conf.check_cfg(package='libxml-2.0',
                   uselib_store='XML',
                   args=['--cflags', '--libs'])

    conf.env.append_value("DEFINES_PURPLE_BUILD", ["HAVE_CONFIG_H"])
    conf.env.append_value("INCLUDES_PURPLE_BUILD",
                          ["libpurple_config", conf.env.PURPLE_PATH])
    conf.env.append_value("LIB_PURPLE_BUILD", ["resolv"])

    # We are going to build a shared library
    conf.env.append_value("CFLAGS_PURPLE_BUILD", ["-fPIC"])

    headers = [
        "arpa/nameser_compat", "fcntl", "sys/time", "unistd", "locale",
        "libintl", "signal", "stdint", "regex"
    ]

    for i in headers:
        conf.check_cc(header_name=i + ".h",
                      mandatory=False,
                      auto_add_header_name=True)

    conf.define("PURPLE_PLUGINS", 1)
    conf.define("HAVE_GETIFADDRS", 1)
    conf.define("HAVE_INET_NTOP", 1)
    conf.define("HAVE_INET_ATON", 1)
    conf.define("HAVE_GETADDRINFO", 1)
    conf.define("HAVE_STRUCT_TM_TM_ZONE", 1)
    conf.define("HAVE_TM_GMTOFF", 1)
    conf.define("HAVE_TIMEZONE", 1)
    conf.define("HAVE_TIMGM", 1)
    conf.define("HAVE_STRFTIME_Z_FORMAT", 1)
    conf.define("HAVE_FILENO", 1)
    conf.define("HAVE_STRUCT_SOCKADDR_SA_LEN", 1)
    conf.define("VERSION", conf.env.PURPLE_VERSION)
    conf.define("DISPLAY_VERSION", conf.env.PURPLE_VERSION)
    conf.define("DATADIR", ".")
    conf.define("SYSCONFDIR", ".")
    conf.define("PACKAGE_NAME", "libpurple")
    conf.define("HAVE_SSL", 1)
    conf.define("HAVE_ICONV", 1)
    conf.define("SIZEOF_TIME_T", 4, quote=False)
    conf.define("HAVE_CONFIG_H", 1, quote=False)
    conf.define("HAVE_GNUTLS_PRIORITY_FUNCS", 1)
    conf.define("_GNU_SOURCE", 1, quote=False)

    conf.define("SSL_CERTIFICATES_DIR",
                join(conf.env.APP_PATH, "share", "ca-certs"))
    conf.define("LIBDIR", conf.env.PLUGIN_PATH)

    conf.define("ENABLE_NLS", 1, quote=False)
    conf.define("PACKAGE", "libpurple")
    conf.define("LOCALEDIR", join(conf.env.APP_PATH, "share", "locale"))

    conf.define("STATIC_PROTO_INIT",
                "void static_proto_init() {}",
                quote=False)
    conf.write_config_header('libpurple_config/config.h')

    conf.load('protocols', tooldir=conf.env.TOOLDIR)
Пример #12
0
def configure(conf):
    conf.load('compiler_c intltool')

    path, version = get_pkg_path_and_version("pidgin")
    conf.env.PIDGIN_PATH = path
    conf.env.PURPLE_PATH = join(path, "libpurple")
    conf.env.PURPLE_VERSION = version

    if conf.env.PURPLE_SSL:
        # Order matters: It seems like ssl-gnutls has to be loaded before
        # core-ssl to be found (see ssl.c:probe_ssl_plugins)
        conf.env.PURPLE_PLUGINS += ["ssl-" + conf.env.PURPLE_SSL, "ssl"]

        conf.env.append_value("LIB_PURPLE_BUILD", ["gnutls"])

    plugins = conf.env.PURPLE_PLUGINS

    conf.check_cfg(atleast_pkgconfig_version='0.1')
    conf.check_cfg(package='libxml-2.0', uselib_store='XML',
                   args=['--cflags', '--libs'])

    conf.env.append_value("DEFINES_PURPLE_BUILD", ["HAVE_CONFIG_H"])
    conf.env.append_value("INCLUDES_PURPLE_BUILD", ["libpurple_config",
                                                    conf.env.PURPLE_PATH])
    conf.env.append_value("LIB_PURPLE_BUILD", ["resolv"])

    # We are going to build a shared library
    conf.env.append_value("CFLAGS_PURPLE_BUILD", ["-fPIC"])

    headers = ["arpa/nameser_compat", "fcntl", "sys/time",
               "unistd", "locale", "libintl", "signal", "stdint", "regex"]

    for i in headers:
        conf.check_cc(header_name=i + ".h", mandatory=False,
                      auto_add_header_name=True)

    conf.define("PURPLE_PLUGINS", 1)
    conf.define("HAVE_GETIFADDRS", 1)
    conf.define("HAVE_INET_NTOP", 1)
    conf.define("HAVE_INET_ATON", 1)
    conf.define("HAVE_GETADDRINFO", 1)
    conf.define("HAVE_STRUCT_TM_TM_ZONE", 1)
    conf.define("HAVE_TM_GMTOFF", 1)
    conf.define("HAVE_TIMEZONE", 1)
    conf.define("HAVE_TIMGM", 1)
    conf.define("HAVE_STRFTIME_Z_FORMAT", 1)
    conf.define("HAVE_FILENO", 1)
    conf.define("HAVE_STRUCT_SOCKADDR_SA_LEN", 1)
    conf.define("VERSION", conf.env.PURPLE_VERSION)
    conf.define("DISPLAY_VERSION", conf.env.PURPLE_VERSION)
    conf.define("DATADIR", ".")
    conf.define("SYSCONFDIR", ".")
    conf.define("PACKAGE_NAME", "libpurple")
    conf.define("HAVE_SSL", 1)
    conf.define("HAVE_ICONV", 1)
    conf.define("SIZEOF_TIME_T", 4, quote=False)
    conf.define("HAVE_CONFIG_H", 1, quote=False)
    conf.define("HAVE_GNUTLS_PRIORITY_FUNCS", 1)
    conf.define("_GNU_SOURCE", 1, quote=False)

    conf.define("SSL_CERTIFICATES_DIR",
            join(conf.env.APP_PATH, "share", "ca-certs")
    )
    conf.define("LIBDIR", conf.env.PLUGIN_PATH)

    conf.define("ENABLE_NLS", 1, quote=False)
    conf.define("PACKAGE", "libpurple")
    conf.define("LOCALEDIR",
                join(conf.env.APP_PATH, "share", "locale")
    )

    conf.define("STATIC_PROTO_INIT", "void static_proto_init() {}", quote=False)
    conf.write_config_header('libpurple_config/config.h')

    conf.load('protocols', tooldir=conf.env.TOOLDIR)
Пример #13
0
def configure(conf):
    conf.load('compiler_c')

    path, version = get_path_and_version()
    conf.env.PURPLE_PATH = path
    conf.env.PURPLE_VERSION = version

    if conf.env.PURPLE_SSL:
        # Order matters: It seems like ssl-gnutls has to be loaded before
        # core-ssl to be found (see ssl.c:probe_ssl_plugins)
        conf.env.PURPLE_PLUGINS += ["ssl-" + conf.env.PURPLE_SSL, "ssl"]

        # TODO: conf.define("SSL_CERTIFICATE_DIR")
        conf.env.append_value("LIB_PURPLE_BUILD", ["gnutls"])

    plugins = conf.env.PURPLE_PLUGINS
    protocols = conf.env.PURPLE_PROTOCOLS

    if "jabber" in protocols:
        conf.env.PURPLE_SASL = True
        conf.load('sasl', tooldir='build_lib')
    else:
        conf.env.PURPLE_SASL = False

    conf.check_cfg(atleast_pkgconfig_version='0.1')
    conf.check_cfg(package='libxml-2.0', uselib_store='XML',
                   args=['--cflags', '--libs'])

    conf.env.append_value("DEFINES_PURPLE_BUILD", ["HAVE_CONFIG_H"])
    conf.env.append_value("INCLUDES_PURPLE_BUILD", ["libpurple_config", path])
    conf.env.append_value("LIB_PURPLE_BUILD", ["resolv"])

    # We are going to build a shared library
    conf.env.append_value("CFLAGS_PURPLE_BUILD", ["-fPIC"])

    headers = ["arpa/nameser_compat", "fcntl", "sys/time",
               "unistd", "locale", "signal", "stdint", "regex"]

    for i in headers:
        conf.check_cc(header_name=i + ".h", mandatory=False,
                      auto_add_header_name=True)

    conf.define("PURPLE_STATIC_PRPL", 1)
    conf.define("PURPLE_PLUGINS", 1)
    conf.define("HAVE_GETIFADDRS", 1)
    conf.define("HAVE_INET_NTOP", 1)
    conf.define("HAVE_INET_ATON", 1)
    conf.define("HAVE_GETADDRINFO", 1)
    conf.define("HAVE_STRUCT_TM_TM_ZONE", 1)
    conf.define("HAVE_TM_GMTOFF", 1)
    conf.define("HAVE_TIMEZONE", 1)
    conf.define("HAVE_TIMGM", 1)
    conf.define("HAVE_STRFTIME_Z_FORMAT", 1)
    conf.define("HAVE_FILENO", 1)
    conf.define("HAVE_STRUCT_SOCKADDR_SA_LEN", 1)
    conf.define("VERSION", conf.env.PURPLE_VERSION)
    conf.define("DISPLAY_VERSION", conf.env.PURPLE_VERSION)
    conf.define("DATADIR", ".")
    conf.define("SYSCONFDIR", ".")
    conf.define("PACKAGE_NAME", "libpurple")
    conf.define("HAVE_SSL", 1)
    conf.define("HAVE_ICONV", 1)
    conf.define("LIBDIR", ".")
    conf.define("SIZEOF_TIME_T", 4, quote=False)
    conf.define("HAVE_CONFIG_H", 1, quote=False)
    conf.define("HAVE_CYRUS_SASL", 1, quote=False)
    conf.define("HAVE_GNUTLS_PRIORITY_FUNCS", 1)
    conf.define("_GNU_SOURCE", 1, quote=False)

    proto_extern = "\\\n".join(
                        "extern gboolean purple_init_%s_plugin();" %
                            name.replace('-', '_')
                        for name in chain(plugins, protocols)
                        )

    proto_func = "\\\n".join(
                        "   purple_init_%s_plugin();" % name.replace('-', '_')
                        for name in chain(plugins, protocols)
                        )

    proto_init = """%s\\
void static_proto_init()\\
{\\
%s\\
}""" % (proto_extern, proto_func)

    conf.define("STATIC_PROTO_INIT", proto_init, quote=False)

    conf.write_config_header('libpurple_config/config.h')