-print "yes\n" if $config{HAS_STRLCPY} eq "true";
-print "no\n" if $config{HAS_STRLCPY} eq "false";
-
-printf "Checking if kqueue exists... ";
-$has_kqueue = 0;
-$fail = 0;
-open(KQUEUE, "</usr/include/sys/event.h") or $fail = 1;
-if (!$fail) {
- while (defined(my $line = <KQUEUE>)) {
- chomp($line);
- # try and find the delcaration of:
- # int kqueue(void);
- if ($line =~ /int(\0x9|\s)+kqueue/) {
- $has_kqueue = 1;
- }
- }
- close(KQUEUE);
+
+printf "Checking whether eventfd() exists... ";
+if (test_file($config{CC}, "eventfd.cpp")) {
+ $config{HAS_EVENTFD} = "true";
+ print "yes\n";
+} else {
+ $config{HAS_EVENTFD} = "false";
+ print "no\n";
+}
+
+printf "Checking if a TCP deferring mechanism is available... ";
+if (test_file($config{CC}, "tcp_defer_accept.cpp")) {
+ $config{HAS_DEFER} = "TCP_DEFER_ACCEPT";
+ print "yes (TCP_DEFER_ACCEPT)\n";
+} elsif (test_file($config{CC}, "so_acceptfilter.cpp")) {
+ $config{HAS_DEFER} = "SO_ACCEPTFILTER";
+ print "yes (SO_ACCEPTFILTER)\n";
+} else {
+ $config{HAS_DEFER} = "false";
+ print "no\n";