André Gide's The Immoralist is a quasi-autobiographical novel describing the life of the narrator Michel, and his evolution from an asexual participant in an arranged marriage through a libertine into a confirmed homosexual. Although Gide himself was gay, and shared his protagonist's interest in young Arabic boys, the novel itself could equally well be read as a defense or a condemnation of homosexuality as it existed in specific parts of French society at the end of the nineteenth century.
What makes the novel paradoxical is that the narrator celebrates his transformation from a traditional married man, who cares responsibly for his wife and has a respected academic position, to a free spirit who indulges in sensual pleasures with little regard to anything but his own momentary pleasure. Although the narrator attempts to defend his choices philosophically, the narrative arc shows Marcel's discovering and acting up his sexuality as part of a descent into behaving badly towards his wife, indulging in pedophilia, and generally turning from a productive and useful member of society into a rather irresponsible and immoral person.
One could argue that from our perspective, this shows that the social exclusion of gay people from mainstream society in the nineteenth century ("sodomy" was illegal in this period) forced gays to live in an underworld, and thus the transformation of Marcel was in part due to the lack of social support for a gay lifestyle. In twenty-first century Europe, Marcel would have become aware of his sexual preferences earlier in life and had more positive gay role models.