Recently had a long conversation with a fellow quarantee and friend (who is a devout Catholic) about philosophy of science and the history of Darwinism. He pointed me to a few relevant encyclicals, in particular Humani Generis .
However, this didn't really answer my interest in how the Catholic Church got to Humani Generis in the first place; the behind-the-scenes theological wrangling is still mostly a mystery to me.
First, its important to recognize that the Catholic Church has generally, but especially since the whole Galileo fiasco, responded to new developments slowly. It usually prefers to allow issues to be debated for decades, sometimes centuries before the Pope chimes in. The Papacy waited a hundred years before saying something about evolution, by which time much more was known about the theory and its mechanisms.
Second, unlike Evangelical Protestants, the Catholic Church has always been comfortable with interpreting parts of the bible non-literally. Some early Christian theologians such as Origen suggested an allegorical interpretation of creation in Genesis. So when the theory of evolution comes along and conflicts with a literal interpretation of Genesis, many in the Catholic Church did not see this as a direct threat to their theology in the way many protestants do.
Third, by the early modern period at least, large parts of the Catholic Church (especially Jesuits) were friendly to scientific research, and many priests and members of religious orders were deeply involved in science. many Catholic scientists were active in making contributions to biology and the theory of evolution. Lamarck himself was Jesuit-educated. Mendel was a Catholic monk who was involved at a Catholic Monastery that was deeply involved in biological research. Also, Catholic scientist-priests were involved in advances in geological dating, which produced findings that backed up the theory of evolution. This meant that right from the beginning the Catholic Church had within it a strong cadre of pro-evolution supporters, including well-regarded scientists.
This is not to say that there was not opposition at first to evolution by Catholics. Alongside the non-literal interpretive tradition in Catholicism, there have also always been Catholics who interpreted Genesis more literally. G.K. Chesterton, an early 20th century Catholic author and apologist whose writings are still very popular today, was known for frequently criticizing Darwinism generally, but especially Darwinism as a social phenomenon and as a way to understand human nature. And even Chesterton admitted that Evolution could potentially be true in a scientific sense. Chesterton's concern about Evolution as an explanation for the soul and for human nature and the structuring of human society has remained in the Church to this day. However, by the time Humani Generis came out, and stated there was nothing contrary to Church doctrine in believing in evolution, opposition within the Church to the theory of Evolution was probably a minority position. By the 1990s, the pro-evolution position had become strong enough that Pope John Paul II actually spoke of Evolution as being more than a theory. Opposition to evolution continues in the Catholic Church, but it is a fringe position rarely heard outside of very traditional Catholic communities. The Church does not forbid belief in evolution, but it does not require belief in evolution either.
To sum up, the Catholic Church has always been open to interpreting creation stories in the bible non-literally, so it was not as threatened by the rise of evolution as were Evangelical Protestants. It also had within its ranks of clergy and religious orders a strong presence of scientists and pro-science types, some of whom worked closely on biological and geological sciences that supported evolution. The literalists within the Church did put up some initial resistance, but as time went on and the science in favour of evolution became stronger, their position became increasingly marginalized. The Church, as usual, took several decades to carefully observe how the situation developed, and by the middle of the 20th century, when Rome finally spoke on the topic, a consensus emerged that evolution at least did not threaten the Church's teachings.
Sources:
Artigas, Mariano et al, Negotiating Darwin: The Vatican Confronts Evolution, 1877–1902 (JHU Press, 2006)
Brundell, Barry, "Catholic Church Politics and Evolution Theory, 1894-1902" The British Journal for the History of Science, 34:1 (March 2001) Cambridge University Press on behalf of The British Society for the History of Science
O'Leary, John, Roman Catholicism and Modern Science: A history (Continuum International Publishing Group, 2006)