Here is Naunihal Singh, writing at Monkey Cage a few years ago:
More fundamentally problematic, however, is the assumption that popular opinion has an impact on coups. Although this claim is common in political science, there is no evidence to support it. Over the course of writing my book, “Seizing Power: The Strategic Logic of Military Coups,” I spent 300 hours talking with participants in 10 coup attempts in Ghana and statistically analyzed the determinants of every coup attempt and outcome in the world from 1950 to 2000. Based on this evidence, I argue that there is no reason to believe that military factions hesitate to attempt coups when popular opinion is against them, or that coup attempts are more likely to fail when the populace is opposed.
Over the course of this research, I observed that conspirators devoted very little consideration during coup plotting to the question of how the population would react. Coup makers are largely convinced that their cause is just (even when the coup comes from a partisan or personal interest), and that they will have widespread popular support for their actions, with perhaps limited opposition coming from entrenched special interests.
…there is no relationship between economic growth rates and the likelihood of a coup. Similarly, there is no relationship between regime type and coup attempts. Even though democracies are presumed to have higher levels of legitimacy than other kinds of political regimes, they were no more or less likely to experience coup attempts. Lastly, coup attempts were actually more likely to occur during presidential election years, which suggests that conspirators were acting to thwart the popular will rather than being constrained by it.
…The bottom line is that the dynamics of a coup attempt are almost entirely internal to the military.
Read the whole thing. Nam Kyu Kim dissents from some of those propositions. Note that since early 2015, Turkish growth rates have been in the four to six percent range, hardly miserable.