CHDK has a a Depth Of Field (DOF) display you can activate from the CHDK option in the main <alt> menu. Of particular interest is the "Hyperfocal Distance", which is the nearest you can focus while keeping infinity in focus. With my camera zoomed out, it's about 1 meter. See if you can activate the DOF display and try the following:
You may need to put your camera in manual focus mode for this to work. Then press the <alt> button to go into <alt> mode. Now press <down>. The camera should focus at the hyperfocal distance. If your subject is further away than this distance, then both your subject and the background will be in focus.
The concept of hyperfocal distance is very interesting. For example when you get a pair of glasses, they always set them to focus at infinity. If you want to see closer, the lens of the eye has to be able to change shape enough to focus closer. But the lens hardens with age and can't change shape. The solution is bi-focals or "progressive" lenses which focus closer as you look down.
But you can also set the focus of your glasses a little closer than infinity. I found that setting them at 1/4 diopter closer allowed me to see the dashboard clearly while driving, and still see the road(infinity) quite well. I wonder why optometrists haven't discovered this.