예제 #1
0
def pkg_check_modules(conf,uselib_name,expression,mandatory=True):
	pkg_config=conf.env['PKG_CONFIG']
	if not pkg_config:
		if mandatory:
			conf.fatal("pkg-config is not available")
		else:
			return False
	argv=[pkg_config,'--cflags','--libs',expression]
	cmd=subprocess.Popen(argv,stdout=subprocess.PIPE)
	out,dummy=cmd.communicate()
	retval=cmd.wait()
	msg_checking=("pkg-config flags for %s"%(uselib_name,))
	if Options.options.verbose:
		if retval==0:
			conf.check_message_custom(msg_checking,('(%s)'%expression),out)
		else:
			conf.check_message(msg_checking,('(%s)'%expression),False)
	else:
		conf.check_message(msg_checking,'',(retval==0),'')
	conf.log.write('%r: %r (exit code %i)\n'%(argv,out,retval))
	if retval==0:
		config_c.parse_flags(out,uselib_name,conf.env)
		conf.env[uselib_name]=True
		return True
	else:
		conf.env[uselib_name]=False
		if mandatory:
			raise Configure.ConfigurationError('pkg-config check failed')
		else:
			return False
예제 #2
0
def detect(conf):
	try:test_for_compiler=Options.options.check_cxx_compiler
	except AttributeError:raise Configure.ConfigurationError("Add set_options(opt): opt.tool_options('compiler_cxx')")
	for compiler in test_for_compiler.split():
		try:
			conf.check_tool(compiler)
		except Configure.ConfigurationError,e:
			debug('compiler_cxx: %r'%e)
		else:
			if conf.env['CXX']:
				conf.check_message(compiler,'',True)
				conf.env['COMPILER_CXX']=compiler
				break
			conf.check_message(compiler,'',False)
			break
예제 #3
0
def pkg_check_module_variable(conf,module,variable):
	pkg_config=conf.env['PKG_CONFIG']
	if not pkg_config:
		conf.fatal("pkg-config is not available")
	argv=[pkg_config,'--variable',variable,module]
	cmd=subprocess.Popen(argv,stdout=subprocess.PIPE)
	out,dummy=cmd.communicate()
	retval=cmd.wait()
	out=out.rstrip()
	msg_checking=("pkg-config variable %r in %s"%(variable,module,))
	conf.check_message_custom(msg_checking,'',out)
	conf.log.write('%r: %r (exit code %i)\n'%(argv,out,retval))
	if retval==0:
		return out
	else:
		raise Configure.ConfigurationError('pkg-config check failed')
예제 #4
0
def pkg_check_modules(conf, uselib_name, expression, mandatory=True):
    pkg_config = conf.env['PKG_CONFIG']
    if not pkg_config:
        if mandatory:
            conf.fatal("pkg-config is not available")
        else:
            return False

    if Options.options.verbose:
        extra_msg = ' (%s)' % expression
    else:
        extra_msg = ''

    conf.start_msg('Checking for pkg-config flags for %s%s' %
                   (uselib_name, extra_msg))

    argv = [pkg_config, '--cflags', '--libs', expression]
    cmd = subprocess.Popen(argv,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.PIPE)
    out, err = cmd.communicate()
    retval = cmd.wait()

    conf.to_log('%r: %r (exit code %i)\n%s' % (argv, out, retval, err))

    if retval != 0:
        conf.end_msg(False)
        sys.stderr.write(err)
    else:
        if Options.options.verbose:
            conf.end_msg(out)
        else:
            conf.end_msg(True)

    if retval == 0:
        conf.parse_flags(out, uselib_name, conf.env)
        conf.env[uselib_name] = True
        return True

    else:

        conf.env[uselib_name] = False
        if mandatory:
            raise Configure.ConfigurationError('pkg-config check failed')
        else:
            return False
예제 #5
0
def detect(conf):
    try:
        test_for_compiler = Options.options.check_fortran_compiler
    except AttributeError:
        raise Configure.ConfigurationError(
            "Add set_options(opt): opt.tool_options('compiler_fortran')")
    for compiler in test_for_compiler.split():
        try:
            conf.check_tool(compiler)
        except Configure.ConfigurationError:
            pass
        else:
            if conf.env['FC']:
                conf.check_message("%s" % compiler, '', True)
                conf.env["COMPILER_FC"] = "%s" % compiler
                return
            conf.check_message("%s" % fortran_compiler, '', False)
            break
    conf.env["COMPILER_FC"] = None
예제 #6
0
def detect(conf):
    try:
        test_for_compiler = Options.options.check_cxx_compiler
    except AttributeError:
        raise Configure.ConfigurationError(
            "Add set_options(opt): opt.tool_options('compiler_cxx')")
    orig = conf.env
    for compiler in test_for_compiler.split():
        try:
            conf.env = orig.copy()
            conf.check_tool(compiler)
        except Configure.ConfigurationError as e:
            debug('compiler_cxx: %r' % e)
        else:
            if conf.env['CXX']:
                orig.table = conf.env.get_merged_dict()
                conf.env = orig
                conf.check_message(compiler, '', True)
                conf.env['COMPILER_CXX'] = compiler
                break
            conf.check_message(compiler, '', False)
            break
    else:
        conf.fatal('could not configure a cxx compiler!')