/[svn]/branches/newio/configure.ac
ViewVC logotype

Contents of /branches/newio/configure.ac

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2383 - (show annotations)
Sat Jul 6 17:05:28 2013 UTC (9 years, 2 months ago) by michael
File size: 10978 byte(s)
- Add new configure test for epoll(), poll(), kqueue() and /dev/poll. This
  mixture basically stolen from libevent and ircu

1 # Inspired by work Copyright (C) 2006 Luca Filipozzi
2 # vim: set fdm=marker ts=2 sw=2 et:
3
4 AC_REVISION([$Id$])
5
6 AC_PREREQ(2.69)
7 AC_INIT([ircd-hybrid], [TRUNK], [bugs@ircd-hybrid.org])
8 AM_INIT_AUTOMAKE(1.13.1 subdir-objects)
9 AM_MAINTAINER_MODE
10 AC_CONFIG_HEADER(config.h)
11 AC_CONFIG_SRCDIR(src/ircd.c)
12
13 # Checks for programs.
14 AC_PROG_CC_C99
15 AS_IF([test "$ac_cv_prog_cc_c99" = "no"],
16 [AC_MSG_ERROR([no suitable C99 compiler found. Aborting.])])
17 AC_PROG_YACC
18 AM_PROG_LEX
19 AC_PROG_INSTALL
20
21 # Initializing libtool.
22 LT_CONFIG_LTDL_DIR([libltdl])
23 LT_INIT([dlopen disable-static])
24 LTDL_INIT([recursive convenience])
25 LIBTOOL="$LIBTOOL --silent"
26
27 AC_CHECK_SIZEOF(short)
28 AC_CHECK_SIZEOF(int)
29 AC_CHECK_SIZEOF(long)
30 AC_CHECK_SIZEOF(void *)
31 AC_CHECK_SIZEOF(int64_t)
32 AC_CHECK_SIZEOF(long long)
33
34 if test "$ac_cv_sizeof_int" = 2 ; then
35 AC_CHECK_TYPE(int16_t, int)
36 AC_CHECK_TYPE(uint16_t, unsigned int)
37 elif test "$ac_cv_sizeof_short" = 2 ; then
38 AC_CHECK_TYPE(int16_t, short)
39 AC_CHECK_TYPE(uint16_t, unsigned short)
40 else
41 AC_MSG_ERROR([Cannot find a type with size of 16 bits])
42 fi
43 if test "$ac_cv_sizeof_int" = 4 ; then
44 AC_CHECK_TYPE(int32_t, int)
45 AC_CHECK_TYPE(uint32_t, unsigned int)
46 elif test "$ac_cv_sizeof_short" = 4 ; then
47 AC_CHECK_TYPE(int32_t, short)
48 AC_CHECK_TYPE(uint32_t, unsigned short)
49 elif test "$ac_cv_sizeof_long" = 4 ; then
50 AC_CHECK_TYPE(int32_t, long)
51 AC_CHECK_TYPE(uint32_t, unsigned long)
52 else
53 AC_MSG_ERROR([Cannot find a type with size of 32 bits])
54 fi
55 if test "$ac_cv_sizeof_int64_t" = 8 ; then
56 AC_CHECK_TYPE(int64_t)
57 AC_CHECK_TYPE(uint64_t)
58 elif test "$ac_cv_sizeof_long_long" = 8 ; then
59 AC_CHECK_TYPE(int64_t, long long)
60 AC_CHECK_TYPE(uint64_t, unsigned long long)
61 else
62 AC_MSG_ERROR([Cannot find a type with size of 64 bits])
63 fi
64
65
66 # Checks for libraries.
67 AX_CHECK_LIB_IPV4
68 AX_CHECK_LIB_IPV6
69
70 # Checks for typedefs, structures, and compiler characteristics.
71 AC_C_BIGENDIAN
72
73 # Checks for library functions.
74 AC_CHECK_FUNCS_ONCE(strtok_r \
75 usleep \
76 strlcat \
77 strlcpy \
78 kqueue \
79 poll)
80
81 # Checks for header files.
82 AC_CHECK_HEADERS_ONCE(crypt.h \
83 sys/resource.h \
84 sys/param.h \
85 poll.h \
86 sys/devpoll.h \
87 sys/event.h \
88 sys/epoll.h \
89 types.h \
90 socket.h \
91 sys/wait.h \
92 wait.h)
93
94 AC_SEARCH_LIBS(crypt, crypt)
95
96 AC_ARG_ENABLE(libgeoip,
97 [AS_HELP_STRING([--disable-libgeoip],[Disable GeoIP support])], [],
98 [AC_CHECK_HEADER(GeoIP.h,
99 [AC_SEARCH_LIBS(GeoIP_id_by_ipnum_v6_gl, GeoIP,
100 [AC_DEFINE(HAVE_LIBGEOIP, 1, [Define to 1 if libGeoIP (-lGeoIP) is available.])])])], [])
101
102 dnl Openssl checks
103 AC_ARG_ENABLE(openssl,
104 [ --enable-openssl[=DIR] Enable OpenSSL support (DIR optional).
105 --disable-openssl Disable OpenSSL support. ],
106 [ cf_enable_openssl=$enableval ],
107 [ cf_enable_openssl="auto" ])
108 AC_MSG_CHECKING([for OpenSSL])
109 if test "$cf_enable_openssl" != "no"; then
110 cf_openssl_basedir=""
111 if test "$cf_enable_openssl" != "auto" &&
112 test "$cf_enable_openssl" != "yes"; then
113 dnl Support for --enable-openssl=/some/place
114 cf_openssl_basedir="${cf_enable_openssl}"
115 else
116 dnl Do the auto-probe here. Check some common directory paths.
117 for dirs in /usr/local/ssl /usr/pkg /usr/local /usr/lib /usr/lib/ssl\
118 /opt /opt/openssl /usr/local/openssl; do
119 if test -f "${dirs}/include/openssl/opensslv.h"; then
120 cf_openssl_basedir="${dirs}"
121 break
122 fi
123 done
124 unset dirs
125 fi
126
127 dnl Now check cf_openssl_found to see if we found anything.
128 if test ! -z "$cf_openssl_basedir"; then
129 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h"; then
130 CPPFLAGS="-I${cf_openssl_basedir}/include $CPPFLAGS"
131 LDFLAGS="-L${cf_openssl_basedir}/lib $LDFLAGS"
132 else
133 dnl OpenSSL wasn't found in the directory specified. Naughty
134 dnl administrator...
135 cf_openssl_basedir=""
136 fi
137 else
138 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
139 dnl are in /usr/include and /usr/lib. In this case, we don't want to
140 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
141 dnl We can't do this check above, because some people want two versions
142 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
143 dnl and they want /usr/local/ssl to have preference.
144 if test -f "/usr/include/openssl/opensslv.h"; then
145 cf_openssl_basedir="/usr"
146 fi
147 fi
148
149 dnl If we have a basedir defined, then everything is okay. Otherwise,
150 dnl we have a problem.
151 if test ! -z "$cf_openssl_basedir"; then
152 AC_MSG_RESULT([$cf_openssl_basedir])
153 cf_enable_openssl="yes"
154 else
155 AC_MSG_RESULT([not found. Please check your path.])
156 cf_enable_openssl="no"
157 fi
158 unset cf_openssl_basedir
159 else
160 dnl If --disable-openssl was specified
161 AC_MSG_RESULT([disabled])
162 fi
163
164 AS_IF([test "$cf_enable_openssl" != "no"],
165 [AC_MSG_CHECKING(for OpenSSL 0.9.8 or above)
166 AC_RUN_IFELSE([
167 AC_LANG_PROGRAM([
168 #include <openssl/opensslv.h>
169 #include <stdlib.h>],
170 [[ exit(!(OPENSSL_VERSION_NUMBER >= 0x00908000)); ]])],
171 [cf_openssl_version_ok=yes],
172 [cf_openssl_version_ok=no],
173 [cf_openssl_version_ok=no])
174
175 AS_IF([test "$cf_openssl_version_ok" = "yes"],
176 [AC_MSG_RESULT(found)
177
178 AC_CHECK_LIB(crypto, RSA_free)
179 AS_IF([test "$ac_cv_lib_crypto_RSA_free" = "yes"],
180 [AC_CHECK_LIB(ssl, SSL_connect)])
181 ],[AC_MSG_RESULT(no - OpenSSL support disabled)
182 cf_enable_openssl="no"])])
183
184 AM_CONDITIONAL(ENABLE_SSL, [test "$ac_cv_lib_ssl_SSL_connect" = yes])
185
186
187 dnl Check user configuration options
188 dnl Start with --disable-poll
189 AC_MSG_CHECKING([whether to enable the poll() event engine])
190 AC_ARG_ENABLE([poll],
191 [ --disable-poll Disable the poll-based engine],
192 [hyb_cv_enable_poll=$enable_poll],
193 [AC_CACHE_VAL(hyb_cv_enable_poll,
194 [hyb_cv_enable_poll=yes])])
195
196 if test "$ac_cv_func_poll" = no; then
197 hyb_cv_enable_poll=no
198 fi
199
200 AC_MSG_RESULT([$hyb_cv_enable_poll])
201
202 if test "$hyb_cv_enable_poll" = yes; then
203 ircd_event_engine="poll()"
204 AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()])
205 fi
206 AM_CONDITIONAL(ENGINE_POLL, [test "$hyb_cv_enable_poll" = yes])
207
208 dnl --disable-devpoll check...
209 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
210 AC_ARG_ENABLE([devpoll],
211 [ --disable-devpoll Disable the /dev/poll-based engine],
212 [hyb_cv_enable_devpoll=$enable_devpoll],
213 [AC_CACHE_VAL(hyb_cv_enable_devpoll,
214 [hyb_cv_enable_devpoll=yes])])
215
216 if test "$ac_cv_header_sys_devpoll_h" = no; then
217 hyb_cv_enable_devpoll=no
218 fi
219
220 AC_MSG_RESULT([$hyb_cv_enable_devpoll])
221
222 if test "$hyb_cv_enable_devpoll" != no; then
223 ircd_event_engine="/dev/poll/ $ircd_event_engine"
224 AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine])
225 fi
226
227 AM_CONDITIONAL(ENGINE_DEVPOLL, [test "$hyb_cv_enable_devpoll" = yes])
228
229
230 dnl --disable-kqueue check...
231 AC_MSG_CHECKING([whether to enable the kqueue event engine])
232 AC_ARG_ENABLE([kqueue],
233 [ --disable-kqueue Disable the kqueue-based engine],
234 [hyb_cv_enable_kqueue=$enable_kqueue],
235 [AC_CACHE_VAL(hyb_cv_enable_kqueue,
236 [hyb_cv_enable_kqueue=yes])])
237
238 if test "$ac_cv_header_sys_event_h" = no -o "$ac_cv_func_kqueue" = no; then
239 hyb_cv_enable_kqueue=no
240 fi
241
242 AC_MSG_RESULT([$hyb_cv_enable_kqueue])
243
244 if test "$hyb_cv_enable_kqueue" != no; then
245 ircd_event_engine="kqueue() $ircd_event_engine"
246 AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine])
247 fi
248
249 AM_CONDITIONAL(ENGINE_KQUEUE, [test "$hyb_cv_enable_kqueue" = yes])
250
251 dnl --disable-epoll check
252 AC_MSG_CHECKING([whether to enable the epoll event engine])
253 AC_ARG_ENABLE([epoll],
254 [ --disable-epoll Disable the epoll-based engine],
255 [hyb_cv_enable_epoll=$enable_epoll],
256 [AC_CACHE_VAL(hyb_cv_enable_epoll,
257 [hyb_cv_enable_epoll=yes])])
258
259 if test "$ac_cv_header_sys_epoll_h" = no -o "$ac_cv_func_epoll" = no; then
260 hyb_cv_enable_epoll=no
261 fi
262
263 AC_MSG_RESULT([$hyb_cv_enable_epoll])
264
265 # Set up the conditionals
266 if test x"$hyb_cv_enable_epoll" = xyes; then
267 ircd_event_engine="epoll() $ircd_event_engine"
268 AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
269
270 # Must also check to see if we need to provide the function bodies
271 dnl XXX Should rework this check
272 AC_MSG_CHECKING([whether epoll functions are properly defined])
273 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>],
274 [epoll_create(10);])],
275 [AC_MSG_RESULT([yes])],
276 [AC_MSG_RESULT([no])
277 AC_DEFINE([EPOLL_NEED_BODY], 1,
278 [Define to implement epoll system calls])])
279 fi
280
281 AM_CONDITIONAL(ENGINE_EPOLL, [test "$hyb_cv_enable_epoll" = yes])
282
283
284 AC_ARG_ENABLE(assert, AS_HELP_STRING([--enable-assert],
285 [Enable assert() statements]),
286 [assert=$enableval], [assert=no])
287
288 AS_IF([test "$assert" = "no"],
289 [AC_DEFINE(NDEBUG, 1, [Define to disable assert() statements.])])
290
291 AC_DEFINE([NICKNAMEHISTORYLENGTH], 32768, [Size of the WHOWAS array.])
292 AC_DEFINE([MP_CHUNK_SIZE_CHANNEL], 1024*1024, [Size of the channel mempool chunk.])
293 AC_DEFINE([MP_CHUNK_SIZE_MEMBER], 2048*1024, [Size of the channel-member mempool chunk.])
294 AC_DEFINE([MP_CHUNK_SIZE_BAN], 1024*1024, [Size of the ban mempool chunk.])
295 AC_DEFINE([MP_CHUNK_SIZE_CLIENT], 1024*1024, [Size of the client mempool chunk.])
296 AC_DEFINE([MP_CHUNK_SIZE_LCLIENT], 512*1024, [Size of the local client mempool chunk.])
297 AC_DEFINE([MP_CHUNK_SIZE_DNODE], 32*1024, [Size of the dlink_node mempool chunk.])
298 AC_DEFINE([MP_CHUNK_SIZE_DBUF], 512*1024, [Size of the dbuf mempool chunk.])
299 AC_DEFINE([MP_CHUNK_SIZE_AUTH], 128*1024, [Size of the auth mempool chunk.])
300 AC_DEFINE([MP_CHUNK_SIZE_DNS], 64*1024, [Size of the dns mempool chunk.])
301 AC_DEFINE([MP_CHUNK_SIZE_WATCH], 8*1024, [Size of the watch mempool chunk.])
302 AC_DEFINE([MP_CHUNK_SIZE_NAMEHOST], 64*1024, [Size of the namehost mempool chunk.])
303 AC_DEFINE([MP_CHUNK_SIZE_USERHOST], 128*1024, [Size of the userhost mempool chunk.])
304 AC_DEFINE([MP_CHUNK_SIZE_IP_ENTRY], 128*1024, [Size of the ip_entry mempool chunk.])
305
306 # Argument processing.
307 AX_ARG_ENABLE_HALFOPS
308 AX_ARG_ENABLE_DEBUGGING
309 AX_ARG_ENABLE_WARNINGS
310
311 AC_DEFINE_DIR([PREFIX],[prefix],[Set to prefix.])
312 AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Set to sysconfdir.])
313 AC_DEFINE_DIR([LIBDIR],[libdir],[Set to libdir.])
314 AC_DEFINE_DIR([DATADIR],[datadir],[Set to datadir.])
315 AC_DEFINE_DIR([LOCALSTATEDIR],[localstatedir],[Set to localstatedir.])
316
317 AC_CONFIG_FILES( \
318 Makefile \
319 src/Makefile \
320 libltdl/Makefile \
321 modules/Makefile \
322 modules/core/Makefile \
323 doc/Makefile \
324 help/Makefile \
325 tools/Makefile)
326
327 AC_OUTPUT

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28