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