lowish quality answer but al-Hakam II was the son of Abd-ar-Rahman III who I can talk a little about. He's the muslim Caliph who the story of Pelagius of Cordoba involves. The German nun Hroswitha wrote down this story second hand from the account of the Christian bishop Recemund who was the Caliph's diplomatic messenger to HRE Otto (there is no hard proof of this that i know of but it's generally assumed)
Al Rahman III is supposed to have been smitten by Pelagius (who really takes an interesting female coded position in this story) tried to kiss him, complications ensued Pelagius punches him in the face, Pelagius miraculously escapes an execution attempt before getting beheaded and later made a saint.
sidenote: it's this story where the wonderful semi-popular history book "Ornament of the World" gets its name though the context of this german Nun gives the title a radically different meaning.
So the "homosexuality" (probably not the right term) of his father enters into European historical understanding in part via a transmission of stories from Al-Andalus to a Nun who gives her own spin on this reflective of her own understanding and needs independent of the facts on the ground (I'll try and find the paper I read about this. I think it's online).
Perhaps this helps you speculate about Al Hakam II if nothing better comes up.