A first-order primal-dual algorithm with linesearch