summaryrefslogtreecommitdiff
path: root/lib/mkmf.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-22 08:29:58 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-06-22 08:29:58 +0000
commit44cf56d6e70dbe06a160b004494ba40dd4cfb426 (patch)
tree10e665c60414c3070ce957e5c534e30ed499bc2d /lib/mkmf.rb
parent4b4cad81e7d2bdc4750ea5043ce44bf37adb3997 (diff)
2000-06-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/mkmf.rb')
-rw-r--r--lib/mkmf.rb30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/mkmf.rb b/lib/mkmf.rb
index 1ee1d68..d14f9bd 100644
--- a/lib/mkmf.rb
+++ b/lib/mkmf.rb
@@ -210,32 +210,34 @@ SRC
return true
end
-def have_func(func)
+def have_func(func, header=nil)
printf "checking for %s()... ", func
STDOUT.flush
libs = $libs
-
- if /mswin32|mingw/ =~ RUBY_PLATFORM
- r = try_link(<<"SRC", libs)
+ src =
+ if /mswin32|mingw/ =~ RUBY_PLATFORM
+ r = <<"SRC"
#include <windows.h>
#include <winsock.h>
+SRC
+ else
+ ""
+ end
+ unless header.nil?
+ src << <<"SRC"
+#include <#{header}>
+SRC
+ end
+ r = try_link(src + <<"SRC", libs)
int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
- unless r
- r = try_link(<<"SRC", libs)
-#include <windows.h>
-#include <winsock.h>
+ unless r
+ r = try_link(src + <<"SRC", libs)
int main() { return 0; }
int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }
SRC
- end
- else
- r = try_link(<<"SRC", libs)
-int main() { return 0; }
-int t() { #{func}(); return 0; }
-SRC
end
unless r
print "no\n"