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