1 |
use 5.006; |
2 |
|
3 |
use Config; |
4 |
use ExtUtils::MakeMaker; |
5 |
|
6 |
|
7 |
unless (-e "libev/ev_epoll.c") { |
8 |
print <<EOF; |
9 |
|
10 |
*** |
11 |
*** ERROR: libev is missing or damaged. If you used a CVS check-out of EV, |
12 |
*** you also have to check-out the "libev" module from the same CVS |
13 |
*** repository into the EV dir (i.e. EV/libev from outside). |
14 |
*** |
15 |
|
16 |
EOF |
17 |
exit 1; |
18 |
} |
19 |
|
20 |
print <<EOF; |
21 |
|
22 |
|
23 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
24 |
|
25 |
Welcome to EV configuration. If you are in a hurry, just press return here |
26 |
and hope for the best. The defaults should usually do. |
27 |
|
28 |
EOF |
29 |
|
30 |
if (prompt ("Skip further questions and use defaults (y/n)?", "y") =~ /[yY]/) { |
31 |
$ENV{PERL_MM_USE_DEFAULT} = 1; |
32 |
} |
33 |
|
34 |
print <<EOF; |
35 |
|
36 |
|
37 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
38 |
|
39 |
POSIX optionally offers support for a monotonic clock source. EV can |
40 |
take advantage of this clock source to detect time jumps reliably. This |
41 |
will usually slow down EV a tiny amount, but this is usually |
42 |
well-invested. Unfortunately, some systems are bound to be broken, so |
43 |
you can disable this here. Whatever your reasons, you can completely |
44 |
disable the detection and use of this monotonic clock by answering 'n' |
45 |
here. Support for this clock type will otherwise be autodetected at both |
46 |
compile- and runtime. |
47 |
|
48 |
EOF |
49 |
|
50 |
if (prompt ("Enable optional support for CLOCK_MONOTONIC (y/n)?", "y") =~ /[yY]/) { |
51 |
$DEFINE .= " -DEV_USE_MONOTONIC"; |
52 |
} |
53 |
|
54 |
print <<EOF; |
55 |
|
56 |
|
57 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
58 |
|
59 |
POSIX optionally offers support for a (potentially) high-resolution |
60 |
realtime clock interface. In a good implementation, using it is faster |
61 |
than the normal method of using gettimeofday. Unfortunately, this option |
62 |
is also bound to be broken on some systems, so you can disable use and |
63 |
probing of this feature altogether here. Otherwise support for this clock |
64 |
type will be autodetected at compiletime. |
65 |
|
66 |
EOF |
67 |
|
68 |
if (prompt ("Prefer clock_gettime (CLOCK_REALTIME) over gettimeofday (y/n)?", "y") !~ /[yY]/) { |
69 |
$DEFINE .= " -DEV_USE_REALTIME=0"; |
70 |
} |
71 |
|
72 |
print <<EOF; |
73 |
|
74 |
|
75 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
76 |
|
77 |
EV needs the functions pthread_atfork and clock_gettime. On most systems |
78 |
you need some special libraries for this (such as -lrt and -lpthread). You can |
79 |
specify additional libraries to provide these calls now, or accept the default. |
80 |
|
81 |
EOF |
82 |
|
83 |
$LIBS = prompt "Extra libraries for pthread_atfork and clock_gettime?", "-lpthread -lrt"; |
84 |
|
85 |
|
86 |
print <<EOF; |
87 |
|
88 |
|
89 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
90 |
|
91 |
EV needs the functions pthread_atfork and clock_gettime. On most systems |
92 |
you need some special libraries for this (such as -lrt and -lpthread). You can |
93 |
specify additional libraries to provide these calls now, or accept the default. |
94 |
|
95 |
EOF |
96 |
|
97 |
if (prompt ("Enable epoll backend (y/n)?", (-e "/usr/include/sys/epoll.h") ? "y" : "n") =~ /[yY]/) { |
98 |
$DEFINE .= " -DEV_USE_EPOLL"; |
99 |
} |
100 |
|
101 |
print <<EOF; |
102 |
|
103 |
|
104 |
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** |
105 |
|
106 |
EOF |
107 |
|
108 |
#$ENV{CC} = $Config{cc}; |
109 |
#$ENV{CFLAGS} = join " ", map $Config{$_}, qw(inc optimize ccflags cccdlflags); |
110 |
#system "cd libevent && ./configure --disable-shared --enable-static --disable-maintainer-mode" |
111 |
# and die "configure failed."; |
112 |
|
113 |
#$LIBS = qx<cd libevent && make printlibs>; |
114 |
|
115 |
WriteMakefile( |
116 |
dist => { |
117 |
PREOP => 'pod2text EV.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;', |
118 |
COMPRESS => 'gzip -9v', |
119 |
SUFFIX => '.gz', |
120 |
}, |
121 |
depend => { |
122 |
"EV.c" => "EV/EVAPI.h libev/ev.c libev/ev.h libev/ev_epoll.c libev/ev_select.c", |
123 |
}, |
124 |
INC => "-Ilibev", |
125 |
DEFINE => "$DEFINE", |
126 |
NAME => "EV", |
127 |
LIBS => [$LIBS], |
128 |
VERSION_FROM => "EV.pm", |
129 |
PM => { |
130 |
'EV.pm' => '$(INST_LIBDIR)/EV.pm', |
131 |
'EV/AnyEvent.pm' => '$(INST_LIBDIR)/EV/AnyEvent.pm', |
132 |
#'EV/DNS.pm' => '$(INST_LIBDIR)/EV/DNS.pm', |
133 |
'EV/EVAPI.h' => '$(INST_LIBDIR)/EV/EVAPI.h', |
134 |
'EV/MakeMaker.pm' => '$(INST_LIBDIR)/EV/MakeMaker.pm', |
135 |
'libev/ev.h' => '$(INST_LIBDIR)/EV/ev.h', |
136 |
}, |
137 |
); |
138 |
|
139 |
|