I was getting this error as well–with a homebrew install of ImageMagick. Along the same lines as Pascal, I fixed it with
- Install XCode 4.1 (from the App Store)
- In Xcode, go to Xcode > Preferences… > Downloads tab > click Install next to Command Line Tools
- Uninstall ImageMagick with
brew uninstall imagemagick - Update homebrew with
brew update - Install latest homebrew with
brew install imagemagick - Run
brew doctorand delete any of the *.la and *.a files listed if step 4 fails on make install