def patch_f90_compiler(f90_compiler):
    """Patch up ``f90_compiler.library_dirs``.

    On macOS, a Homebrew installed ``gfortran`` needs some help. The
    ``numpy.distutils`` "default" constructor for ``Gnu95FCompiler`` only has
    a single library search path, but there are many library paths included in
    the full ``gcc`` install.

    Args:
        f90_compiler (numpy.distutils.fcompiler.FCompiler): A Fortran compiler
            instance.
    """
    if not is_macos_gfortran(f90_compiler):
        return

    library_dirs = f90_compiler.library_dirs
    # ``library_dirs`` is a list (i.e. mutable), so we can update in place.
    library_dirs[:] = setup_helpers.gfortran_search_path(library_dirs)