A Square and a Circle

For a specific problem: Given an arbitrary point P on a line segment AB, let AP form the perimeter of a square and PB form the circumference of a circle. Find P such that the area of the square and circle are equal.