Security software company Avast Software said it would buy Dutch rival AVG Technologies for $1.3 billion in cash to expand its presence in the emerging markets.