--- ../ruby-1.8.7-p160.org/lib/mkmf.rb	2009-03-31 18:37:22.000000000 +0900
+++ ./lib/mkmf.rb	2009-04-17 23:57:04.000000000 +0900
@@ -461,7 +461,7 @@
 
 def try_func(func, libs, headers = nil, &b)
   headers = cpp_include(headers)
-  try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
+  try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
 #{COMMON_HEADERS}
 #{headers}
 /*top*/
@@ -473,6 +473,15 @@
 int main() { return 0; }
 int t() { #{func}(); return 0; }
 SRC
+int #{func}();
+/*top*/
+/*
+ * http://trac.macports.org/ticket/3604
+ * gcc 4.0 on 10.4 has a problem
+ */
+int main() { return 0; }
+int t() { #{func}(); return 0; }
+SRC
 end
 
 def try_var(var, headers = nil, &b)
