]>
Commit | Line | Data |
---|---|---|
88cb7f99 | 1 | dnl $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $ |
212380e3 AC |
2 | dnl Process this file with autoconf to produce a configure script. |
3 | ||
4 | dnl TODO: clean up all the OpenSSL and shared module checking stuff; | |
5 | dnl the most major changes have already been made and it looks like | |
6 | dnl said functions need to be just about as complex as they already are. | |
7 | ||
8 | AC_PREREQ(2.57) | |
9 | ||
10 | dnl Sneaky way to get an Id tag into the configure script | |
88cb7f99 | 11 | AC_COPYRIGHT([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $]) |
212380e3 | 12 | |
c2a0843d | 13 | AC_INIT([charybdis], [3.5.0-dev]) |
212380e3 | 14 | |
a5471f24 | 15 | AC_CONFIG_MACRO_DIR([m4]) |
212380e3 AC |
16 | AC_CONFIG_HEADER(include/setup.h) |
17 | ||
18 | AC_PREFIX_DEFAULT($HOME/ircd) | |
19 | ||
20 | AC_GNU_SOURCE | |
21 | ||
22 | OLD_CFLAGS="$CFLAGS" | |
23 | dnl Checks for programs. | |
24 | AC_PROG_CC | |
25 | AC_LANG(C) | |
26 | ||
27 | dnl Make sure autoconf doesn't interfere with cflags -jmallett | |
28 | CFLAGS="$OLD_CFLAGS" | |
29 | ||
6573fa4c | 30 | AC_CONFIG_SUBDIRS(libratbox) |
db137867 | 31 | |
212380e3 AC |
32 | dnl Check for various compilers. -jmallett |
33 | dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk | |
34 | ||
35 | if test "$ac_cv_c_compiler_gnu" != yes; then | |
36 | ||
37 | SGS=no | |
38 | AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro) | |
39 | case `$CC -version 2>&1` in | |
40 | *TenDRA*) | |
41 | AC_MSG_RESULT([yes, TenDRA]) | |
42 | IRC_CFLAGS="" | |
43 | CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include" | |
44 | SGS=yes | |
45 | TenDRA=yes | |
46 | ;; | |
47 | *MIPSpro*) | |
48 | AC_MSG_RESULT([yes, MIPSpro]) | |
49 | MIPSpro=yes | |
50 | SGS=yes | |
51 | ;; | |
52 | *) | |
53 | AC_MSG_RESULT(no) | |
54 | TenDRA=no | |
55 | MIPSpro=no | |
56 | ;; | |
57 | esac | |
58 | ||
59 | AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc]) | |
60 | case `$CC -V 2>&1` in | |
61 | *Sun*WorkShop* | *Forte*Developer*) | |
62 | AC_MSG_RESULT(Sun Workshop/Forte) | |
63 | IRC_CFLAGS="-fast -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString" | |
64 | SunWorkShop=yes | |
65 | SGS=yes | |
66 | ;; | |
67 | *Tru64*) | |
68 | AC_MSG_RESULT(Tru64 cc) | |
69 | IRC_CFLAGS="-O2" | |
70 | CPPFLAGS="-I/usr/local/include" | |
71 | Tru=yes | |
72 | ;; | |
73 | *HP*ANSI*) | |
74 | AC_MSG_RESULT(HPUX cc) | |
75 | HPUX=yes | |
76 | IRC_CFLAGS="+e" | |
77 | ;; | |
78 | *) | |
79 | AC_MSG_RESULT(no) | |
80 | ;; | |
81 | esac | |
82 | ||
83 | fi | |
84 | ||
d3faa80a | 85 | AC_MSG_CHECKING([uname -s for Solaris, AIX or HPUX]) |
212380e3 AC |
86 | OSNAME=`uname -s` |
87 | case "$OSNAME" in | |
88 | HP-UX*) | |
89 | dnl only do this if we haven't already detected the newer one | |
90 | dnl and we're not already using gcc | |
91 | ||
92 | if test "$HPUX" != yes -a "$ac_cv_c_compiler_gnu" = no; then | |
93 | AC_MSG_RESULT(assuming old HPUX with its own cc) | |
94 | IRC_CFLAGS="$IRC_CFLAGS +e" | |
95 | HPUX=yes | |
96 | else | |
97 | AC_MSG_RESULT(already using newer HPUX) | |
98 | fi | |
99 | ;; | |
212380e3 AC |
100 | SunOS*) |
101 | AC_MSG_RESULT(SunOS or Solaris) | |
102 | AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.]) | |
103 | SUN=yes | |
104 | ;; | |
105 | AIX*) | |
106 | AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are) | |
107 | IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G" | |
108 | ;; | |
109 | *) | |
110 | AC_MSG_RESULT(no) | |
111 | ;; | |
112 | esac | |
113 | ||
114 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
115 | AC_MSG_CHECKING(if $CC is Apple GCC) | |
116 | ||
117 | case `$CC -v 2>&1 | tail -n 1` in | |
118 | *Apple*) | |
119 | AC_MSG_RESULT(yes) | |
120 | AppleGCC=yes | |
121 | ;; | |
122 | *) | |
123 | AC_MSG_RESULT(no) | |
124 | AppleGCC=no | |
125 | ;; | |
126 | esac | |
127 | ||
97199fb3 | 128 | IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -std=gnu99" |
212380e3 AC |
129 | fi |
130 | ||
131 | dnl If we support -g, use it! | |
132 | if test "$ac_cv_prog_cc_g" = yes; then | |
133 | dnl Tru64 needs -g3 for -O2 | |
134 | if test "$Tru" = yes; then | |
135 | IRC_CFLAGS="$IRC_CFLAGS -g3" | |
136 | else | |
137 | IRC_CFLAGS="$IRC_CFLAGS -g" | |
138 | fi | |
139 | fi | |
140 | ||
141 | dnl SVR4 SGS based on what we know about the compiler -jmallett | |
142 | AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces) | |
143 | if test "$SGS" = "yes"; then | |
144 | AC_MSG_RESULT(yes) | |
145 | else | |
146 | AC_MSG_RESULT(no) | |
147 | fi | |
148 | ||
149 | dnl We prefer gcc -MM because it's a lot less bloated | |
150 | AC_PATH_PROG(MKDEP, mkdep) | |
151 | AC_PATH_PROG(MAKEDEPEND, makedepend) | |
152 | ||
153 | AC_MSG_CHECKING(how to generate dependency info) | |
154 | ||
155 | STDOUT="> .depend" | |
156 | ||
157 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
158 | AC_MSG_RESULT(gcc -MM) | |
159 | MKDEP="$CC -MM" | |
160 | elif test ! -z "$MKDEP"; then | |
161 | AC_MSG_RESULT(mkdep) | |
162 | ||
163 | dnl Tru64's mkdep is very loud | |
164 | if test -z "$Tru"; then | |
165 | STDOUT="" | |
166 | else | |
167 | STDOUT=" 2> /dev/null" | |
168 | fi | |
169 | elif test "$SunWorkShop" = yes; then | |
170 | AC_MSG_RESULT($CC -xM) | |
171 | MKDEP="$CC -xM" | |
172 | STDOUT="> .depend 2> /dev/null" | |
173 | elif test ! -z "$MAKEDEPEND"; then | |
174 | AC_MSG_RESULT(makedepend) | |
175 | MKDEP="$MAKEDEPEND -f-" | |
176 | else | |
177 | AC_MSG_RESULT([nothing suitable.. forget it!]) | |
178 | MKDEP=":" | |
179 | fi | |
180 | ||
181 | AC_SUBST(MKDEP) | |
182 | AC_SUBST(STDOUT) | |
183 | ||
184 | dnl check for /dev/null so we can use it to hold evil fd's | |
185 | AC_MSG_CHECKING([for /dev/null]) | |
186 | if test -c /dev/null ; then | |
187 | AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null]) | |
188 | AC_MSG_RESULT(yes) | |
189 | else | |
190 | AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null]) | |
191 | AC_MSG_RESULT(no - using devnull.log) | |
192 | fi | |
193 | ||
194 | dnl jdc -- If CFLAGS is defined, best use it everywhere... | |
195 | dnl NOTE: jv says it must be added to the *END*, because things like | |
196 | dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid. | |
197 | if test ! -z "$CFLAGS"; then | |
198 | IRC_CFLAGS="$IRC_CFLAGS $CFLAGS" | |
199 | fi | |
200 | ||
201 | AC_ISC_POSIX | |
202 | AC_C_INLINE | |
203 | AC_PROG_GCC_TRADITIONAL | |
204 | AC_PROG_MAKE_SET | |
205 | AC_PROG_INSTALL | |
206 | AC_PATH_PROG(RM, rm) | |
207 | AC_PATH_PROG(CP, cp) | |
208 | AC_PATH_PROG(MV, mv) | |
209 | AC_PATH_PROG(LN, ln) | |
210 | AC_PATH_PROG(SED, sed) | |
211 | AC_PATH_PROG(AR, ar) | |
212 | AC_PATH_PROG(LD, ld) | |
213 | AC_PATH_PROG(RANLIB, ranlib) | |
214 | AC_PATH_PROG(TOUCH, touch) | |
215 | ||
216 | AC_PROG_YACC | |
217 | ||
218 | dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found | |
219 | if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then | |
220 | AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc]) | |
221 | fi | |
222 | ||
223 | AC_PROG_LEX | |
224 | ||
225 | if test "$LEX" = ":"; then | |
226 | AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) | |
227 | fi | |
228 | ||
c74836dc | 229 | AC_ARG_ENABLE([fhs-paths], |
6929cd01 | 230 | [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])], |
c74836dc NPB |
231 | [], |
232 | [dnl detect if the user appears to want --enable-fhs-paths | |
233 | AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \ | |
234 | test "$localstatedir" = '${prefix}/var' && \ | |
235 | test "$libdir" = '${exec_prefix}/lib'], | |
236 | [enable_fhs_paths=no], | |
237 | [enable_fhs_paths=yes]) | |
238 | ]) | |
212380e3 | 239 | dnl use directory structure of cached as default (hack) |
c74836dc NPB |
240 | AS_IF([test "x$enable_fhs_paths" = "xyes"], |
241 | [dnl Avoid name collisions. | |
242 | pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}' | |
243 | rundir=${rundir-'${prefix}/run'} | |
244 | pkgrundir='${rundir}/${PACKAGE_TARNAME}' | |
245 | pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'], | |
246 | [libexecdir='${bindir}' | |
247 | pkglibexecdir='${libexecdir}' | |
248 | rundir='${sysconfdir}' | |
249 | pkgrundir='${rundir}' | |
212380e3 | 250 | localstatedir='${prefix}' |
c74836dc NPB |
251 | pkglocalstatedir='${sysconfdir}']) |
252 | pkglibdir='${libdir}/${PACKAGE_TARNAME}' | |
253 | AC_SUBST([pkglibdir]) | |
254 | AC_SUBST([rundir]) | |
255 | AC_SUBST([pkgrundir]) | |
256 | AC_SUBST([pkglocalstatedir]) | |
1870e06a | 257 | AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]]) |
c74836dc NPB |
258 | AC_SUBST([pkglibexecdir]) |
259 | AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live]) | |
212380e3 AC |
260 | |
261 | dnl Checks for header files. | |
262 | AC_HEADER_STDC | |
263 | ||
264 | AC_CHECK_HEADERS([crypt.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h sys/wait.h wait.h sys/epoll.h sys/uio.h machine/endian.h]) | |
265 | ||
266 | dnl Stuff that the memory manager (imalloc) depends on | |
267 | dnl ================================================== | |
268 | ||
269 | AC_C_CONST | |
270 | if test "$ac_cv_header_machine_endian_h" = "no" ; then | |
271 | AC_C_BIGENDIAN | |
272 | fi | |
273 | AC_TYPE_PID_T | |
274 | AC_TYPE_SIZE_T | |
275 | AC_CHECK_SIZEOF(short) | |
276 | AC_CHECK_SIZEOF(int) | |
277 | AC_CHECK_SIZEOF(long) | |
278 | AC_CHECK_SIZEOF(long long) | |
279 | ||
212380e3 AC |
280 | dnl Networking Functions |
281 | dnl ==================== | |
282 | ||
283 | AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])]) | |
284 | ||
285 | dnl SunOS/Solaris required libnsl for inet_ntoa() | |
286 | if test x"$SUN" = xyes; then | |
287 | AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])]) | |
288 | fi | |
289 | ||
212380e3 AC |
290 | AC_CHECK_TYPE(socklen_t, , |
291 | [AC_DEFINE([socklen_t], [unsigned int], | |
292 | [If we don't have a real socklen_t, unsigned int is good enough.])], | |
293 | [#include <sys/types.h> | |
294 | #include <sys/socket.h>]) | |
295 | ||
296 | AC_ARG_ENABLE(ipv6, | |
297 | AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no]) | |
298 | ||
212380e3 AC |
299 | AC_SEARCH_LIBS(crypt, [crypt descrypt],,) |
300 | ||
301 | CRYPT_LIB=$ac_cv_search_crypt | |
302 | ||
303 | if test "$CRYPT_LIB" = "none required"; then | |
304 | unset CRYPT_LIB | |
305 | elif test "$CRYPT_LIB" = no; then | |
306 | unset CRYPT_LIB | |
307 | fi | |
308 | ||
309 | AC_SUBST(CRYPT_LIB) | |
310 | ||
311 | if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then | |
312 | VICONF=viconf | |
313 | dnl We need one of the above to build viconf. Just a sanity check, | |
314 | dnl we don't want to stop people from building the rest of ircd | |
315 | dnl just because they can't build viconf. | |
316 | else | |
317 | VICONF="" | |
318 | fi | |
319 | ||
320 | AC_SUBST(VICONF) | |
321 | ||
322 | dnl See whether we can include both string.h and strings.h. | |
323 | AC_CACHE_CHECK([whether string.h and strings.h may both be included], | |
324 | gcc_cv_header_string, | |
325 | [ | |
326 | AC_COMPILE_IFELSE( | |
327 | [#include <string.h> | |
328 | #include <strings.h>], | |
329 | [gcc_cv_header_string=yes], | |
330 | [gcc_cv_header_string=no]) | |
331 | ]) | |
332 | ||
333 | if test "$gcc_cv_header_string" = "yes"; then | |
334 | AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h]) | |
335 | fi | |
336 | ||
337 | AC_C_BIGENDIAN | |
338 | ||
339 | dnl Check for stdarg.h - if we can't find it, halt configure | |
ec86417c | 340 | AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])]) |
212380e3 AC |
341 | |
342 | dnl Checks for the existence of strlcat, strlcpy, basename... | |
343 | dnl This more reliable test only works with gcc though. | |
344 | ||
345 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
346 | ||
347 | AC_MSG_CHECKING(for strlcpy) | |
348 | save_CFLAGS=$CFLAGS | |
349 | CFLAGS="$CFLAGS -Wimplicit -Werror" | |
350 | ||
351 | AC_LINK_IFELSE( | |
352 | [AC_LANG_PROGRAM( | |
353 | [[#include <string.h> | |
354 | #include <stdlib.h>]], | |
355 | [[char *a = malloc(6); | |
356 | strlcpy(a, "hello", 6);]] | |
357 | )], | |
358 | [AC_MSG_RESULT(yes) | |
359 | AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])], | |
360 | [AC_MSG_RESULT(no)] | |
361 | ) | |
362 | ||
363 | AC_MSG_CHECKING(for strlcat) | |
364 | AC_LINK_IFELSE( | |
365 | [AC_LANG_PROGRAM( | |
366 | [[#include <string.h> | |
367 | #include <stdlib.h>]], | |
368 | [[char *a = malloc(6); | |
369 | a[0] = '\0'; | |
370 | strlcat(a, "hello", 6);]] | |
371 | )], | |
372 | [AC_MSG_RESULT(yes) | |
373 | AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])], | |
374 | [AC_MSG_RESULT(no)] | |
375 | ) | |
376 | ||
377 | CFLAGS=$save_CFLAGS | |
378 | ||
379 | else | |
380 | ||
381 | dnl Better than nothing. The more complicated test above probably fixes powerpc, | |
382 | dnl so who cares. | |
383 | ||
384 | AC_CHECK_FUNCS([strlcat strlcpy]) | |
385 | ||
386 | fi | |
387 | ||
388 | AC_CHECK_TYPE([u_int32_t], [], | |
389 | [ | |
390 | AC_CHECK_TYPE([uint32_t], | |
391 | [ | |
392 | AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.]) | |
393 | ], | |
394 | [ | |
395 | AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int]) | |
396 | AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.]) | |
397 | ]) | |
398 | ]) | |
399 | ||
400 | AC_CHECK_TYPE([u_int16_t], [], | |
401 | [ | |
402 | AC_CHECK_TYPE([uint16_t], | |
403 | [ | |
404 | AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute]) | |
405 | ], | |
406 | [ | |
407 | AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int]) | |
408 | AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.]) | |
409 | ]) | |
410 | ]) | |
411 | ||
412 | AC_CHECK_TYPE([in_port_t], [], | |
413 | [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])], | |
414 | [[#include <sys/types.h> | |
415 | #include <netinet/in.h>]]) | |
416 | ||
417 | AC_CHECK_TYPE([sa_family_t], [], | |
418 | [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], | |
419 | [[#include <sys/types.h> | |
420 | #include <sys/socket.h>]]) | |
421 | ||
422 | AC_CHECK_TYPES([uintptr_t]) | |
423 | ||
424 | dnl check for various functions... | |
425 | AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ]) | |
426 | ||
427 | AC_FUNC_ALLOCA | |
428 | ||
429 | dnl Specialized functions checks | |
430 | dnl ============================ | |
431 | ||
432 | dnl check for nanosleep | |
433 | AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep, | |
434 | LIBS="${LIBS} -lrt", | |
435 | [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4" | |
436 | )])]) | |
437 | if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno | |
438 | then | |
439 | AC_MSG_RESULT("nanosleep not found..using select for delay") | |
440 | else | |
441 | AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists]) | |
442 | fi | |
443 | ||
444 | dnl OpenSSL support | |
445 | AC_MSG_CHECKING(for OpenSSL) | |
446 | AC_ARG_ENABLE(openssl, | |
447 | [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) | |
448 | AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], | |
449 | [cf_enable_openssl=$enableval], | |
450 | [cf_enable_openssl="auto"]) | |
451 | ||
452 | if test "$cf_enable_openssl" != "no" ; then | |
453 | cf_openssl_basedir="" | |
454 | if test "$cf_enable_openssl" != "auto" && | |
455 | test "$cf_enable_openssl" != "yes" ; then | |
456 | dnl Support for --enable-openssl=/some/place | |
457 | cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`" | |
458 | else | |
459 | dnl Do the auto-probe here. Check some common directory paths. | |
460 | for dirs in /usr/local/ssl /usr/pkg /usr/local \ | |
461 | /usr/local/openssl ; do | |
462 | if test -f "${dirs}/include/openssl/opensslv.h" ; then | |
463 | cf_openssl_basedir="${dirs}" | |
464 | break | |
465 | fi | |
466 | done | |
467 | unset dirs | |
468 | fi | |
469 | dnl Now check cf_openssl_found to see if we found anything. | |
470 | if test ! -z "$cf_openssl_basedir"; then | |
471 | if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then | |
472 | SSL_INCLUDES="-I${cf_openssl_basedir}/include" | |
473 | SSL_LIBS="-L${cf_openssl_basedir}/lib" | |
474 | else | |
475 | dnl OpenSSL wasn't found in the directory specified. Naughty | |
476 | dnl administrator... | |
477 | cf_openssl_basedir="" | |
478 | fi | |
479 | else | |
480 | dnl Check for stock FreeBSD 4.x and 5.x systems, since their files | |
481 | dnl are in /usr/include and /usr/lib. In this case, we don't want to | |
482 | dnl change INCLUDES or LIBS, but still want to enable OpenSSL. | |
483 | dnl We can't do this check above, because some people want two versions | |
484 | dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) | |
485 | dnl and they want /usr/local/ssl to have preference. | |
486 | if test -f "/usr/include/openssl/opensslv.h" ; then | |
487 | cf_openssl_basedir="/usr" | |
488 | fi | |
489 | fi | |
490 | ||
491 | dnl If we have a basedir defined, then everything is okay. Otherwise, | |
492 | dnl we have a problem. | |
493 | if test ! -z "$cf_openssl_basedir"; then | |
494 | AC_MSG_RESULT($cf_openssl_basedir) | |
495 | cf_enable_openssl="yes" | |
496 | else | |
497 | AC_MSG_RESULT([not found. Specify a correct path?]) | |
498 | cf_enable_openssl="no" | |
499 | fi | |
500 | unset cf_openssl_basedir | |
501 | else | |
502 | dnl If --disable-openssl was specified | |
503 | AC_MSG_RESULT(disabled) | |
504 | fi | |
505 | ||
506 | save_CPPFLAGS="$CPPFLAGS" | |
507 | CPPFLAGS="$CPPFLAGS $SSL_INCLUDES" | |
508 | save_LIBS="$LIBS" | |
509 | LIBS="$LIBS $SSL_LIBS" | |
510 | if test "$cf_enable_openssl" != no; then | |
511 | dnl Check OpenSSL version (must be 0.9.6 or above!) | |
512 | AC_MSG_CHECKING(for OpenSSL 0.9.6 or above) | |
513 | AC_RUN_IFELSE( | |
514 | AC_LANG_PROGRAM( | |
515 | [#include <openssl/opensslv.h> | |
516 | #include <stdlib.h>], | |
517 | [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000) | |
518 | exit(0); else exit(1);]]), | |
519 | cf_openssl_version_ok=yes, | |
520 | cf_openssl_version_ok=no, | |
521 | cf_openssl_version_ok=no) | |
522 | ||
523 | if test "$cf_openssl_version_ok" = yes; then | |
524 | AC_MSG_RESULT(found) | |
525 | ||
526 | dnl Work around pmake/gmake conditional incompatibilities | |
527 | AC_SUBST(ENCSPEED, encspeed) | |
528 | ||
529 | dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers | |
530 | CPPFLAGS="$CPPFLAGS $SSL_LIBS" | |
531 | AC_CHECK_LIB(crypto, RSA_free) | |
532 | SSL_LIBS="$SSL_LIBS -lcrypto" | |
533 | SSL_SRCS_ENABLE='$(SSL_SRCS)' | |
534 | else | |
535 | AC_MSG_RESULT(no - OpenSSL support disabled) | |
536 | fi | |
537 | fi | |
538 | ||
539 | CPPFLAGS="$save_CPPFLAGS" | |
540 | LIBS="$save_LIBS" | |
541 | ||
542 | dnl End OpenSSL detection | |
543 | ||
544 | ||
545 | dnl Specialized functions and libraries | |
546 | dnl =================================== | |
547 | ||
548 | AC_ARG_WITH(zlib-path, | |
549 | AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]), | |
550 | [LIBS="$LIBS -L$withval"],) | |
551 | ||
552 | AC_ARG_ENABLE(zlib, | |
553 | AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]), | |
554 | [zlib=$enableval],[zlib=yes]) | |
555 | ||
556 | if test "$zlib" = yes; then | |
557 | ||
558 | AC_CHECK_HEADER(zlib.h, [ | |
559 | AC_CHECK_LIB(z, zlibVersion, | |
560 | [ | |
561 | AC_SUBST(ZLIB_LD, -lz) | |
562 | AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.]) | |
563 | ], zlib=no) | |
564 | ], zlib=no) | |
565 | ||
566 | fi | |
567 | ||
cf1001a7 LS |
568 | dnl Check for shared sqlite |
569 | dnl ====================== | |
a6ef3156 LS |
570 | AC_ARG_WITH(shared-sqlite, |
571 | AC_HELP_STRING([--with-shared-sqlite],[Use shared sqlite]), | |
572 | [shared_sqlite=$withval],[shared_sqlite=no]) | |
497e30a0 LS |
573 | |
574 | if test "$shared_sqlite" = yes; then | |
a5471f24 LS |
575 | PKG_CHECK_MODULES(SQLITE, [sqlite3], |
576 | [ | |
577 | shared_sqlite=yes | |
cf1001a7 | 578 | ], shared_sqlite=no) |
497e30a0 LS |
579 | fi |
580 | ||
74ab6be0 | 581 | if test "$shared_sqlite" = no; then |
cf1001a7 | 582 | SQLITE_SRC="sqlite3.c" |
74ab6be0 LS |
583 | fi |
584 | ||
a5471f24 LS |
585 | AC_SUBST(SQLITE_LD, "$SQLITE_LIBS") |
586 | AC_SUBST(SQLITE_INCLUDES, "$SQLITE_CFLAGS") | |
cf1001a7 LS |
587 | AC_SUBST(SQLITE_SRC) |
588 | ||
212380e3 AC |
589 | dnl IO Loop Selection |
590 | dnl ================= | |
591 | ||
1b4cfad8 AC |
592 | AC_ARG_ENABLE(ports, AC_HELP_STRING([--enable-ports],[Force solaris I/O ports subsystem usage.]), |
593 | [ if test $enableval = yes; then | |
594 | SELECT_TYPE_EXPLICIT="ports" | |
595 | else | |
596 | use_ports=no | |
597 | fi | |
598 | ],) | |
599 | ||
212380e3 AC |
600 | AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]), |
601 | [ if test $enableval = yes; then | |
602 | SELECT_TYPE_EXPLICIT="poll" | |
603 | else | |
604 | use_poll=no | |
605 | fi | |
606 | ],) | |
607 | ||
608 | AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]), | |
609 | [ if test $enableval = yes; then | |
610 | SELECT_TYPE_EXPLICIT="select" | |
611 | else | |
612 | use_select=no | |
613 | fi | |
614 | ],) | |
615 | ||
616 | AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]), | |
617 | [ if test $enableval = yes; then | |
618 | SELECT_TYPE_EXPLICIT="kqueue" | |
619 | else | |
620 | use_kqueue=no | |
621 | fi | |
622 | ],) | |
623 | ||
212380e3 AC |
624 | AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]), |
625 | [ if test $enableval = yes; then | |
626 | SELECT_TYPE_EXPLICIT="epoll" | |
a34ec229 | 627 | AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no]) |
212380e3 AC |
628 | else |
629 | use_epoll=no | |
630 | fi | |
631 | ],) | |
632 | ||
633 | dnl ********************************************************************** | |
634d4aad | 634 | dnl Check for --with-confdir [deprecated, use --sysconfdir instead] |
212380e3 AC |
635 | dnl ********************************************************************** |
636 | ||
634d4aad NPB |
637 | AC_ARG_WITH([confdir], |
638 | [AC_HELP_STRING([--with-confdir=DIR], | |
639 | [Directory to install config files [deprecated, use --sysconfdir instead].])], | |
640 | [ sysconfdir=`echo $withval | sed 's/\/$//'` ], | |
641 | [ confdir='${sysconfdir}' ]) | |
642 | AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.]) | |
212380e3 AC |
643 | |
644 | dnl ********************************************************************** | |
645 | dnl Check for --with-logdir | |
646 | dnl ********************************************************************** | |
647 | ||
648 | AC_MSG_CHECKING([whether to modify logdir]) | |
649 | AC_ARG_WITH(logdir, | |
650 | AC_HELP_STRING([--with-logdir=DIR], | |
651 | [Directory where to write logfiles.]), | |
652 | [ logdir=`echo $withval | sed 's/\/$//'` | |
c74836dc NPB |
653 | AC_MSG_RESULT(yes)], |
654 | [ AS_IF([test "x$enable_fhs_paths" = "xyes"], | |
655 | [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'], | |
656 | [logdir='${prefix}/logs']) | |
657 | AC_MSG_RESULT(no)]) | |
658 | AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.]) | |
659 | AC_SUBST_DIR([logdir]) | |
212380e3 AC |
660 | |
661 | dnl ********************************************************************** | |
662 | dnl Check for --with-helpdir | |
663 | dnl ********************************************************************** | |
664 | ||
665 | AC_MSG_CHECKING([whether to modify helpdir]) | |
666 | AC_ARG_WITH(helpdir, | |
667 | AC_HELP_STRING([--with-helpdir=DIR], | |
668 | [Directory to install help files.]), | |
669 | [ helpdir=`echo $withval | sed 's/\/$//'` | |
c74836dc NPB |
670 | AC_MSG_RESULT(yes) ], |
671 | [ AS_IF([test "x$enable_fhs_paths" = "xyes"], | |
672 | [helpdir='${datadir}/${PACKAGE_TARNAME}/help'], | |
673 | [helpdir='${prefix}/help']) | |
674 | AC_MSG_RESULT(no) ]) | |
675 | AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.]) | |
676 | AC_SUBST_DIR([helpdir]) | |
212380e3 AC |
677 | |
678 | dnl ********************************************************************** | |
679 | dnl Check for --with-moduledir | |
680 | dnl ********************************************************************** | |
681 | ||
682 | AC_MSG_CHECKING([whether to modify moduledir]) | |
683 | AC_ARG_WITH(moduledir, | |
c74836dc NPB |
684 | [AC_HELP_STRING([--with-moduledir=DIR], |
685 | [Directory to install modules.])], | |
212380e3 | 686 | [ moduledir=`echo $withval | sed 's/\/$//'` |
c74836dc NPB |
687 | AC_MSG_RESULT(yes)], |
688 | [ AS_IF([test "x$enable_fhs_paths" = "xyes"], | |
689 | [moduledir='${pkglibdir}/modules'], | |
690 | [moduledir='${prefix}/modules']) | |
212380e3 | 691 | AC_MSG_RESULT(no) |
c74836dc NPB |
692 | ]) |
693 | AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) | |
694 | AC_SUBST_DIR([moduledir]) | |
695 | ||
696 | dnl Check for --with-rundir | |
697 | ||
698 | AC_MSG_CHECKING([whether or modify rundir]) | |
699 | AC_ARG_WITH([rundir], | |
700 | [AC_HELP_STRING([--with-rundir=DIR], | |
701 | [Directory in which to store pidfile.])], | |
702 | [AC_MSG_RESULT([yes]) | |
703 | rundir=`echo $withval | sed 's/\/$//'`], | |
704 | [AC_MSG_RESULT([no]) | |
705 | AS_IF([test "x$enable_fhs_paths" = "xyes"], | |
706 | [rundir='${prefix}/run'], | |
707 | [rundir='${sysconfdir}'])]) | |
708 | AC_SUBST([rundir]) | |
709 | AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.]) | |
710 | ||
711 | dnl Installed utility program prefixes (does not affect binaries | |
712 | dnl installed into pkglibexecdir) | |
713 | AC_MSG_CHECKING([for program prefix]) | |
714 | AC_ARG_WITH([program-prefix], | |
715 | [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])], | |
716 | [test "x$with_program_prefix" = "xno" && with_program_prefix=], | |
717 | [with_program_prefix=]) | |
718 | AC_MSG_RESULT(["$with_program_prefix"]) | |
719 | PROGRAM_PREFIX="$with_program_prefix" | |
720 | AC_SUBST([PROGRAM_PREFIX]) | |
721 | AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.]) | |
212380e3 | 722 | |
b6d0720c AC |
723 | dnl ********************************************************************** |
724 | dnl Branding | |
725 | dnl ********************************************************************** | |
726 | ||
727 | AC_MSG_CHECKING([whether custom branding is requested]) | |
728 | AC_ARG_WITH(custom-branding, | |
729 | AC_HELP_STRING([--with-custom-branding=NAME], | |
730 | [Custom branding name.]), | |
731 | [BRANDING_NAME=$withval | |
732 | AC_MSG_RESULT([yes])], | |
733 | [BRANDING_NAME=$PACKAGE_NAME | |
734 | AC_MSG_RESULT([no])] | |
735 | ) | |
736 | ||
737 | AC_MSG_CHECKING([whether a custom version is requested]) | |
738 | AC_ARG_WITH(custom-version, | |
739 | AC_HELP_STRING([--with-custom-version=NAME], | |
740 | [Custom version branding.]), | |
741 | [BRANDING_VERSION=$withval | |
742 | AC_MSG_RESULT([yes])], | |
743 | [BRANDING_VERSION=$PACKAGE_VERSION | |
744 | AC_MSG_RESULT([no])] | |
745 | ) | |
746 | ||
747 | AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$BRANDING_NAME"], [Custom branding name.]) | |
748 | AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$BRANDING_VERSION"], [Custom branding name.]) | |
749 | ||
f5493691 AC |
750 | if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then |
751 | AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.]) | |
752 | fi | |
753 | ||
212380e3 AC |
754 | if test ! -z "$SELECT_TYPE_EXPLICIT"; then |
755 | SELECT_TYPE="$SELECT_TYPE_EXPLICIT"; | |
756 | echo "Forcing $SELECT_TYPE to be enabled" | |
757 | else | |
758 | ||
1b4cfad8 AC |
759 | if test ! "x$use_ports" = "xno"; then |
760 | AC_CHECK_FUNCS(port_getn, [haveports=yes], [haveports=no]) | |
761 | if test "x$haveports" = "xyes" ; then | |
762 | SELECT_TYPE="ports" | |
763 | fi | |
764 | fi | |
765 | ||
212380e3 AC |
766 | if test ! "x$use_select" = "xno"; then |
767 | AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no]) | |
768 | if test "x$haveselect" = "xyes" ; then | |
769 | SELECT_TYPE="select" | |
770 | fi | |
771 | fi | |
772 | ||
773 | if test ! "x$use_poll" = "xno"; then | |
774 | AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no]) | |
775 | if test "x$havepoll" = "xyes" ; then | |
776 | SELECT_TYPE="poll" | |
777 | fi | |
778 | fi | |
779 | ||
212380e3 AC |
780 | if test ! "x$use_kqueue" = "xno"; then |
781 | AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no]) | |
782 | if test "x$havekqueue" = "xyes" ; then | |
783 | SELECT_TYPE="kqueue" | |
784 | fi | |
785 | fi | |
786 | ||
787 | if test ! "x$use_epoll" = "xno"; then | |
788 | AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no]) | |
789 | if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then | |
790 | if test "x$haveepoll" = "xyes" ; then | |
791 | AC_MSG_CHECKING(for epoll support in kernel) | |
792 | AC_TRY_RUN( | |
793 | #include <stdint.h> | |
794 | #include <sys/param.h> | |
795 | #include <sys/types.h> | |
796 | #include <sys/epoll.h> | |
797 | #include <sys/syscall.h> | |
798 | #include <unistd.h> | |
799 | ||
800 | int | |
801 | main(int argc, char **argv) | |
802 | { | |
803 | int epfd; | |
804 | ||
805 | epfd = epoll_create(256); | |
33b310b3 | 806 | return (epfd == -1 ? 1 : 0); |
212380e3 AC |
807 | }, [AC_MSG_RESULT(yes) |
808 | AC_DEFINE(HAVE_EPOLL, 1, | |
809 | [Define if your system supports the epoll system calls]) | |
810 | SELECT_TYPE="epoll"], | |
811 | AC_MSG_RESULT(no), AC_MSG_RESULT(no)) | |
812 | fi | |
813 | fi | |
814 | ||
815 | haveepollsyscall=no | |
816 | ||
817 | if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then | |
818 | if test "x$haveepoll" = "xno" ; then | |
819 | AC_MSG_CHECKING(for epoll system call) | |
820 | AC_TRY_RUN( | |
821 | #include <stdint.h> | |
822 | #include <sys/param.h> | |
823 | #include <sys/types.h> | |
824 | #include <sys/epoll.h> | |
825 | #include <sys/syscall.h> | |
826 | #include <unistd.h> | |
827 | ||
828 | int | |
829 | epoll_create(int size) | |
830 | { | |
831 | return (syscall(__NR_epoll_create, size)); | |
832 | } | |
833 | ||
834 | int | |
835 | main(int argc, char **argv) | |
836 | { | |
837 | int epfd; | |
838 | ||
839 | epfd = epoll_create(256); | |
840 | exit (epfd == -1 ? 1 : 0); | |
841 | }, [AC_MSG_RESULT(yes) | |
842 | AC_DEFINE(HAVE_EPOLL, 1, | |
843 | [Define if your system supports the epoll system calls]) | |
844 | SELECT_TYPE="epoll"], | |
845 | AC_MSG_RESULT(no), AC_MSG_RESULT(no)) | |
846 | fi | |
847 | fi | |
848 | ||
849 | fi | |
850 | ||
851 | fi | |
852 | ||
853 | if test -z "$SELECT_TYPE"; then | |
854 | AC_MSG_ERROR([Unable to find a usable IO interface],) | |
855 | fi | |
856 | ||
857 | echo "Using $SELECT_TYPE for select loop." | |
858 | ||
859 | AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using]) | |
860 | AC_SUBST(SELECT_TYPE) | |
861 | ||
862 | ||
863 | dnl Debug-related options | |
864 | dnl ===================== | |
865 | ||
866 | AC_ARG_ENABLE(assert, | |
867 | AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), | |
868 | [assert=$enableval], [assert=no]) | |
869 | ||
870 | if test "$assert" = no; then | |
871 | AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) | |
872 | elif test "$assert" = soft; then | |
873 | AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) | |
874 | AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) | |
875 | elif test "$assert" = yes; then | |
876 | assert = "hard"; | |
877 | fi | |
878 | ||
879 | AC_MSG_CHECKING(if you want IO Debugging hooks) | |
880 | AC_ARG_ENABLE(iodebug, | |
881 | AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]), | |
882 | [iodebug=$enableval], [iodebug=no]) | |
883 | ||
884 | if test "$iodebug" = yes; then | |
885 | AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.]) | |
886 | AC_MSG_RESULT(yes) | |
887 | else | |
888 | AC_MSG_RESULT(no) | |
889 | fi | |
890 | ||
891 | ||
892 | AC_MSG_CHECKING(if you want to do a profile build) | |
893 | AC_ARG_ENABLE(profile, | |
894 | AC_HELP_STRING([--enable-profile],[Enable profiling]), | |
895 | [profile=$enableval], [profile=no]) | |
896 | ||
897 | if test "$profile" = yes; then | |
898 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
899 | IRC_CFLAGS="$IRC_CFLAGS -pg" | |
900 | AC_MSG_RESULT([yes, adding -pg]) | |
901 | AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) | |
902 | else | |
903 | AC_MSG_RESULT([no, profile builds only work with gcc]) | |
904 | fi | |
905 | else | |
906 | AC_MSG_RESULT(no) | |
907 | fi | |
908 | ||
909 | AC_ARG_ENABLE(balloc, | |
910 | AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]), | |
911 | [balloc=$enableval], [balloc=yes]) | |
912 | ||
913 | if test "$balloc" = no; then | |
914 | AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.]) | |
915 | fi | |
916 | ||
212380e3 AC |
917 | AC_ARG_ENABLE(small-net, |
918 | AC_HELP_STRING([--enable-small-net],[Enable small network support.]), | |
919 | [small_net=$enableval], [small_net=no]) | |
920 | ||
921 | if test "$small_net" = yes; then | |
922 | dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.]) | |
923 | AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.]) | |
924 | AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.]) | |
925 | AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.]) | |
926 | AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.]) | |
927 | AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.]) | |
928 | AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.]) | |
929 | AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.]) | |
930 | AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.]) | |
931 | AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.]) | |
932 | AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.]) | |
933 | AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.]) | |
934 | AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.]) | |
935 | AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.]) | |
936 | AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.]) | |
ce923338 | 937 | AC_DEFINE([FD_HEAP_SIZE], 128, [Size of fd heap.]) |
bc5f6d5b | 938 | AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.]) |
212380e3 AC |
939 | else |
940 | dnl These settings are for a large network like efnet..they will use lots of memory | |
941 | dnl so enable small net unless you really need this much support | |
942 | AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) | |
943 | AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) | |
944 | AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.]) | |
945 | AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.]) | |
946 | AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.]) | |
947 | AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.]) | |
948 | AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.]) | |
949 | AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.]) | |
950 | AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.]) | |
951 | AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.]) | |
952 | AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.]) | |
953 | AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.]) | |
954 | AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.]) | |
955 | AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) | |
ce923338 | 956 | AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) |
bc5f6d5b | 957 | AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) |
212380e3 AC |
958 | fi |
959 | ||
960 | AC_ARG_WITH(nicklen, | |
b225bf93 | 961 | AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]), |
212380e3 | 962 | [ |
f173c7d8 JT |
963 | if ! expr "$withval" + 0 >/dev/null 2>&1; then |
964 | AC_ERROR([NICKLEN must be a numeric value]) | |
965 | fi | |
ca8ff483 | 966 | if test $withval -gt 50; then |
212380e3 AC |
967 | NICKLEN=50 |
968 | AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50]) | |
ca8ff483 JT |
969 | elif test $withval -lt 9; then |
970 | NICKLEN=9 | |
971 | AC_MSG_WARN([NICKLEN has a lower limit of 9. Setting NICKLEN=9]) | |
212380e3 AC |
972 | else |
973 | NICKLEN="$withval" | |
974 | fi | |
b225bf93 | 975 | ], [NICKLEN=31]) |
212380e3 AC |
976 | |
977 | AC_ARG_WITH(topiclen, | |
978 | AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]), | |
979 | [ | |
980 | if test $withval -ge 390; then | |
981 | TOPICLEN=390 | |
982 | AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390]) | |
983 | else | |
984 | TOPICLEN=$withval | |
985 | fi | |
986 | ], [TOPICLEN=390]) | |
987 | ||
212380e3 AC |
988 | AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)]) |
989 | AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length]) | |
212380e3 | 990 | |
f13494df | 991 | shared_modules="yes" |
212380e3 AC |
992 | dnl Some first-stage sanity checks. |
993 | if test "$shared_modules" = yes; then | |
212380e3 AC |
994 | dnl TenDRA's cc is called tcc too. |
995 | if test "$CC" = tcc -a "$TenDRA" = "no"; then | |
996 | AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC]) | |
997 | shared_modules="no" | |
998 | fi | |
999 | fi | |
1000 | ||
1001 | dnl Second stage: check for functions and headers. | |
1002 | if test "$shared_modules" = yes; then | |
1003 | DYNLINK_C=dynlink.c | |
1004 | AC_CHECK_HEADERS(dlfcn.h) | |
1005 | AC_SEARCH_LIBS(shl_load, dld, | |
1006 | [ | |
1007 | AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.]) | |
1008 | SUFFIX=".sl" | |
1009 | MOD_TARGET=hpux_shared | |
1010 | SEDOBJ="s/\.o/.sl/g" | |
1011 | ], | |
1012 | dnl !shl_load: | |
1013 | [ | |
1014 | dnl standard dlopen | |
1015 | AC_SEARCH_LIBS(dlopen, [dl c_r], | |
1016 | [ | |
1017 | AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.]) | |
1018 | SUFFIX=".so" | |
1019 | MOD_TARGET=shared_modules | |
1020 | SEDOBJ="s/\.o/.so/g" | |
1021 | if test "$AppleGCC" = yes; then | |
1022 | AC_CHECK_HEADERS([mach-o/dyld.h]) | |
1023 | fi | |
1024 | AC_CHECK_FUNC(dlsym, , | |
1025 | [ | |
1026 | AC_MSG_WARN([dlsym is not available, shared modules disabled]) | |
1027 | shared_modules=no | |
1028 | ]) | |
1029 | AC_CHECK_FUNCS(dlfunc) | |
1030 | ], | |
1031 | [ | |
1032 | shared_modules=no | |
1033 | ]) | |
1034 | ]) | |
1035 | fi | |
1036 | ||
1037 | AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.]) | |
1038 | ||
1039 | dnl Third stage - wrangling the linker. | |
1040 | if test "$shared_modules" = yes; then | |
1041 | # The GNU linker requires the -export-dynamic option to make | |
1042 | # all symbols visible in the dynamic symbol table. | |
1043 | hold_ldflags=$LDFLAGS | |
1044 | AC_MSG_CHECKING(for the ld -export-dynamic flag) | |
1045 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror" | |
1046 | AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no) | |
1047 | LDFLAGS=$hold_ldflags | |
1048 | ||
1049 | if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then | |
1050 | found="no, IRIX ld uses -B,dynamic" | |
1051 | LDFLAGS="${LDFLAGS} -Wl,-B,dynamic" | |
1052 | fi | |
1053 | ||
1054 | if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then | |
1055 | found="no, AIX ld uses -G -brtl" | |
1056 | LDFLAGS="${LDFLAGS} -Wl,-G,-brtl" | |
1057 | fi | |
1058 | ||
1059 | AC_MSG_RESULT($found) | |
1060 | ||
1061 | if test "$found" = yes; then | |
1062 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" | |
1063 | fi | |
1064 | ||
1065 | AC_MSG_CHECKING(for compiler option to produce PIC) | |
1066 | dnl The order should be here to check for groups of compilers, | |
1067 | dnl then for odd compilers, then if no PICFLAGS were set up, | |
1068 | dnl check for GCC and set defaults, or else error. -jmallett | |
1069 | if test "$SGS" = "yes"; then | |
1070 | AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G]) | |
1071 | PICFLAGS="-KPIC -DPIC -G" | |
1072 | fi | |
1073 | ||
1074 | if test "$AppleGCC" = "yes"; then | |
1075 | AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress]) | |
1076 | PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress" | |
1077 | fi | |
1078 | dnl Please note, that on HPUX two different stages of module compilation occurs, since | |
1079 | dnl while compiling modules, the compiler does not allow you to give arguments | |
1080 | dnl to the linker. (I did not design this) | |
1081 | dnl So we need -c in the first stage of module compilation. | |
1082 | dnl In the second stage, we link the modules via ld -b. | |
1083 | dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead. | |
1084 | dnl -TimeMr14C | |
1085 | if test "$HPUX" = "yes" -a "$CC" != gcc; then | |
1086 | AC_MSG_RESULT(HP-UX cc: +z -r -q -n) | |
1087 | PICFLAGS="+z -r -q -n -c" | |
1088 | AC_MSG_CHECKING([if +ESfic is required on this platform]) | |
1089 | ||
1090 | if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then | |
1091 | AC_MSG_RESULT(no) | |
1092 | else | |
1093 | AC_MSG_RESULT(yes) | |
1094 | PICFLAGS="$PICFLAGS +ESfic" | |
1095 | fi | |
1096 | ||
1097 | LDFLAGS="${LDFLAGS} -Wl,-E" | |
1098 | fi | |
1099 | if test "$Tru" = yes -a "$CC" != gcc; then | |
1100 | AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*']) | |
1101 | PICFLAGS="-shared -expect_unresolved '*' " | |
1102 | LDFLAGS="-call_shared" | |
1103 | fi | |
1104 | if test -z "$PICFLAGS"; then | |
1105 | if test "$ac_cv_c_compiler_gnu" = "yes"; then | |
1106 | AC_MSG_RESULT(gcc: -fPIC -DPIC -shared) | |
1107 | PICFLAGS="-fPIC -DPIC -shared" | |
1108 | else | |
1109 | AC_MSG_RESULT(no) | |
1110 | shared_modules=no | |
1111 | fi | |
1112 | fi | |
1113 | fi | |
1114 | ||
794816af JT |
1115 | # rpath, for finding libratbox.so at run time |
1116 | hold_ldflags=$LDFLAGS | |
1117 | AC_MSG_CHECKING(for the ld -rpath flag) | |
1118 | LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}" | |
1119 | AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no) | |
1120 | LDFLAGS=$hold_ldflags | |
1121 | AC_MSG_RESULT($found) | |
1122 | if test "$found" = yes; then | |
1123 | LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}" | |
1124 | fi | |
1125 | ||
212380e3 AC |
1126 | # This must be down here, or it will mess up checks like the ones |
1127 | # for -Wl,-export-dynamic | |
1128 | # -- jilles | |
97199fb3 | 1129 | CWARNS="" |
212380e3 AC |
1130 | AC_ARG_ENABLE(warnings, |
1131 | AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), | |
1132 | [ | |
1133 | IRC_CFLAGS="$IRC_CFLAGS -O0" | |
1134 | CFLAGS="$IRC_CFLAGS" | |
1135 | ||
1136 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) | |
1137 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) | |
1138 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit) | |
1139 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align) | |
1140 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual) | |
c0e90a8e JT |
1141 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings) |
1142 | CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration) | |
212380e3 AC |
1143 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes) |
1144 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis) | |
1145 | CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w) | |
1146 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) | |
1147 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow) | |
1148 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn) | |
1149 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef) | |
1150 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed) | |
1151 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs) | |
212380e3 AC |
1152 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused) |
1153 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls) | |
1154 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) | |
f9a9ffac | 1155 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format) |
212380e3 AC |
1156 | |
1157 | IRC_CFLAGS="$CFLAGS" | |
1158 | ],[]) | |
1159 | ||
1160 | if test "$shared_modules" = no; then | |
1161 | DYNLINK_C="" | |
1162 | MOD_TARGET="libmodules.a" | |
1163 | MODULES_LIBS="../modules/libmodules.a" | |
1164 | SEDOBJ="" | |
1165 | AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.]) | |
1166 | AC_MSG_WARN([shared module support has been disabled!]) | |
1167 | fi | |
1168 | ||
1169 | dnl Stage 5 - underscores in front of symbol names. | |
1170 | if test "$shared_modules" = yes; then | |
1171 | ||
1172 | AC_CHECK_FUNC(nlist,, | |
1173 | AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl", | |
1174 | AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",) | |
1175 | ) | |
1176 | ) | |
1177 | ||
1178 | dnl We need to find out whether underscores are appended to symbol | |
1179 | dnl names in executable files. First, though, we need to see | |
1180 | dnl where nlist.h is hiding. | |
1181 | AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], ) | |
1182 | AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], ) | |
1183 | AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], ) | |
1184 | if test x"$nlist_h" = "x"; then | |
1185 | AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.]) | |
1186 | else | |
1187 | AC_MSG_CHECKING(for extra underscores prepended to symbol names) | |
1188 | AC_CACHE_VAL(symbol_underscores, | |
1189 | [ | |
1190 | cat << EOF > conftest.c | |
1191 | #include <$nlist_h> | |
1192 | #include <stdio.h> | |
1193 | #include <stdlib.h> | |
1194 | void _modinit(void); | |
1195 | int main(int argc, char *argv[[]]) { | |
1196 | int i; | |
1197 | struct nlist nl[[5]]; | |
1198 | ||
1199 | /* fill the names in this way, so it'll work almost everywhere */ | |
1200 | nl[[0]].n_name = "_modinit"; | |
1201 | nl[[1]].n_name = "__modinit"; | |
1202 | nl[[2]].n_name = "___modinit"; | |
1203 | nl[[3]].n_name = "____modinit"; | |
1204 | nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL; | |
1205 | ||
1206 | if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1); | |
1207 | for(i = 0; i < 4; i++) { | |
1208 | if(nl[[i]].n_value != NULL) | |
1209 | { | |
1210 | int j; | |
1211 | for(j = 0; j < i; j++) | |
1212 | printf("_"); | |
1213 | exit(i); | |
1214 | } | |
1215 | } | |
1216 | exit(-1); | |
1217 | } | |
1218 | void _modinit(void) { return; } | |
1219 | EOF | |
1220 | $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1 | |
1221 | symbol_underscores=`./conftest conftest` | |
1222 | AC_MSG_RESULT($symbol_underscores) | |
1223 | $RM -f conftest conftest.c | |
1224 | ]) | |
1225 | AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.]) | |
1226 | fi | |
1227 | fi | |
1228 | ||
97199fb3 JT |
1229 | IRC_CFLAGS="$IRC_CFLAGS $CWARNS" |
1230 | ||
212380e3 AC |
1231 | AC_SUBST(MODULES_LIBS) |
1232 | AC_SUBST(MOD_TARGET) | |
1233 | ||
1234 | AC_SUBST(SSL_SRCS_ENABLE) | |
1235 | AC_SUBST(SSL_INCLUDES) | |
1236 | AC_SUBST(SSL_LIBS) | |
1237 | ||
1238 | AC_SUBST(LDFLAGS) | |
1239 | AC_SUBST(PICFLAGS) | |
1240 | AC_SUBST(IRC_CFLAGS) | |
1241 | AC_SUBST(SEDOBJ) | |
1242 | ||
1243 | ||
1244 | if test "$prefix" = "NONE"; then | |
1245 | AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.]) | |
1246 | ||
1247 | else | |
1248 | ||
1249 | dnl Don't get bitten by Cygwin's stupidity if the user specified | |
1250 | dnl a custom prefix with a trailing slash | |
1251 | ||
1252 | prefix=`echo $prefix | sed 's/\/$//'` | |
1253 | AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.]) | |
1254 | ||
1255 | fi | |
1256 | ||
1257 | AC_CONFIG_FILES( \ | |
1258 | Makefile \ | |
734ce253 | 1259 | bandb/Makefile \ |
d261b578 | 1260 | ssld/Makefile \ |
212380e3 | 1261 | extensions/Makefile \ |
212380e3 AC |
1262 | src/Makefile \ |
1263 | modules/Makefile \ | |
1264 | tools/Makefile \ | |
14048b96 | 1265 | tools/genssl \ |
212380e3 AC |
1266 | doc/Makefile \ |
1267 | help/Makefile \ | |
1268 | ) | |
14048b96 | 1269 | AC_CONFIG_COMMANDS([tools/genssl_chmod], [chmod 755 tools/genssl]) |
212380e3 AC |
1270 | |
1271 | AC_OUTPUT | |
1272 | ||
1273 | if test "$cf_openssl_version_ok" = yes; then | |
1274 | openssl="yes" | |
1275 | else | |
1276 | openssl="no" | |
1277 | fi | |
1278 | ||
1279 | if test "$shared_modules" = yes; then | |
1280 | modules=shared | |
1281 | else | |
1282 | modules=static | |
1283 | fi | |
1284 | ||
1285 | echo " | |
b6d0720c | 1286 | Configuration of ${BRANDING_NAME}-${BRANDING_VERSION}: |
212380e3 AC |
1287 | Install directory : $prefix |
1288 | ||
1289 | Ziplinks : $zlib | |
1290 | OpenSSL : $openssl | |
212380e3 AC |
1291 | Socket Engine : $SELECT_TYPE |
1292 | Small network : $small_net | |
1293 | Block allocator : $balloc | |
212380e3 AC |
1294 | |
1295 | Nickname length : $NICKLEN | |
1296 | Topic length : $TOPICLEN | |
1297 | ||
b6d0720c | 1298 | Use (g)make to compile $BRANDING_NAME, then (g)make install to install it. |
212380e3 | 1299 | " |