(compiler, flag)
Return the flag if a flag name is supported on the
    specified compiler, otherwise None (can be used as a boolean).
    If multiple flags are passed, return the first that matches.
Return the flag if a flag name is supported on the
    specified compiler, otherwise None (can be used as a boolean).
    If multiple flags are passed, return the first that matches.
Return the flag if a flag name is supported on the specified compiler otherwise None ( can be used as a boolean ) . If multiple flags are passed return the first that matches .
def has_flag(compiler, flag):
    """
    Return the flag if a flag name is supported on the
    specified compiler, otherwise None (can be used as a boolean).
    If multiple flags are passed, return the first that matches.
    """

    with tmp_chdir():
        fname = "flagcheck.cpp"
        with open(fname, "w") as f:
            f.write("int main (int argc, char **argv) { return 0; }")

        try:
            compiler.compile([fname], extra_postargs=[flag])
        except distutils.errors.CompileError:
            return False
        return True
def has_flag ( compiler , flag ) : with tmp_chdir ( ) : fname = "flagcheck.cpp" with open ( fname , "w" ) as f : f . write ( "int main (int argc, char **argv) { return 0; }" ) try : compiler . compile ( [ fname ] , extra_postargs = [ flag ] ) except distutils . errors . CompileError : return False return True