]> jfr.im git - solanum.git/blob - configure.ac
AWAY_HEAP_SIZE added to configure.ac - just another part of ratbox3 away system port.
[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],[2.3.0])
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 if test $ipv6 != yes; then
321 have_v6="no"
322 else
323 AC_MSG_CHECKING([for core IPv6 support])
324
325 AC_COMPILE_IFELSE(
326 [AC_LANG_PROGRAM(
327 [[#define IN_AUTOCONF
328 #include <sys/types.h>
329 #include <sys/socket.h>
330 #include <netinet/in.h>]],
331 [[struct sockaddr_in6 s;
332 s.sin6_family = 0;]]
333 )],
334 [
335 if test "$CYGWIN" = "yes"; then
336 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
337 have_v6=no
338 else
339 have_v6=yes
340 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
341 AC_MSG_RESULT(yes)
342 AC_MSG_CHECKING([for struct in6addr_any])
343 AC_COMPILE_IFELSE(
344 [AC_LANG_PROGRAM(
345 [[#define IN_AUTOCONF
346 #include <sys/types.h>
347 #include <sys/socket.h>
348 #include <netinet/in.h>]],
349 [[struct in6_addr a = in6addr_any;]]
350 )],
351 [AC_MSG_RESULT(yes)],
352 [
353 AC_MSG_RESULT(no)
354 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
355 inet_misc=1
356 ]
357 )
358 fi
359 ],
360 [AC_MSG_RESULT(no)
361 have_v6="no"])
362 fi
363
364 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
365
366 CRYPT_LIB=$ac_cv_search_crypt
367
368 if test "$CRYPT_LIB" = "none required"; then
369 unset CRYPT_LIB
370 elif test "$CRYPT_LIB" = no; then
371 unset CRYPT_LIB
372 fi
373
374 AC_SUBST(CRYPT_LIB)
375
376 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
377 VICONF=viconf
378 dnl We need one of the above to build viconf. Just a sanity check,
379 dnl we don't want to stop people from building the rest of ircd
380 dnl just because they can't build viconf.
381 else
382 VICONF=""
383 fi
384
385 AC_SUBST(VICONF)
386
387 dnl See whether we can include both string.h and strings.h.
388 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
389 gcc_cv_header_string,
390 [
391 AC_COMPILE_IFELSE(
392 [#include <string.h>
393 #include <strings.h>],
394 [gcc_cv_header_string=yes],
395 [gcc_cv_header_string=no])
396 ])
397
398 if test "$gcc_cv_header_string" = "yes"; then
399 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
400 fi
401
402 AC_C_BIGENDIAN
403
404 dnl Check for stdarg.h - if we can't find it, halt configure
405 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
406
407 dnl Checks for the existence of strlcat, strlcpy, basename...
408 dnl This more reliable test only works with gcc though.
409
410 if test "$ac_cv_c_compiler_gnu" = yes; then
411
412 AC_MSG_CHECKING(for strlcpy)
413 save_CFLAGS=$CFLAGS
414 CFLAGS="$CFLAGS -Wimplicit -Werror"
415
416 AC_LINK_IFELSE(
417 [AC_LANG_PROGRAM(
418 [[#include <string.h>
419 #include <stdlib.h>]],
420 [[char *a = malloc(6);
421 strlcpy(a, "hello", 6);]]
422 )],
423 [AC_MSG_RESULT(yes)
424 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
425 [AC_MSG_RESULT(no)]
426 )
427
428 AC_MSG_CHECKING(for strlcat)
429 AC_LINK_IFELSE(
430 [AC_LANG_PROGRAM(
431 [[#include <string.h>
432 #include <stdlib.h>]],
433 [[char *a = malloc(6);
434 a[0] = '\0';
435 strlcat(a, "hello", 6);]]
436 )],
437 [AC_MSG_RESULT(yes)
438 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
439 [AC_MSG_RESULT(no)]
440 )
441
442 CFLAGS=$save_CFLAGS
443
444 else
445
446 dnl Better than nothing. The more complicated test above probably fixes powerpc,
447 dnl so who cares.
448
449 AC_CHECK_FUNCS([strlcat strlcpy])
450
451 fi
452
453 AC_CHECK_TYPE([u_int32_t], [],
454 [
455 AC_CHECK_TYPE([uint32_t],
456 [
457 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
458 ],
459 [
460 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
461 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
462 ])
463 ])
464
465 AC_CHECK_TYPE([u_int16_t], [],
466 [
467 AC_CHECK_TYPE([uint16_t],
468 [
469 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
470 ],
471 [
472 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
473 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
474 ])
475 ])
476
477 AC_CHECK_TYPE([in_port_t], [],
478 [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
479 [[#include <sys/types.h>
480 #include <netinet/in.h>]])
481
482 AC_CHECK_TYPE([sa_family_t], [],
483 [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
484 [[#include <sys/types.h>
485 #include <sys/socket.h>]])
486
487 AC_CHECK_TYPES([uintptr_t])
488
489 dnl check for various functions...
490 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
491
492 AC_FUNC_ALLOCA
493
494 dnl Specialized functions checks
495 dnl ============================
496
497 dnl check for nanosleep
498 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
499 LIBS="${LIBS} -lrt",
500 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
501 )])])
502 if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
503 then
504 AC_MSG_RESULT("nanosleep not found..using select for delay")
505 else
506 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
507 fi
508
509 dnl OpenSSL support
510 AC_MSG_CHECKING(for OpenSSL)
511 AC_ARG_ENABLE(openssl,
512 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
513 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
514 [cf_enable_openssl=$enableval],
515 [cf_enable_openssl="auto"])
516
517 if test "$cf_enable_openssl" != "no" ; then
518 cf_openssl_basedir=""
519 if test "$cf_enable_openssl" != "auto" &&
520 test "$cf_enable_openssl" != "yes" ; then
521 dnl Support for --enable-openssl=/some/place
522 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
523 else
524 dnl Do the auto-probe here. Check some common directory paths.
525 for dirs in /usr/local/ssl /usr/pkg /usr/local \
526 /usr/local/openssl ; do
527 if test -f "${dirs}/include/openssl/opensslv.h" ; then
528 cf_openssl_basedir="${dirs}"
529 break
530 fi
531 done
532 unset dirs
533 fi
534 dnl Now check cf_openssl_found to see if we found anything.
535 if test ! -z "$cf_openssl_basedir"; then
536 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
537 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
538 SSL_LIBS="-L${cf_openssl_basedir}/lib"
539 else
540 dnl OpenSSL wasn't found in the directory specified. Naughty
541 dnl administrator...
542 cf_openssl_basedir=""
543 fi
544 else
545 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
546 dnl are in /usr/include and /usr/lib. In this case, we don't want to
547 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
548 dnl We can't do this check above, because some people want two versions
549 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
550 dnl and they want /usr/local/ssl to have preference.
551 if test -f "/usr/include/openssl/opensslv.h" ; then
552 cf_openssl_basedir="/usr"
553 fi
554 fi
555
556 dnl If we have a basedir defined, then everything is okay. Otherwise,
557 dnl we have a problem.
558 if test ! -z "$cf_openssl_basedir"; then
559 AC_MSG_RESULT($cf_openssl_basedir)
560 cf_enable_openssl="yes"
561 else
562 AC_MSG_RESULT([not found. Specify a correct path?])
563 cf_enable_openssl="no"
564 fi
565 unset cf_openssl_basedir
566 else
567 dnl If --disable-openssl was specified
568 AC_MSG_RESULT(disabled)
569 fi
570
571 save_CPPFLAGS="$CPPFLAGS"
572 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
573 save_LIBS="$LIBS"
574 LIBS="$LIBS $SSL_LIBS"
575 if test "$cf_enable_openssl" != no; then
576 dnl Check OpenSSL version (must be 0.9.6 or above!)
577 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
578 AC_RUN_IFELSE(
579 AC_LANG_PROGRAM(
580 [#include <openssl/opensslv.h>
581 #include <stdlib.h>],
582 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
583 exit(0); else exit(1);]]),
584 cf_openssl_version_ok=yes,
585 cf_openssl_version_ok=no,
586 cf_openssl_version_ok=no)
587
588 if test "$cf_openssl_version_ok" = yes; then
589 AC_MSG_RESULT(found)
590
591 dnl Work around pmake/gmake conditional incompatibilities
592 AC_SUBST(ENCSPEED, encspeed)
593
594 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
595 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
596 AC_CHECK_LIB(crypto, RSA_free)
597 SSL_LIBS="$SSL_LIBS -lcrypto"
598 SSL_SRCS_ENABLE='$(SSL_SRCS)'
599 else
600 AC_MSG_RESULT(no - OpenSSL support disabled)
601 fi
602 fi
603
604 CPPFLAGS="$save_CPPFLAGS"
605 LIBS="$save_LIBS"
606
607 dnl End OpenSSL detection
608
609
610 dnl Specialized functions and libraries
611 dnl ===================================
612
613 AC_ARG_WITH(zlib-path,
614 AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
615 [LIBS="$LIBS -L$withval"],)
616
617 AC_ARG_ENABLE(zlib,
618 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
619 [zlib=$enableval],[zlib=yes])
620
621 if test "$zlib" = yes; then
622
623 AC_CHECK_HEADER(zlib.h, [
624 AC_CHECK_LIB(z, zlibVersion,
625 [
626 AC_SUBST(ZLIB_LD, -lz)
627 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
628 ], zlib=no)
629 ], zlib=no)
630
631 fi
632
633 dnl IO Loop Selection
634 dnl =================
635
636 AC_ARG_ENABLE(ports, AC_HELP_STRING([--enable-ports],[Force solaris I/O ports subsystem usage.]),
637 [ if test $enableval = yes; then
638 SELECT_TYPE_EXPLICIT="ports"
639 else
640 use_ports=no
641 fi
642 ],)
643
644 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
645 [ if test $enableval = yes; then
646 SELECT_TYPE_EXPLICIT="poll"
647 else
648 use_poll=no
649 fi
650 ],)
651
652 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
653 [ if test $enableval = yes; then
654 SELECT_TYPE_EXPLICIT="select"
655 else
656 use_select=no
657 fi
658 ],)
659
660 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
661 [ if test $enableval = yes; then
662 SELECT_TYPE_EXPLICIT="kqueue"
663 else
664 use_kqueue=no
665 fi
666 ],)
667
668 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
669 [ if test $enableval = yes; then
670 SELECT_TYPE_EXPLICIT="epoll"
671 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
672 else
673 use_epoll=no
674 fi
675 ],)
676
677 dnl **********************************************************************
678 dnl Check for --with-confdir
679 dnl **********************************************************************
680
681 AC_MSG_CHECKING([whether to modify confdir])
682 AC_ARG_WITH(confdir,
683 AC_HELP_STRING([--with-confdir=DIR],
684 [Directory to install config files.]),
685 [ confdir=`echo $withval | sed 's/\/$//'`
686 AC_MSG_RESULT(yes)
687 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
688 AC_SUBST_DIR([confdir]) ],
689 [ confdir='${prefix}/etc'
690 AC_MSG_RESULT(no)
691 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
692 AC_SUBST_DIR([confdir])]
693 )
694
695 dnl **********************************************************************
696 dnl Check for --with-logdir
697 dnl **********************************************************************
698
699 AC_MSG_CHECKING([whether to modify logdir])
700 AC_ARG_WITH(logdir,
701 AC_HELP_STRING([--with-logdir=DIR],
702 [Directory where to write logfiles.]),
703 [ logdir=`echo $withval | sed 's/\/$//'`
704 AC_MSG_RESULT(yes)
705 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
706 AC_SUBST_DIR([logdir]) ],
707 [ logdir='${prefix}/logs'
708 AC_MSG_RESULT(no)
709 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
710 AC_SUBST_DIR([logdir])]
711 )
712
713 dnl **********************************************************************
714 dnl Check for --with-helpdir
715 dnl **********************************************************************
716
717 AC_MSG_CHECKING([whether to modify helpdir])
718 AC_ARG_WITH(helpdir,
719 AC_HELP_STRING([--with-helpdir=DIR],
720 [Directory to install help files.]),
721 [ helpdir=`echo $withval | sed 's/\/$//'`
722 AC_MSG_RESULT(yes)
723 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
724 AC_SUBST_DIR([helpdir]) ],
725 [ helpdir='${prefix}/help'
726 AC_MSG_RESULT(no)
727 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
728 AC_SUBST_DIR([helpdir])]
729 )
730
731 dnl **********************************************************************
732 dnl Check for --with-moduledir
733 dnl **********************************************************************
734
735 AC_MSG_CHECKING([whether to modify moduledir])
736 AC_ARG_WITH(moduledir,
737 AC_HELP_STRING([--with-moduledir=DIR],
738 [Directory to install modules.]),
739 [ moduledir=`echo $withval | sed 's/\/$//'`
740 AC_MSG_RESULT(yes)
741 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
742 AC_SUBST_DIR([moduledir]) ],
743 [ moduledir='${prefix}/modules'
744 AC_MSG_RESULT(no)
745 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
746 AC_SUBST_DIR([moduledir])]
747 )
748
749 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
750 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
751 echo "Forcing $SELECT_TYPE to be enabled"
752 else
753
754 if test ! "x$use_ports" = "xno"; then
755 AC_CHECK_FUNCS(port_getn, [haveports=yes], [haveports=no])
756 if test "x$haveports" = "xyes" ; then
757 SELECT_TYPE="ports"
758 fi
759 fi
760
761 if test ! "x$use_select" = "xno"; then
762 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
763 if test "x$haveselect" = "xyes" ; then
764 SELECT_TYPE="select"
765 fi
766 fi
767
768 if test ! "x$use_poll" = "xno"; then
769 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
770 if test "x$havepoll" = "xyes" ; then
771 SELECT_TYPE="poll"
772 fi
773 fi
774
775 if test ! "x$use_kqueue" = "xno"; then
776 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
777 if test "x$havekqueue" = "xyes" ; then
778 SELECT_TYPE="kqueue"
779 fi
780 fi
781
782 if test ! "x$use_epoll" = "xno"; then
783 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
784 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
785 if test "x$haveepoll" = "xyes" ; then
786 AC_MSG_CHECKING(for epoll support in kernel)
787 AC_TRY_RUN(
788 #include <stdint.h>
789 #include <sys/param.h>
790 #include <sys/types.h>
791 #include <sys/epoll.h>
792 #include <sys/syscall.h>
793 #include <unistd.h>
794
795 int
796 main(int argc, char **argv)
797 {
798 int epfd;
799
800 epfd = epoll_create(256);
801 return (epfd == -1 ? 1 : 0);
802 }, [AC_MSG_RESULT(yes)
803 AC_DEFINE(HAVE_EPOLL, 1,
804 [Define if your system supports the epoll system calls])
805 SELECT_TYPE="epoll"],
806 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
807 fi
808 fi
809
810 haveepollsyscall=no
811
812 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
813 if test "x$haveepoll" = "xno" ; then
814 AC_MSG_CHECKING(for epoll system call)
815 AC_TRY_RUN(
816 #include <stdint.h>
817 #include <sys/param.h>
818 #include <sys/types.h>
819 #include <sys/epoll.h>
820 #include <sys/syscall.h>
821 #include <unistd.h>
822
823 int
824 epoll_create(int size)
825 {
826 return (syscall(__NR_epoll_create, size));
827 }
828
829 int
830 main(int argc, char **argv)
831 {
832 int epfd;
833
834 epfd = epoll_create(256);
835 exit (epfd == -1 ? 1 : 0);
836 }, [AC_MSG_RESULT(yes)
837 AC_DEFINE(HAVE_EPOLL, 1,
838 [Define if your system supports the epoll system calls])
839 SELECT_TYPE="epoll"],
840 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
841 fi
842 fi
843
844 fi
845
846 fi
847
848 if test -z "$SELECT_TYPE"; then
849 AC_MSG_ERROR([Unable to find a usable IO interface],)
850 fi
851
852 echo "Using $SELECT_TYPE for select loop."
853
854 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
855 AC_SUBST(SELECT_TYPE)
856
857
858 dnl Debug-related options
859 dnl =====================
860
861 AC_ARG_ENABLE(assert,
862 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
863 [assert=$enableval], [assert=no])
864
865 if test "$assert" = no; then
866 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
867 elif test "$assert" = soft; then
868 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
869 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
870 elif test "$assert" = yes; then
871 assert = "hard";
872 fi
873
874 AC_MSG_CHECKING(if you want IO Debugging hooks)
875 AC_ARG_ENABLE(iodebug,
876 AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
877 [iodebug=$enableval], [iodebug=no])
878
879 if test "$iodebug" = yes; then
880 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
881 AC_MSG_RESULT(yes)
882 else
883 AC_MSG_RESULT(no)
884 fi
885
886
887 AC_MSG_CHECKING(if you want to do a profile build)
888 AC_ARG_ENABLE(profile,
889 AC_HELP_STRING([--enable-profile],[Enable profiling]),
890 [profile=$enableval], [profile=no])
891
892 if test "$profile" = yes; then
893 if test "$ac_cv_c_compiler_gnu" = yes; then
894 IRC_CFLAGS="$IRC_CFLAGS -pg"
895 AC_MSG_RESULT([yes, adding -pg])
896 AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
897 else
898 AC_MSG_RESULT([no, profile builds only work with gcc])
899 fi
900 else
901 AC_MSG_RESULT(no)
902 fi
903
904 AC_ARG_ENABLE(balloc,
905 AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
906 [balloc=$enableval], [balloc=yes])
907
908 if test "$balloc" = no; then
909 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
910 fi
911
912 AC_ARG_ENABLE(small-net,
913 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
914 [small_net=$enableval], [small_net=no])
915
916 if test "$small_net" = yes; then
917 dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
918 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
919 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
920 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
921 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
922 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
923 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
924 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
925 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
926 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
927 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
928 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
929 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
930 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
931 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
932 AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.])
933 else
934 dnl These settings are for a large network like efnet..they will use lots of memory
935 dnl so enable small net unless you really need this much support
936 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
937 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
938 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
939 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
940 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
941 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
942 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
943 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
944 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
945 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
946 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
947 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
948 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
949 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
950 AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
951 fi
952
953 AC_ARG_WITH(nicklen,
954 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
955 [
956 if test $withval -ge 50; then
957 NICKLEN=50
958 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
959 else
960 NICKLEN="$withval"
961 fi
962 ], [NICKLEN=15])
963
964 AC_ARG_WITH(topiclen,
965 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
966 [
967 if test $withval -ge 390; then
968 TOPICLEN=390
969 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
970 else
971 TOPICLEN=$withval
972 fi
973 ], [TOPICLEN=390])
974
975 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
976 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
977
978 shared_modules="yes"
979 dnl Some first-stage sanity checks.
980 if test "$shared_modules" = yes; then
981
982 if test "$CYGWIN" = yes; then
983 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
984 shared_modules="no"
985 fi
986
987 dnl TenDRA's cc is called tcc too.
988 if test "$CC" = tcc -a "$TenDRA" = "no"; then
989 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
990 shared_modules="no"
991 fi
992 fi
993
994 dnl Second stage: check for functions and headers.
995 if test "$shared_modules" = yes; then
996 DYNLINK_C=dynlink.c
997 AC_CHECK_HEADERS(dlfcn.h)
998 AC_SEARCH_LIBS(shl_load, dld,
999 [
1000 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1001 SUFFIX=".sl"
1002 MOD_TARGET=hpux_shared
1003 SEDOBJ="s/\.o/.sl/g"
1004 ],
1005 dnl !shl_load:
1006 [
1007 dnl standard dlopen
1008 AC_SEARCH_LIBS(dlopen, [dl c_r],
1009 [
1010 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1011 SUFFIX=".so"
1012 MOD_TARGET=shared_modules
1013 SEDOBJ="s/\.o/.so/g"
1014 if test "$AppleGCC" = yes; then
1015 AC_CHECK_HEADERS([mach-o/dyld.h])
1016 fi
1017 AC_CHECK_FUNC(dlsym, ,
1018 [
1019 AC_MSG_WARN([dlsym is not available, shared modules disabled])
1020 shared_modules=no
1021 ])
1022 AC_CHECK_FUNCS(dlfunc)
1023 ],
1024 [
1025 shared_modules=no
1026 ])
1027 ])
1028 fi
1029
1030 AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1031
1032 dnl Third stage - wrangling the linker.
1033 if test "$shared_modules" = yes; then
1034 # The GNU linker requires the -export-dynamic option to make
1035 # all symbols visible in the dynamic symbol table.
1036 hold_ldflags=$LDFLAGS
1037 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1038 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1039 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1040 LDFLAGS=$hold_ldflags
1041
1042 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1043 found="no, IRIX ld uses -B,dynamic"
1044 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1045 fi
1046
1047 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1048 found="no, AIX ld uses -G -brtl"
1049 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1050 fi
1051
1052 AC_MSG_RESULT($found)
1053
1054 if test "$found" = yes; then
1055 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1056 fi
1057
1058 AC_MSG_CHECKING(for compiler option to produce PIC)
1059 dnl The order should be here to check for groups of compilers,
1060 dnl then for odd compilers, then if no PICFLAGS were set up,
1061 dnl check for GCC and set defaults, or else error. -jmallett
1062 if test "$SGS" = "yes"; then
1063 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1064 PICFLAGS="-KPIC -DPIC -G"
1065 fi
1066
1067 if test "$AppleGCC" = "yes"; then
1068 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1069 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1070 fi
1071 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1072 dnl while compiling modules, the compiler does not allow you to give arguments
1073 dnl to the linker. (I did not design this)
1074 dnl So we need -c in the first stage of module compilation.
1075 dnl In the second stage, we link the modules via ld -b.
1076 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1077 dnl -TimeMr14C
1078 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1079 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1080 PICFLAGS="+z -r -q -n -c"
1081 AC_MSG_CHECKING([if +ESfic is required on this platform])
1082
1083 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1084 AC_MSG_RESULT(no)
1085 else
1086 AC_MSG_RESULT(yes)
1087 PICFLAGS="$PICFLAGS +ESfic"
1088 fi
1089
1090 LDFLAGS="${LDFLAGS} -Wl,-E"
1091 fi
1092 if test "$Tru" = yes -a "$CC" != gcc; then
1093 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1094 PICFLAGS="-shared -expect_unresolved '*' "
1095 LDFLAGS="-call_shared"
1096 fi
1097 if test -z "$PICFLAGS"; then
1098 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1099 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1100 PICFLAGS="-fPIC -DPIC -shared"
1101 else
1102 AC_MSG_RESULT(no)
1103 shared_modules=no
1104 fi
1105 fi
1106 fi
1107
1108 # This must be down here, or it will mess up checks like the ones
1109 # for -Wl,-export-dynamic
1110 # -- jilles
1111 AC_ARG_ENABLE(warnings,
1112 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1113 [
1114 IRC_CFLAGS="$IRC_CFLAGS -O0"
1115 CFLAGS="$IRC_CFLAGS"
1116
1117 CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
1118 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
1119 CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
1120 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
1121 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
1122 CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
1123 CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
1124 CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
1125 CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
1126 CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
1127 CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
1128 CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
1129 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
1130 CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
1131 CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast)
1132 CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
1133 CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
1134 CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
1135 CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat=2], charybdis_cv_c_gcc_w_format)
1136 CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic)
1137
1138 IRC_CFLAGS="$CFLAGS"
1139 ],[])
1140
1141 if test "$shared_modules" = no; then
1142 DYNLINK_C=""
1143 MOD_TARGET="libmodules.a"
1144 MODULES_LIBS="../modules/libmodules.a"
1145 SEDOBJ=""
1146 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1147 AC_MSG_WARN([shared module support has been disabled!])
1148 fi
1149
1150 dnl Stage 5 - underscores in front of symbol names.
1151 if test "$shared_modules" = yes; then
1152
1153 AC_CHECK_FUNC(nlist,,
1154 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1155 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1156 )
1157 )
1158
1159 dnl We need to find out whether underscores are appended to symbol
1160 dnl names in executable files. First, though, we need to see
1161 dnl where nlist.h is hiding.
1162 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1163 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1164 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1165 if test x"$nlist_h" = "x"; then
1166 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1167 else
1168 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1169 AC_CACHE_VAL(symbol_underscores,
1170 [
1171 cat << EOF > conftest.c
1172 #include <$nlist_h>
1173 #include <stdio.h>
1174 #include <stdlib.h>
1175 void _modinit(void);
1176 int main(int argc, char *argv[[]]) {
1177 int i;
1178 struct nlist nl[[5]];
1179
1180 /* fill the names in this way, so it'll work almost everywhere */
1181 nl[[0]].n_name = "_modinit";
1182 nl[[1]].n_name = "__modinit";
1183 nl[[2]].n_name = "___modinit";
1184 nl[[3]].n_name = "____modinit";
1185 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1186
1187 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1188 for(i = 0; i < 4; i++) {
1189 if(nl[[i]].n_value != NULL)
1190 {
1191 int j;
1192 for(j = 0; j < i; j++)
1193 printf("_");
1194 exit(i);
1195 }
1196 }
1197 exit(-1);
1198 }
1199 void _modinit(void) { return; }
1200 EOF
1201 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1202 symbol_underscores=`./conftest conftest`
1203 AC_MSG_RESULT($symbol_underscores)
1204 $RM -f conftest conftest.c
1205 ])
1206 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1207 fi
1208 fi
1209
1210 AC_SUBST(MODULES_LIBS)
1211 AC_SUBST(MOD_TARGET)
1212
1213 AC_SUBST(SSL_SRCS_ENABLE)
1214 AC_SUBST(SSL_INCLUDES)
1215 AC_SUBST(SSL_LIBS)
1216
1217 AC_SUBST(LDFLAGS)
1218 AC_SUBST(PICFLAGS)
1219 AC_SUBST(IRC_CFLAGS)
1220 AC_SUBST(SEDOBJ)
1221
1222
1223 if test "$prefix" = "NONE"; then
1224 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1225
1226 else
1227
1228 dnl Don't get bitten by Cygwin's stupidity if the user specified
1229 dnl a custom prefix with a trailing slash
1230
1231 prefix=`echo $prefix | sed 's/\/$//'`
1232 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1233
1234 fi
1235
1236 AC_CONFIG_FILES( \
1237 Makefile \
1238 servlink/Makefile \
1239 extensions/Makefile \
1240 unsupported/Makefile \
1241 src/Makefile \
1242 modules/Makefile \
1243 tools/Makefile \
1244 doc/Makefile \
1245 help/Makefile \
1246 )
1247
1248 AC_OUTPUT
1249
1250 if test "$cf_openssl_version_ok" = yes; then
1251 openssl="yes"
1252 else
1253 openssl="no"
1254 fi
1255
1256 if test "$shared_modules" = yes; then
1257 modules=shared
1258 else
1259 modules=static
1260 fi
1261
1262 echo "
1263 Configuration:
1264 Install directory : $prefix
1265
1266 Ziplinks : $zlib
1267 OpenSSL : $openssl
1268 IPv6 support : $have_v6
1269 Socket Engine : $SELECT_TYPE
1270 Small network : $small_net
1271 Block allocator : $balloc
1272
1273 Nickname length : $NICKLEN
1274 Topic length : $TOPICLEN
1275
1276 Use make to compile Charybdis, then make install to install it.
1277 "