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_MACRO_DIR([m4]) |
11 |
AC_CONFIG_HEADER(config.h) |
12 |
AC_CONFIG_SRCDIR(src/ircd.c) |
13 |
|
14 |
# Checks for programs. |
15 |
AC_PROG_CC_C99 |
16 |
AS_IF([test "$ac_cv_prog_cc_c99" = "no"], |
17 |
[AC_MSG_ERROR([no suitable C99 compiler found. Aborting.])]) |
18 |
AC_PROG_YACC |
19 |
AM_PROG_LEX |
20 |
AC_PROG_INSTALL |
21 |
|
22 |
# Initializing libtool. |
23 |
LT_CONFIG_LTDL_DIR([libltdl]) |
24 |
LT_INIT([dlopen disable-static]) |
25 |
LTDL_INIT([recursive convenience]) |
26 |
LIBTOOL="$LIBTOOL --silent" |
27 |
|
28 |
AC_CHECK_SIZEOF(short) |
29 |
AC_CHECK_SIZEOF(int) |
30 |
AC_CHECK_SIZEOF(long) |
31 |
AC_CHECK_SIZEOF(void *) |
32 |
AC_CHECK_SIZEOF(int64_t) |
33 |
AC_CHECK_SIZEOF(long long) |
34 |
|
35 |
if test "$ac_cv_sizeof_int" = 2 ; then |
36 |
AC_CHECK_TYPE(int16_t, int) |
37 |
AC_CHECK_TYPE(uint16_t, unsigned int) |
38 |
elif test "$ac_cv_sizeof_short" = 2 ; then |
39 |
AC_CHECK_TYPE(int16_t, short) |
40 |
AC_CHECK_TYPE(uint16_t, unsigned short) |
41 |
else |
42 |
AC_MSG_ERROR([Cannot find a type with size of 16 bits]) |
43 |
fi |
44 |
if test "$ac_cv_sizeof_int" = 4 ; then |
45 |
AC_CHECK_TYPE(int32_t, int) |
46 |
AC_CHECK_TYPE(uint32_t, unsigned int) |
47 |
elif test "$ac_cv_sizeof_short" = 4 ; then |
48 |
AC_CHECK_TYPE(int32_t, short) |
49 |
AC_CHECK_TYPE(uint32_t, unsigned short) |
50 |
elif test "$ac_cv_sizeof_long" = 4 ; then |
51 |
AC_CHECK_TYPE(int32_t, long) |
52 |
AC_CHECK_TYPE(uint32_t, unsigned long) |
53 |
else |
54 |
AC_MSG_ERROR([Cannot find a type with size of 32 bits]) |
55 |
fi |
56 |
if test "$ac_cv_sizeof_int64_t" = 8 ; then |
57 |
AC_CHECK_TYPE(int64_t) |
58 |
AC_CHECK_TYPE(uint64_t) |
59 |
elif test "$ac_cv_sizeof_long_long" = 8 ; then |
60 |
AC_CHECK_TYPE(int64_t, long long) |
61 |
AC_CHECK_TYPE(uint64_t, unsigned long long) |
62 |
else |
63 |
AC_MSG_ERROR([Cannot find a type with size of 64 bits]) |
64 |
fi |
65 |
|
66 |
|
67 |
# Checks for libraries. |
68 |
GCC_STACK_PROTECT_CC |
69 |
|
70 |
AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing]) |
71 |
|
72 |
AX_LIBRARY_NET |
73 |
|
74 |
# Checks for typedefs, structures, and compiler characteristics. |
75 |
AC_C_BIGENDIAN |
76 |
|
77 |
# Checks for library functions. |
78 |
AC_CHECK_FUNCS_ONCE(strtok_r \ |
79 |
usleep \ |
80 |
strlcat \ |
81 |
strlcpy \ |
82 |
kqueue \ |
83 |
poll) |
84 |
|
85 |
# Checks for header files. |
86 |
AC_CHECK_HEADERS_ONCE(crypt.h \ |
87 |
sys/resource.h \ |
88 |
sys/param.h \ |
89 |
poll.h \ |
90 |
sys/devpoll.h \ |
91 |
sys/event.h \ |
92 |
sys/epoll.h \ |
93 |
types.h \ |
94 |
socket.h \ |
95 |
sys/wait.h \ |
96 |
wait.h) |
97 |
|
98 |
AC_SEARCH_LIBS(crypt, crypt) |
99 |
|
100 |
AC_ARG_ENABLE(libgeoip, |
101 |
[AS_HELP_STRING([--disable-libgeoip],[Disable GeoIP support])], [], |
102 |
[AC_CHECK_HEADER(GeoIP.h, |
103 |
[AC_SEARCH_LIBS(GeoIP_id_by_ipnum_v6_gl, GeoIP, |
104 |
[AC_DEFINE(HAVE_LIBGEOIP, 1, [Define to 1 if libGeoIP (-lGeoIP) is available.])])])], []) |
105 |
|
106 |
|
107 |
AX_CHECK_OPENSSL |
108 |
|
109 |
|
110 |
dnl Check user configuration options |
111 |
dnl Start with --disable-poll |
112 |
AC_MSG_CHECKING([whether to enable the poll() event engine]) |
113 |
AC_ARG_ENABLE([poll], |
114 |
[ --disable-poll Disable the poll-based engine], |
115 |
[hyb_cv_enable_poll=$enable_poll], |
116 |
[AC_CACHE_VAL(hyb_cv_enable_poll, |
117 |
[hyb_cv_enable_poll=yes])]) |
118 |
|
119 |
if test "$ac_cv_func_poll" = no; then |
120 |
hyb_cv_enable_poll=no |
121 |
fi |
122 |
|
123 |
AC_MSG_RESULT([$hyb_cv_enable_poll]) |
124 |
|
125 |
if test "$hyb_cv_enable_poll" = yes; then |
126 |
ircd_event_engine="poll()" |
127 |
AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()]) |
128 |
fi |
129 |
AM_CONDITIONAL(ENGINE_POLL, [test "$hyb_cv_enable_poll" = yes]) |
130 |
|
131 |
dnl --disable-devpoll check... |
132 |
AC_MSG_CHECKING([whether to enable the /dev/poll event engine]) |
133 |
AC_ARG_ENABLE([devpoll], |
134 |
[ --disable-devpoll Disable the /dev/poll-based engine], |
135 |
[hyb_cv_enable_devpoll=$enable_devpoll], |
136 |
[AC_CACHE_VAL(hyb_cv_enable_devpoll, |
137 |
[hyb_cv_enable_devpoll=yes])]) |
138 |
|
139 |
if test "$ac_cv_header_sys_devpoll_h" = no; then |
140 |
hyb_cv_enable_devpoll=no |
141 |
fi |
142 |
|
143 |
AC_MSG_RESULT([$hyb_cv_enable_devpoll]) |
144 |
|
145 |
if test "$hyb_cv_enable_devpoll" != no; then |
146 |
ircd_event_engine="/dev/poll/ $ircd_event_engine" |
147 |
AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine]) |
148 |
fi |
149 |
|
150 |
AM_CONDITIONAL(ENGINE_DEVPOLL, [test "$hyb_cv_enable_devpoll" = yes]) |
151 |
|
152 |
|
153 |
dnl --disable-kqueue check... |
154 |
AC_MSG_CHECKING([whether to enable the kqueue event engine]) |
155 |
AC_ARG_ENABLE([kqueue], |
156 |
[ --disable-kqueue Disable the kqueue-based engine], |
157 |
[hyb_cv_enable_kqueue=$enable_kqueue], |
158 |
[AC_CACHE_VAL(hyb_cv_enable_kqueue, |
159 |
[hyb_cv_enable_kqueue=yes])]) |
160 |
|
161 |
if test "$ac_cv_header_sys_event_h" = no -o "$ac_cv_func_kqueue" = no; then |
162 |
hyb_cv_enable_kqueue=no |
163 |
fi |
164 |
|
165 |
AC_MSG_RESULT([$hyb_cv_enable_kqueue]) |
166 |
|
167 |
if test "$hyb_cv_enable_kqueue" != no; then |
168 |
ircd_event_engine="kqueue() $ircd_event_engine" |
169 |
AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine]) |
170 |
fi |
171 |
|
172 |
AM_CONDITIONAL(ENGINE_KQUEUE, [test "$hyb_cv_enable_kqueue" = yes]) |
173 |
|
174 |
dnl --disable-epoll check |
175 |
AC_MSG_CHECKING([whether to enable the epoll event engine]) |
176 |
AC_ARG_ENABLE([epoll], |
177 |
[ --disable-epoll Disable the epoll-based engine], |
178 |
[hyb_cv_enable_epoll=$enable_epoll], |
179 |
[AC_CACHE_VAL(hyb_cv_enable_epoll, |
180 |
[hyb_cv_enable_epoll=yes])]) |
181 |
|
182 |
if test "$ac_cv_header_sys_epoll_h" = no -o "$ac_cv_func_epoll" = no; then |
183 |
hyb_cv_enable_epoll=no |
184 |
fi |
185 |
|
186 |
AC_MSG_RESULT([$hyb_cv_enable_epoll]) |
187 |
|
188 |
# Set up the conditionals |
189 |
if test x"$hyb_cv_enable_epoll" = xyes; then |
190 |
ircd_event_engine="epoll() $ircd_event_engine" |
191 |
AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine]) |
192 |
|
193 |
# Must also check to see if we need to provide the function bodies |
194 |
dnl XXX Should rework this check |
195 |
AC_MSG_CHECKING([whether epoll functions are properly defined]) |
196 |
AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], |
197 |
[epoll_create(10);])], |
198 |
[AC_MSG_RESULT([yes])], |
199 |
[AC_MSG_RESULT([no]) |
200 |
AC_DEFINE([EPOLL_NEED_BODY], 1, |
201 |
[Define to implement epoll system calls])]) |
202 |
fi |
203 |
|
204 |
AM_CONDITIONAL(ENGINE_EPOLL, [test "$hyb_cv_enable_epoll" = yes]) |
205 |
|
206 |
|
207 |
dnl --with-maxcon allows us to set the maximum connections |
208 |
hyb_maxcon=`ulimit -Hn` |
209 |
if test x"$hyb_maxcon" = xunlimited; then |
210 |
hyb_maxcon=`ulimit -Sn` |
211 |
fi |
212 |
hyb_maxcon=`expr $hyb_maxcon - 4` |
213 |
AC_MSG_CHECKING([max connections]) |
214 |
AC_ARG_WITH([maxcon], |
215 |
[ --with-maxcon=maxcon Maximum number of connections server will accept], |
216 |
[hyb_cv_with_maxcon=$with_maxcon], |
217 |
[AC_CACHE_VAL(hyb_cv_with_maxcon, |
218 |
[hyb_cv_with_maxcon=$hyb_maxcon])]) |
219 |
|
220 |
if test x"$hyb_cv_with_maxcon" = xyes -o x"$hyb_cv_with_maxcon" = xno; then |
221 |
if test "$hyb_maxcon" -lt 32; then |
222 |
AC_MSG_ERROR([Maximum connections (number of open files minus 4) must be at least 32.]) |
223 |
fi |
224 |
hyb_cv_with_maxcon=$hyb_maxcon |
225 |
elif test "$hyb_cv_with_maxcon" -lt 32; then |
226 |
AC_MSG_ERROR([Maximum connections (--with-maxcon) must be at least 32.]) |
227 |
fi |
228 |
|
229 |
AC_MSG_RESULT([$hyb_cv_with_maxcon]) |
230 |
|
231 |
AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $hyb_cv_with_maxcon, |
232 |
[Maximum number of network connections]) |
233 |
|
234 |
|
235 |
|
236 |
AC_ARG_ENABLE(assert, AS_HELP_STRING([--enable-assert], |
237 |
[Enable assert() statements]), |
238 |
[assert=$enableval], [assert=no]) |
239 |
|
240 |
AS_IF([test "$assert" = "no"], |
241 |
[AC_DEFINE(NDEBUG, 1, [Define to disable assert() statements.])]) |
242 |
|
243 |
AC_DEFINE([NICKNAMEHISTORYLENGTH], 32768, [Size of the WHOWAS array.]) |
244 |
AC_DEFINE([MP_CHUNK_SIZE_CHANNEL], 1024*1024, [Size of the channel mempool chunk.]) |
245 |
AC_DEFINE([MP_CHUNK_SIZE_MEMBER], 2048*1024, [Size of the channel-member mempool chunk.]) |
246 |
AC_DEFINE([MP_CHUNK_SIZE_BAN], 1024*1024, [Size of the ban mempool chunk.]) |
247 |
AC_DEFINE([MP_CHUNK_SIZE_CLIENT], 1024*1024, [Size of the client mempool chunk.]) |
248 |
AC_DEFINE([MP_CHUNK_SIZE_LCLIENT], 512*1024, [Size of the local client mempool chunk.]) |
249 |
AC_DEFINE([MP_CHUNK_SIZE_DNODE], 32*1024, [Size of the dlink_node mempool chunk.]) |
250 |
AC_DEFINE([MP_CHUNK_SIZE_DBUF], 512*1024, [Size of the dbuf mempool chunk.]) |
251 |
AC_DEFINE([MP_CHUNK_SIZE_AUTH], 128*1024, [Size of the auth mempool chunk.]) |
252 |
AC_DEFINE([MP_CHUNK_SIZE_DNS], 64*1024, [Size of the dns mempool chunk.]) |
253 |
AC_DEFINE([MP_CHUNK_SIZE_WATCH], 8*1024, [Size of the watch mempool chunk.]) |
254 |
AC_DEFINE([MP_CHUNK_SIZE_NAMEHOST], 64*1024, [Size of the namehost mempool chunk.]) |
255 |
AC_DEFINE([MP_CHUNK_SIZE_USERHOST], 128*1024, [Size of the userhost mempool chunk.]) |
256 |
AC_DEFINE([MP_CHUNK_SIZE_IP_ENTRY], 128*1024, [Size of the ip_entry mempool chunk.]) |
257 |
|
258 |
# Argument processing. |
259 |
AX_ARG_ENABLE_HALFOPS |
260 |
AX_ARG_ENABLE_DEBUGGING |
261 |
AX_ARG_ENABLE_WARNINGS |
262 |
|
263 |
AC_DEFINE_DIR([PREFIX],[prefix],[Set to prefix.]) |
264 |
AC_DEFINE_DIR([SYSCONFDIR],[sysconfdir],[Set to sysconfdir.]) |
265 |
AC_DEFINE_DIR([LIBDIR],[libdir],[Set to libdir.]) |
266 |
AC_DEFINE_DIR([DATADIR],[datadir],[Set to datadir.]) |
267 |
AC_DEFINE_DIR([LOCALSTATEDIR],[localstatedir],[Set to localstatedir.]) |
268 |
|
269 |
AC_CONFIG_FILES( \ |
270 |
Makefile \ |
271 |
src/Makefile \ |
272 |
libltdl/Makefile \ |
273 |
modules/Makefile \ |
274 |
modules/core/Makefile \ |
275 |
doc/Makefile \ |
276 |
help/Makefile \ |
277 |
tools/Makefile) |
278 |
|
279 |
AC_OUTPUT |