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