Authorities have linked Mr. Roof to a racist Internet manifesto and said he was in contact with white supremacist groups before his attack on the well-known Emanuel A.M.E. Church, which has hosted many major civil rights leaders, including the Rev. Dr. Martin Luther King Jr.