diff --git a/ext/extconf.rb b/ext/extconf.rb
index <HASH>..<HASH> 100644
--- a/ext/extconf.rb
+++ b/ext/extconf.rb
@@ -4,7 +4,16 @@ require "mkmf"
 
 File::unlink("Makefile") if (File::exist?("Makefile"))
 
-%w{7.29 7.28 7.27 7.26 7.24 7.23 7.22 7.20}.each{|x| break if pkg_config("vips-#{x}")}
+found = false
+%w{7.29 7.28 7.27 7.26 7.24 7.23 7.22 7.20}.each do |x| 
+    if pkg_config("vips-#{x}")
+        found = true
+        break
+    end
+end
 
-have_header('vips/vips.h')
-create_makefile('vips_ext')
+if not found
+    puts "no compatible libvips found, check your pkg-config settings"
+else
+    create_makefile('vips_ext')
+end
fail sooner if no vips found

Thanks Pierre