Liverpool have announced the signing of defender Dejan Lovren from Southampton on a long-term contract.