Pfizer Inc. said Monday it would buy Anacor Pharmaceuticals Inc. in an all-cash deal worth about $4.5 billion, as it turns to smaller deals after walking away from its scuttled acquisition of Allergan PLC. Pfizer will acquire drugmaker Anacor for $99.25 a share, a 55% premium to Friday’s closing price. The companies said the deal, including debt, is valued at $5.2 billion.