On Mon, 29 Jul 2013 18:04:22 +0200, Petr Salinger wrote:

> the current version fails to build on GNU/kFreeBSD.

Oh :/

> It is due to forcing:
> override_dh_auto_configure:
>        EV_EPOLL=1 dh_auto_configure
> Please drop this override or limit it only for linux architectures.

I've started with limiting to set the variable in debian/rules but
after taking a closer look, the multiarch path problem also affects
other features:

% grep can_ Makefile.PL       
my $can_epoll = -e "/usr/include/sys/epoll.h";
$can_epoll = $ENV{EV_EPOLL} if exists $ENV{EV_EPOLL};
$DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", 
$can_epoll ? "y" : "n") =~ /[yY]/));
my $can_kqueue = -e "/usr/include/sys/event.h";
$can_kqueue = $ENV{EV_KQUEUE} if exists $ENV{EV_KQUEUE};
$DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", 
$can_kqueue ? "y" : "n") =~ /[yY]/));
my $can_inotify = -e "/usr/include/sys/inotify.h";
$can_inotify = $ENV{EV_INOTIFY} if exists $ENV{EV_INOTIFY};
$DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support 
(y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/));
my $can_eventfd = -e "/usr/include/sys/eventfd.h";
$can_eventfd = $ENV{EV_EVENTFD} if exists $ENV{EV_EVENTFD};
$DEFINE .= " -DEV_USE_EVENTFD=" . (0 + (prompt ("Enable linux eventfd support 
(y/n)?", $can_eventfd ? "y" : "n") =~ /[yY]/));
my $can_signalfd = -e "/usr/include/sys/signalfd.h";
$can_signalfd = $ENV{EV_SIGNALFD} if exists $ENV{EV_SIGNALFD};
$DEFINE .= " -DEV_USE_SIGNALFD=" . (0 + (prompt ("Enable linux signalfd support 
(y/n)?", $can_signalfd ? "y" : "n") =~ /[yY]/));

I think we need a more generic solution here …
 
> Or better fix #716928, i.e. by changing
> Makefile.PL:my $can_epoll = -e "/usr/include/sys/epoll.h";
> into testing return value of something like
>   echo "#include <sys/epoll.h>" | gcc -E - >/dev/null

Thanks for this idea! 


I've now played around with 2 patches, one using this approach, the
other using Devel::CheckLib. Both lead to the same result and work
(on linux/amd64).


I'm attaching them for review.

Cheers,
gregor

-- 
 .''`.  Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06
 : :' : Debian GNU/Linux user, admin, and developer  -  http://www.debian.org/
 `. `'  Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe
   `-   NP: Rolling Stones: Melody
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -3,6 +3,7 @@
 use strict qw(vars subs);
 use Config;
 use ExtUtils::MakeMaker;
+use Devel::CheckLib;
 
 unless (-e "libev/ev_epoll.c") {
    print <<EOF;
@@ -129,7 +130,7 @@
 
 EOF
 
-my $can_epoll = -e "/usr/include/sys/epoll.h";
+my $can_epoll = check_lib( header => "sys/epoll.h" );
 $can_epoll = $ENV{EV_EPOLL} if exists $ENV{EV_EPOLL};
 $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", $can_epoll ? "y" : "n") =~ /[yY]/));
 
@@ -157,7 +158,7 @@
 
 EOF
 
-my $can_kqueue = -e "/usr/include/sys/event.h";
+my $can_kqueue = check_lib( header => "sys/event.h" );
 $can_kqueue = $ENV{EV_KQUEUE} if exists $ENV{EV_KQUEUE};
 $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/));
 
@@ -204,7 +205,7 @@
 
 EOF
 
-my $can_inotify = -e "/usr/include/sys/inotify.h";
+my $can_inotify = check_lib( header => "sys/inotify.h" );
 $can_inotify = $ENV{EV_INOTIFY} if exists $ENV{EV_INOTIFY};
 $DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/));
 
@@ -221,7 +222,7 @@
 
 EOF
 
-my $can_eventfd = -e "/usr/include/sys/eventfd.h";
+my $can_eventfd = check_lib( header => "sys/eventfd.h" );
 $can_eventfd = $ENV{EV_EVENTFD} if exists $ENV{EV_EVENTFD};
 $DEFINE .= " -DEV_USE_EVENTFD=" . (0 + (prompt ("Enable linux eventfd support (y/n)?", $can_eventfd ? "y" : "n") =~ /[yY]/));
 
@@ -237,7 +238,7 @@
 
 EOF
 
-my $can_signalfd = -e "/usr/include/sys/signalfd.h";
+my $can_signalfd = check_lib( header => "sys/signalfd.h" );
 $can_signalfd = $ENV{EV_SIGNALFD} if exists $ENV{EV_SIGNALFD};
 $DEFINE .= " -DEV_USE_SIGNALFD=" . (0 + (prompt ("Enable linux signalfd support (y/n)?", $can_signalfd ? "y" : "n") =~ /[yY]/));
 
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -129,7 +129,7 @@
 
 EOF
 
-my $can_epoll = -e "/usr/include/sys/epoll.h";
+my $can_epoll = findheader( "sys/epoll.h" );
 $can_epoll = $ENV{EV_EPOLL} if exists $ENV{EV_EPOLL};
 $DEFINE .= " -DEV_USE_EPOLL=" . (0 + (prompt ("Enable epoll backend (y/n)?", $can_epoll ? "y" : "n") =~ /[yY]/));
 
@@ -157,7 +157,7 @@
 
 EOF
 
-my $can_kqueue = -e "/usr/include/sys/event.h";
+my $can_kqueue = findheader( "sys/event.h" );
 $can_kqueue = $ENV{EV_KQUEUE} if exists $ENV{EV_KQUEUE};
 $DEFINE .= " -DEV_USE_KQUEUE=" . (0 + (prompt ("Enable kqueue backend (y/n)?", $can_kqueue ? "y" : "n") =~ /[yY]/));
 
@@ -204,7 +204,7 @@
 
 EOF
 
-my $can_inotify = -e "/usr/include/sys/inotify.h";
+my $can_inotify = findheader( "sys/inotify.h" );
 $can_inotify = $ENV{EV_INOTIFY} if exists $ENV{EV_INOTIFY};
 $DEFINE .= " -DEV_USE_INOTIFY=" . (0 + (prompt ("Enable inotify support (y/n)?", $can_inotify ? "y" : "n") =~ /[yY]/));
 
@@ -221,7 +221,7 @@
 
 EOF
 
-my $can_eventfd = -e "/usr/include/sys/eventfd.h";
+my $can_eventfd = findheader( "sys/eventfd.h" );
 $can_eventfd = $ENV{EV_EVENTFD} if exists $ENV{EV_EVENTFD};
 $DEFINE .= " -DEV_USE_EVENTFD=" . (0 + (prompt ("Enable linux eventfd support (y/n)?", $can_eventfd ? "y" : "n") =~ /[yY]/));
 
@@ -237,7 +237,7 @@
 
 EOF
 
-my $can_signalfd = -e "/usr/include/sys/signalfd.h";
+my $can_signalfd = findheader( "sys/signalfd.h" );
 $can_signalfd = $ENV{EV_SIGNALFD} if exists $ENV{EV_SIGNALFD};
 $DEFINE .= " -DEV_USE_SIGNALFD=" . (0 + (prompt ("Enable linux signalfd support (y/n)?", $can_signalfd ? "y" : "n") =~ /[yY]/));
 
@@ -304,3 +304,8 @@
 );
 
 
+sub findheader {
+    my $header = shift;
+    my @args = ("/bin/echo '#include <$header>' | gcc -E - >/dev/null 2>&1");
+    return ( system( @args ) == 0 ? 1 : 0);
+}

Attachment: signature.asc
Description: Digital signature

Reply via email to