Hadamard states for a scalar field in anti–de Sitter spacetime with arbitrary boundary conditions