D'Emilio is pretty clear that the Gay Identity is essentially a product of capitalism, which creates the cosmopolitan life (Capitalism and the Gay Identity c.1980).
In his History of Sexuality Foucault (raiding Ken Dover's Greek Homosexuality) showed that man-boy love in ancient societies was less comparable to modern homosexuality than might at first appear. Plummer's basic point, made more disparagingly by Engels, was that Greek men citizens could not satisfy themselves romantically with their wives, because they could not see them as equals.
I think the developed point derived from both is that men might have engaged in same sex relations before, but that the practice of an exclusively gay identity, as we know it, is a product of modern capitalist societies, only really possible with the separation of economic life from the home.
(One useful source, and a trailblazer on the historical specificity of romantic life is the children's author, catholic essayist and academic CS Lewis, who, as well as the Lion the Witch and the Wardrobe, wrote the excellent account of 'Courtly Love'. Lewis' point was that romance has an origin and a history, and that it began in the late Middle Ages, in a wholly adulterous setting, with the stylised cuckolding of 'champions' and their 'ladies'. Lewis points out that romance could never establish itself *within* marriage because of sexual inequality, emerging only at the margins, in adultery, and in the songs of travelling minstrels - part of that transient margin of the largely familial society.)
So for example, while British law punishes sodomy for centuries, this was a catch-all for any and all deviant sexual practices, not exclusive to men. It is not until the Labouchere amendment in late Victorian England that homosexuality is specifically outlawed. -- James Heartfield