1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#!/usr/bin/env ruby
require "mkmf"
def have_libwrap
lib = "wrap"
func = "main"
printf "checking for %s() in -l%s... ", func, lib
STDOUT.flush
if func && func != ""
libs = append_library($libs, lib)
if /mswin32|mingw/ =~ RUBY_PLATFORM
r = try_link(<<"SRC", libs)
#include <windows.h>
#include <winsock.h>
int allow_severity = 0;
int deny_severity = 0;
int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
unless r
r = try_link(<<"SRC", libs)
#include <windows.h>
#include <winsock.h>
int allow_severity = 0;
int deny_severity = 0;
int main() { return 0; }
int t() { void ((*p)()); p = (void ((*)()))#{func}; return 0; }
SRC
end
else
r = try_link(<<"SRC", libs)
int allow_severity = 0;
int deny_severity = 0;
int main() { return 0; }
int t() { #{func}(); return 0; }
SRC
end
unless r
print "no\n"
return false
end
else
libs = append_library($libs, lib)
end
$libs = libs
print "yes\n"
return true
end
dir_config("wrap")
dir_config("ident")
if have_header("ident.h") and
have_library("ident", "ident_id")
have_func("ident_id")
end
if have_header("tcpd.h") and
have_libwrap
create_makefile("tcpwrap")
end
|