Building SDL_image to use libpng 1.5.14

I’m trying to setup a new ubuntu 12.04 lts pc. I’ve downloaded and built libpng 1.5.14 (the latest version). It’s located at /usr/local/lib/ which is in the path. I got the latest SDL_image about a 2 weeks ago and built it. When I run the included test program showimage it fails with “Failed loading png_set_longjump_fn: /lib/x64_64-linux-gnu/ undefined symbol: _png_set_longjump_fn”. I understand that showimage is picking up libpng12 (which comes with ubuntu) and that libpng12 doesn’t have the missing function. What I don’t know is how do I build SDL_image so that it, and showimage, correctly load libpng15 instead?

This is not a path problem because I renamed libpng12 and showimage complained that libpng12 was not found rather than looking for libpng15 instead.

I have tried the “sh ./configure CPPFLAGS=”-I/usr/local/include" LDFLAGS="-L/usr/local/lib" strategy suggested in the README file but showimage still wants to use libpng12.

The answer must be simple. Help please.