Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: third_party/libevent/configure.in

Issue 1531573008: move libevent into base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix shim path Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libevent/compat/sys/queue.h ('k') | third_party/libevent/devpoll.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 dnl configure.in for libevent
2 dnl Dug Song <dugsong@monkey.org>
3 AC_INIT(event.c)
4
5 AM_INIT_AUTOMAKE(libevent,1.4.15)
6 AM_CONFIG_HEADER(config.h)
7 dnl AM_MAINTAINER_MODE
8
9 AC_CONFIG_MACRO_DIR([m4])
10
11 AC_CANONICAL_HOST
12
13 AC_DEFINE(NUMERIC_VERSION, 0x01040f00, [Numeric representation of the version])
14
15 dnl Initialize prefix.
16 if test "$prefix" = "NONE"; then
17 prefix="/usr/local"
18 fi
19
20 dnl Checks for programs.
21 AC_PROG_CC
22 AC_PROG_INSTALL
23 AC_PROG_LN_S
24
25 AC_PROG_GCC_TRADITIONAL
26 if test "$GCC" = yes ; then
27 CFLAGS="$CFLAGS -Wall"
28 # And disable the strict-aliasing optimization, since it breaks
29 # our sockaddr-handling code in strange ways.
30 CFLAGS="$CFLAGS -fno-strict-aliasing"
31 fi
32
33 dnl Libevent 1.4 isn't multithreaded, but some of its functions are
34 dnl documented to be reentrant. If you don't define the right macros
35 dnl on some platforms, you get non-reentrant versions of the libc
36 dnl functinos (like an errno that's shared by all threads).
37 AC_MSG_CHECKING([whether we need extra flags to make libc reentrant])
38 case $host in
39 *solaris* | *-osf* | *-hpux* )
40 AC_MSG_RESULT([-D_REENTRANT])
41 CFLAGS="$CFLAGS -D_REENTRANT"
42 ;;
43 *-aix* | *-freebsd* | *-darwin* )
44 AC_MSG_RESULT([-D_THREAD_SAFE])
45 CFLAGS="$CFLAGS -D_THREAD_SAFE"
46 ;;
47 *)
48 AC_MSG_RESULT(no)
49 ;;
50 esac
51
52 AC_ARG_ENABLE(gcc-warnings,
53 AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC))
54
55 AC_PROG_LIBTOOL
56
57 dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get
58 dnl built by default. You can also turn shared libs on and off from
59 dnl the command line with --enable-shared and --disable-shared.
60 dnl AC_DISABLE_SHARED
61 AC_SUBST(LIBTOOL_DEPS)
62
63 dnl Checks for libraries.
64 AC_CHECK_LIB(socket, socket)
65 AC_CHECK_LIB(resolv, inet_aton)
66 AC_CHECK_LIB(rt, clock_gettime)
67 AC_CHECK_LIB(nsl, inet_ntoa)
68
69 dnl Checks for header files.
70 AC_HEADER_STDC
71 AC_CHECK_HEADERS(fcntl.h stdarg.h inttypes.h stdint.h poll.h signal.h unistd.h s ys/epoll.h sys/time.h sys/queue.h sys/event.h sys/param.h sys/ioctl.h sys/select .h sys/devpoll.h port.h netinet/in6.h sys/socket.h)
72 if test "x$ac_cv_header_sys_queue_h" = "xyes"; then
73 AC_MSG_CHECKING(for TAILQ_FOREACH in sys/queue.h)
74 AC_EGREP_CPP(yes,
75 [
76 #include <sys/queue.h>
77 #ifdef TAILQ_FOREACH
78 yes
79 #endif
80 ], [AC_MSG_RESULT(yes)
81 AC_DEFINE(HAVE_TAILQFOREACH, 1,
82 [Define if TAILQ_FOREACH is defined in <sys/queue.h>])],
83 AC_MSG_RESULT(no)
84 )
85 fi
86
87 if test "x$ac_cv_header_sys_time_h" = "xyes"; then
88 AC_MSG_CHECKING(for timeradd in sys/time.h)
89 AC_EGREP_CPP(yes,
90 [
91 #include <sys/time.h>
92 #ifdef timeradd
93 yes
94 #endif
95 ], [ AC_DEFINE(HAVE_TIMERADD, 1,
96 [Define if timeradd is defined in <sys/time.h>])
97 AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
98 )
99 fi
100
101 if test "x$ac_cv_header_sys_time_h" = "xyes"; then
102 AC_MSG_CHECKING(for timercmp in sys/time.h)
103 AC_EGREP_CPP(yes,
104 [
105 #include <sys/time.h>
106 #ifdef timercmp
107 yes
108 #endif
109 ], [ AC_DEFINE(HAVE_TIMERCMP, 1,
110 [Define if timercmp is defined in <sys/time.h>])
111 AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
112 )
113 fi
114
115 if test "x$ac_cv_header_sys_time_h" = "xyes"; then
116 AC_MSG_CHECKING(for timerclear in sys/time.h)
117 AC_EGREP_CPP(yes,
118 [
119 #include <sys/time.h>
120 #ifdef timerclear
121 yes
122 #endif
123 ], [ AC_DEFINE(HAVE_TIMERCLEAR, 1,
124 [Define if timerclear is defined in <sys/time.h>])
125 AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
126 )
127 fi
128
129 if test "x$ac_cv_header_sys_time_h" = "xyes"; then
130 AC_MSG_CHECKING(for timerisset in sys/time.h)
131 AC_EGREP_CPP(yes,
132 [
133 #include <sys/time.h>
134 #ifdef timerisset
135 yes
136 #endif
137 ], [ AC_DEFINE(HAVE_TIMERISSET, 1,
138 [Define if timerisset is defined in <sys/time.h>])
139 AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
140 )
141 fi
142
143 dnl - check if the macro WIN32 is defined on this compiler.
144 dnl - (this is how we check for a windows version of GCC)
145 AC_MSG_CHECKING(for WIN32)
146 AC_TRY_COMPILE(,
147 [
148 #ifndef WIN32
149 die horribly
150 #endif
151 ],
152 bwin32=true; AC_MSG_RESULT(yes),
153 bwin32=false; AC_MSG_RESULT(no),
154 )
155
156 AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
157
158 dnl Checks for typedefs, structures, and compiler characteristics.
159 AC_C_CONST
160 AC_C_INLINE
161 AC_HEADER_TIME
162
163 dnl Checks for library functions.
164 AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getadd rinfo getnameinfo strlcpy inet_ntop signal sigaction strtoll issetugid geteuid g etegid)
165
166 AC_CHECK_SIZEOF(long)
167
168 if test "x$ac_cv_func_clock_gettime" = "xyes"; then
169 AC_DEFINE(DNS_USE_CPU_CLOCK_FOR_ID, 1, [Define if clock_gettime is available in libc])
170 else
171 AC_DEFINE(DNS_USE_GETTIMEOFDAY_FOR_ID, 1, [Define is no secure id variant is available])
172 fi
173
174 AC_MSG_CHECKING(for F_SETFD in fcntl.h)
175 AC_EGREP_CPP(yes,
176 [
177 #define _GNU_SOURCE
178 #include <fcntl.h>
179 #ifdef F_SETFD
180 yes
181 #endif
182 ], [ AC_DEFINE(HAVE_SETFD, 1,
183 [Define if F_SETFD is defined in <fcntl.h>])
184 AC_MSG_RESULT(yes) ], AC_MSG_RESULT(no))
185
186 needsignal=no
187 haveselect=no
188 AC_CHECK_FUNCS(select, [haveselect=yes], )
189 if test "x$haveselect" = "xyes" ; then
190 AC_LIBOBJ(select)
191 needsignal=yes
192 fi
193
194 havepoll=no
195 AC_CHECK_FUNCS(poll, [havepoll=yes], )
196 if test "x$havepoll" = "xyes" ; then
197 AC_LIBOBJ(poll)
198 needsignal=yes
199 fi
200
201 haveepoll=no
202 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
203 if test "x$haveepoll" = "xyes" ; then
204 AC_DEFINE(HAVE_EPOLL, 1,
205 [Define if your system supports the epoll system calls])
206 AC_LIBOBJ(epoll)
207 needsignal=yes
208 fi
209
210 havedevpoll=no
211 if test "x$ac_cv_header_sys_devpoll_h" = "xyes"; then
212 AC_DEFINE(HAVE_DEVPOLL, 1,
213 [Define if /dev/poll is available])
214 AC_LIBOBJ(devpoll)
215 fi
216
217 havekqueue=no
218 if test "x$ac_cv_header_sys_event_h" = "xyes"; then
219 AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
220 if test "x$havekqueue" = "xyes" ; then
221 AC_MSG_CHECKING(for working kqueue)
222 AC_TRY_RUN(
223 #include <sys/types.h>
224 #include <sys/time.h>
225 #include <sys/event.h>
226 #include <stdio.h>
227 #include <unistd.h>
228 #include <fcntl.h>
229
230 int
231 main(int argc, char **argv)
232 {
233 int kq;
234 int n;
235 int fd[[2]];
236 struct kevent ev;
237 struct timespec ts;
238 char buf[[8000]];
239
240 if (pipe(fd) == -1)
241 exit(1);
242 if (fcntl(fd[[1]], F_SETFL, O_NONBLOCK) == -1)
243 exit(1);
244
245 while ((n = write(fd[[1]], buf, sizeof(buf))) == sizeof(buf))
246 ;
247
248 if ((kq = kqueue()) == -1)
249 exit(1);
250
251 memset(&ev, 0, sizeof(ev));
252 ev.ident = fd[[1]];
253 ev.filter = EVFILT_WRITE;
254 ev.flags = EV_ADD | EV_ENABLE;
255 n = kevent(kq, &ev, 1, NULL, 0, NULL);
256 if (n == -1)
257 exit(1);
258
259 read(fd[[0]], buf, sizeof(buf));
260
261 ts.tv_sec = 0;
262 ts.tv_nsec = 0;
263 n = kevent(kq, NULL, 0, &ev, 1, &ts);
264 if (n == -1 || n == 0)
265 exit(1);
266
267 exit(0);
268 }, [AC_MSG_RESULT(yes)
269 AC_DEFINE(HAVE_WORKING_KQUEUE, 1,
270 [Define if kqueue works correctly with pipes])
271 AC_LIBOBJ(kqueue)], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
272 fi
273 fi
274
275 haveepollsyscall=no
276 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
277 if test "x$haveepoll" = "xno" ; then
278 AC_MSG_CHECKING(for epoll system call)
279 AC_TRY_RUN(
280 #include <stdint.h>
281 #include <sys/param.h>
282 #include <sys/types.h>
283 #include <sys/syscall.h>
284 #include <sys/epoll.h>
285 #include <unistd.h>
286
287 int
288 epoll_create(int size)
289 {
290 return (syscall(__NR_epoll_create, size));
291 }
292
293 int
294 main(int argc, char **argv)
295 {
296 int epfd;
297
298 epfd = epoll_create(256);
299 exit (epfd == -1 ? 1 : 0);
300 }, [AC_MSG_RESULT(yes)
301 AC_DEFINE(HAVE_EPOLL, 1,
302 [Define if your system supports the epoll system calls])
303 needsignal=yes
304 AC_LIBOBJ(epoll_sub)
305 AC_LIBOBJ(epoll)], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
306 fi
307 fi
308
309 haveeventports=no
310 AC_CHECK_FUNCS(port_create, [haveeventports=yes], )
311 if test "x$haveeventports" = "xyes" ; then
312 AC_DEFINE(HAVE_EVENT_PORTS, 1,
313 [Define if your system supports event ports])
314 AC_LIBOBJ(evport)
315 needsignal=yes
316 fi
317 if test "x$bwin32" = "xtrue"; then
318 needsignal=yes
319 fi
320 if test "x$bwin32" = "xtrue"; then
321 needsignal=yes
322 fi
323 if test "x$needsignal" = "xyes" ; then
324 AC_LIBOBJ(signal)
325 fi
326
327 AC_TYPE_PID_T
328 AC_TYPE_SIZE_T
329 AC_CHECK_TYPES([uint64_t, uint32_t, uint16_t, uint8_t], , ,
330 [#ifdef HAVE_STDINT_H
331 #include <stdint.h>
332 #elif defined(HAVE_INTTYPES_H)
333 #include <inttypes.h>
334 #endif
335 #ifdef HAVE_SYS_TYPES_H
336 #include <sys/types.h>
337 #endif])
338 AC_CHECK_TYPES([fd_mask], , ,
339 [#ifdef HAVE_SYS_TYPES_H
340 #include <sys/types.h>
341 #endif
342 #ifdef HAVE_SELECT_H
343 #include <select.h>
344 #endif])
345
346 AC_CHECK_SIZEOF(long long)
347 AC_CHECK_SIZEOF(int)
348 AC_CHECK_SIZEOF(short)
349 AC_CHECK_TYPES([struct in6_addr], , ,
350 [#ifdef WIN32
351 #include <winsock2.h>
352 #else
353 #include <sys/types.h>
354 #include <netinet/in.h>
355 #include <sys/socket.h>
356 #endif
357 #ifdef HAVE_NETINET_IN6_H
358 #include <netinet/in6.h>
359 #endif])
360
361 AC_MSG_CHECKING([for socklen_t])
362 AC_TRY_COMPILE([
363 #include <sys/types.h>
364 #include <sys/socket.h>],
365 [socklen_t x;],
366 AC_MSG_RESULT([yes]),
367 [AC_MSG_RESULT([no])
368 AC_DEFINE(socklen_t, unsigned int,
369 [Define to unsigned int if you dont have it])]
370 )
371
372 AC_MSG_CHECKING([whether our compiler supports __func__])
373 AC_TRY_COMPILE([],
374 [ const char *cp = __func__; ],
375 AC_MSG_RESULT([yes]),
376 AC_MSG_RESULT([no])
377 AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
378 AC_TRY_COMPILE([],
379 [ const char *cp = __FUNCTION__; ],
380 AC_MSG_RESULT([yes])
381 AC_DEFINE(__func__, __FUNCTION__,
382 [Define to appropriate substitue if compiler doesnt have __func__]),
383 AC_MSG_RESULT([no])
384 AC_DEFINE(__func__, __FILE__,
385 [Define to appropriate substitue if compiler doesnt have __func__])))
386
387
388 # Add some more warnings which we use in development but not in the
389 # released versions. (Some relevant gcc versions can't handle these.)
390 if test x$enable_gcc_warnings = xyes; then
391
392 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
393 #if !defined(__GNUC__) || (__GNUC__ < 4)
394 #error
395 #endif]), have_gcc4=yes, have_gcc4=no)
396
397 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
398 #if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2 )
399 #error
400 #endif]), have_gcc42=yes, have_gcc42=no)
401
402 CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes - Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcommen t -Wformat=2 -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-e xterns -Wbad-function-cast -Wswitch-enum -Werror"
403 CFLAGS="$CFLAGS -Wno-unused-parameter -Wno-sign-compare -Wstrict-aliasing"
404
405 if test x$have_gcc4 = xyes ; then
406 # These warnings break gcc 3.3.5 and work on gcc 4.0.2
407 CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after -statement"
408 #CFLAGS="$CFLAGS -Wold-style-definition"
409 fi
410
411 if test x$have_gcc42 = xyes ; then
412 # These warnings break gcc 4.0.2 and work on gcc 4.2
413 CFLAGS="$CFLAGS -Waddress -Wnormalized=id -Woverride-init"
414 fi
415
416 ##This will break the world on some 64-bit architectures
417 # CFLAGS="$CFLAGS -Winline"
418
419 fi
420
421 AC_OUTPUT(Makefile test/Makefile sample/Makefile)
OLDNEW
« no previous file with comments | « third_party/libevent/compat/sys/queue.h ('k') | third_party/libevent/devpoll.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698