def libcxx_flag(compiler, libcxx):
    """
    returns flag specific to the target C++ standard library
    """
    if not compiler or not libcxx:
        return ''
    if str(compiler) in ['clang', 'apple-clang']:
        if str(libcxx) in ['libstdc++', 'libstdc++11']:
            return '-stdlib=libstdc++'
        elif str(libcxx) == 'libc++':
            return '-stdlib=libc++'
    elif str(compiler) == 'sun-cc':
        return {'libCstd': '-library=Cstd', 'libstdcxx': '-library=stdcxx4',
            'libstlport': '-library=stlport4', 'libstdc++': '-library=stdcpp'
            }.get(libcxx, '')
    elif str(compiler) == 'qcc':
        return '-Y _%s' % str(libcxx)
    return ''
