1 dnl TODO: clean up all the OpenSSL and shared module checking stuff;
2 dnl the most major changes have already been made and it looks like
3 dnl said functions need to be just about as complex as they already are.
7 AC_INIT([charybdis], [3.6.0-dev])
9 AC_PREFIX_DEFAULT($HOME/ircd)
10 AC_CONFIG_MACRO_DIR([m4])
11 AC_CONFIG_HEADER(include/setup.h)
13 AC_CONFIG_AUX_DIR([libltdl/config])
14 AC_CONFIG_MACRO_DIR([libltdl/m4])
16 AM_SILENT_RULES([yes])
19 LT_INIT([dlopen disable-static])
21 LT_CONFIG_LTDL_DIR([extra/libltdl])
24 build_ltdl=$with_included_ltdl
25 AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"])
27 AC_PROG_CC_C99([], [AC_MSG_ERROR(charybdis requires a C99 capable compiler)])
32 dnl Checks for programs.
36 dnl Make sure autoconf doesn't interfere with cflags -jmallett
39 AC_CONFIG_SUBDIRS(libratbox)
41 if test "$ac_cv_c_compiler_gnu" = yes; then
42 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -std=gnu99"
45 dnl If we support -g, use it!
46 if test "$ac_cv_prog_cc_g" = yes; then
47 IRC_CFLAGS="$IRC_CFLAGS -g"
50 dnl check for /dev/null so we can use it to hold evil fd's
51 AC_MSG_CHECKING([for /dev/null])
52 if test -c /dev/null ; then
53 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
56 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
57 AC_MSG_RESULT(no - using devnull.log)
60 dnl jdc -- If CFLAGS is defined, best use it everywhere...
61 dnl NOTE: jv says it must be added to the *END*, because things like
62 dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
63 if test ! -z "$CFLAGS"; then
64 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
69 AC_PROG_GCC_TRADITIONAL
76 AC_PATH_PROG(SED, sed)
79 AC_PATH_PROG(RANLIB, ranlib)
80 AC_PATH_PROG(TOUCH, touch)
84 dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
85 if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
86 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
91 if test "$LEX" = ":"; then
92 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
95 AC_ARG_ENABLE([fhs-paths],
96 [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
98 [dnl detect if the user appears to want --enable-fhs-paths
99 AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
100 test "$localstatedir" = '${prefix}/var' && \
101 test "$libdir" = '${exec_prefix}/lib'],
102 [enable_fhs_paths=no],
103 [enable_fhs_paths=yes])
105 dnl use directory structure of cached as default (hack)
106 AS_IF([test "x$enable_fhs_paths" = "xyes"],
107 [dnl Avoid name collisions.
108 pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
109 rundir=${rundir-'${prefix}/run'}
110 pkgrundir='${rundir}/${PACKAGE_TARNAME}'
111 pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
112 [libexecdir='${bindir}'
113 pkglibexecdir='${libexecdir}'
114 rundir='${sysconfdir}'
115 pkgrundir='${rundir}'
116 localstatedir='${prefix}'
117 pkglocalstatedir='${sysconfdir}'])
118 pkglibdir='${libdir}/${PACKAGE_TARNAME}'
119 AC_SUBST([pkglibdir])
121 AC_SUBST([pkgrundir])
122 AC_SUBST([pkglocalstatedir])
123 AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]])
124 AC_SUBST([pkglibexecdir])
125 AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
127 dnl Checks for header files.
130 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])
132 dnl Stuff that the memory manager (imalloc) depends on
133 dnl ==================================================
136 if test "$ac_cv_header_machine_endian_h" = "no" ; then
141 AC_CHECK_SIZEOF(short)
143 AC_CHECK_SIZEOF(long)
144 AC_CHECK_SIZEOF(long long)
146 dnl Networking Functions
147 dnl ====================
149 AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
151 dnl SunOS/Solaris required libnsl for inet_ntoa()
152 if test x"$SUN" = xyes; then
153 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
156 AC_CHECK_TYPE(socklen_t, ,
157 [AC_DEFINE([socklen_t], [unsigned int],
158 [If we don't have a real socklen_t, unsigned int is good enough.])],
159 [#include <sys/types.h>
160 #include <sys/socket.h>])
163 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
165 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
167 CRYPT_LIB=$ac_cv_search_crypt
169 if test "$CRYPT_LIB" = "none required"; then
171 elif test "$CRYPT_LIB" = no; then
177 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
179 dnl We need one of the above to build viconf. Just a sanity check,
180 dnl we don't want to stop people from building the rest of ircd
181 dnl just because they can't build viconf.
188 dnl See whether we can include both string.h and strings.h.
189 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
190 gcc_cv_header_string,
194 #include <strings.h>],
195 [gcc_cv_header_string=yes],
196 [gcc_cv_header_string=no])
199 if test "$gcc_cv_header_string" = "yes"; then
200 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
205 dnl Check for stdarg.h - if we can't find it, halt configure
206 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
208 dnl Checks for the existence of strlcat, strlcpy, basename...
209 dnl This more reliable test only works with gcc though.
211 if test "$ac_cv_c_compiler_gnu" = yes; then
213 AC_MSG_CHECKING(for strlcpy)
215 CFLAGS="$CFLAGS -Wimplicit -Werror"
219 [[#include <string.h>
220 #include <stdlib.h>]],
221 [[char *a = malloc(6);
222 strlcpy(a, "hello", 6);]]
225 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
229 AC_MSG_CHECKING(for strlcat)
232 [[#include <string.h>
233 #include <stdlib.h>]],
234 [[char *a = malloc(6);
236 strlcat(a, "hello", 6);]]
239 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
247 dnl Better than nothing. The more complicated test above probably fixes powerpc,
250 AC_CHECK_FUNCS([strlcat strlcpy])
254 AC_CHECK_TYPE([u_int32_t], [],
256 AC_CHECK_TYPE([uint32_t],
258 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
261 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
262 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
266 AC_CHECK_TYPE([u_int16_t], [],
268 AC_CHECK_TYPE([uint16_t],
270 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
273 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
274 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
278 AC_CHECK_TYPE([in_port_t], [],
279 [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
280 [[#include <sys/types.h>
281 #include <netinet/in.h>]])
283 AC_CHECK_TYPE([sa_family_t], [],
284 [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
285 [[#include <sys/types.h>
286 #include <sys/socket.h>]])
288 AC_CHECK_TYPES([uintptr_t])
290 dnl check for various functions...
291 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
295 dnl Specialized functions checks
296 dnl ============================
298 dnl check for nanosleep
299 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
301 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
303 if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
305 AC_MSG_RESULT("nanosleep not found..using select for delay")
307 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
311 AC_MSG_CHECKING(for OpenSSL)
312 AC_ARG_ENABLE(openssl,
313 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
314 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
315 [cf_enable_openssl=$enableval],
316 [cf_enable_openssl="auto"])
318 if test "$cf_enable_openssl" != "no" ; then
319 cf_openssl_basedir=""
320 if test "$cf_enable_openssl" != "auto" &&
321 test "$cf_enable_openssl" != "yes" ; then
322 dnl Support for --enable-openssl=/some/place
323 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
325 dnl Do the auto-probe here. Check some common directory paths.
326 for dirs in /usr/local/ssl /usr/pkg /usr/local \
327 /usr/local/openssl ; do
328 if test -f "${dirs}/include/openssl/opensslv.h" ; then
329 cf_openssl_basedir="${dirs}"
335 dnl Now check cf_openssl_found to see if we found anything.
336 if test ! -z "$cf_openssl_basedir"; then
337 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
338 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
339 SSL_LIBS="-L${cf_openssl_basedir}/lib"
341 dnl OpenSSL wasn't found in the directory specified. Naughty
343 cf_openssl_basedir=""
346 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
347 dnl are in /usr/include and /usr/lib. In this case, we don't want to
348 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
349 dnl We can't do this check above, because some people want two versions
350 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
351 dnl and they want /usr/local/ssl to have preference.
352 if test -f "/usr/include/openssl/opensslv.h" ; then
353 cf_openssl_basedir="/usr"
357 dnl If we have a basedir defined, then everything is okay. Otherwise,
358 dnl we have a problem.
359 if test ! -z "$cf_openssl_basedir"; then
360 AC_MSG_RESULT($cf_openssl_basedir)
361 cf_enable_openssl="yes"
363 AC_MSG_RESULT([not found. Specify a correct path?])
364 cf_enable_openssl="no"
366 unset cf_openssl_basedir
368 dnl If --disable-openssl was specified
369 AC_MSG_RESULT(disabled)
372 save_CPPFLAGS="$CPPFLAGS"
373 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
375 LIBS="$LIBS $SSL_LIBS"
376 if test "$cf_enable_openssl" != no; then
377 dnl Check OpenSSL version (must be 0.9.6 or above!)
378 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
381 [#include <openssl/opensslv.h>
382 #include <stdlib.h>],
383 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
384 exit(0); else exit(1);]]),
385 cf_openssl_version_ok=yes,
386 cf_openssl_version_ok=no,
387 cf_openssl_version_ok=no)
389 if test "$cf_openssl_version_ok" = yes; then
392 dnl Work around pmake/gmake conditional incompatibilities
393 AC_SUBST(ENCSPEED, encspeed)
395 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
396 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
397 AC_CHECK_LIB(crypto, RSA_free)
398 SSL_LIBS="$SSL_LIBS -lcrypto"
399 SSL_SRCS_ENABLE='$(SSL_SRCS)'
401 AC_MSG_RESULT(no - OpenSSL support disabled)
405 CPPFLAGS="$save_CPPFLAGS"
408 dnl End OpenSSL detection
411 dnl Specialized functions and libraries
412 dnl ===================================
414 AC_ARG_WITH(zlib-path,
415 AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
416 [LIBS="$LIBS -L$withval"],)
419 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
420 [zlib=$enableval],[zlib=yes])
422 if test "$zlib" = yes; then
424 AC_CHECK_HEADER(zlib.h, [
425 AC_CHECK_LIB(z, zlibVersion,
427 AC_SUBST(ZLIB_LD, -lz)
428 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
434 dnl Check for shared sqlite
435 dnl ======================
436 AC_ARG_WITH(shared-sqlite,
437 AC_HELP_STRING([--with-shared-sqlite],[Use shared sqlite]),
438 [shared_sqlite=$withval],[shared_sqlite=no])
440 if test "$shared_sqlite" = yes; then
441 PKG_CHECK_MODULES(SQLITE, [sqlite3],
447 if test "$shared_sqlite" = no; then
448 SQLITE_OBJ='sqlite3.$(OBJEXT)'
451 AC_SUBST(SQLITE_LD, "$SQLITE_LIBS")
452 AC_SUBST(SQLITE_INCLUDES, "$SQLITE_CFLAGS")
455 dnl IO Loop Selection
456 dnl =================
458 AC_ARG_ENABLE(ports, AC_HELP_STRING([--enable-ports],[Force solaris I/O ports subsystem usage.]),
459 [ if test $enableval = yes; then
460 SELECT_TYPE_EXPLICIT="ports"
466 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
467 [ if test $enableval = yes; then
468 SELECT_TYPE_EXPLICIT="poll"
474 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
475 [ if test $enableval = yes; then
476 SELECT_TYPE_EXPLICIT="select"
482 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
483 [ if test $enableval = yes; then
484 SELECT_TYPE_EXPLICIT="kqueue"
490 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
491 [ if test $enableval = yes; then
492 SELECT_TYPE_EXPLICIT="epoll"
493 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
499 dnl **********************************************************************
500 dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
501 dnl **********************************************************************
503 AC_ARG_WITH([confdir],
504 [AC_HELP_STRING([--with-confdir=DIR],
505 [Directory to install config files [deprecated, use --sysconfdir instead].])],
506 [ sysconfdir=`echo $withval | sed 's/\/$//'` ],
507 [ confdir='${sysconfdir}' ])
508 AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
510 dnl **********************************************************************
511 dnl Check for --with-logdir
512 dnl **********************************************************************
514 AC_MSG_CHECKING([whether to modify logdir])
516 AC_HELP_STRING([--with-logdir=DIR],
517 [Directory where to write logfiles.]),
518 [ logdir=`echo $withval | sed 's/\/$//'`
520 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
521 [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
522 [logdir='${prefix}/logs'])
524 AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
525 AC_SUBST_DIR([logdir])
527 dnl **********************************************************************
528 dnl Check for --with-helpdir
529 dnl **********************************************************************
531 AC_MSG_CHECKING([whether to modify helpdir])
533 AC_HELP_STRING([--with-helpdir=DIR],
534 [Directory to install help files.]),
535 [ helpdir=`echo $withval | sed 's/\/$//'`
536 AC_MSG_RESULT(yes) ],
537 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
538 [helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
539 [helpdir='${prefix}/help'])
541 AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
542 AC_SUBST_DIR([helpdir])
544 dnl **********************************************************************
545 dnl Check for --with-moduledir
546 dnl **********************************************************************
548 AC_MSG_CHECKING([whether to modify moduledir])
549 AC_ARG_WITH(moduledir,
550 [AC_HELP_STRING([--with-moduledir=DIR],
551 [Directory to install modules.])],
552 [ moduledir=`echo $withval | sed 's/\/$//'`
554 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
555 [moduledir='${pkglibdir}/modules'],
556 [moduledir='${prefix}/modules'])
559 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
560 AC_SUBST_DIR([moduledir])
562 dnl Check for --with-rundir
564 AC_MSG_CHECKING([whether or modify rundir])
565 AC_ARG_WITH([rundir],
566 [AC_HELP_STRING([--with-rundir=DIR],
567 [Directory in which to store pidfile.])],
568 [AC_MSG_RESULT([yes])
569 rundir=`echo $withval | sed 's/\/$//'`],
571 AS_IF([test "x$enable_fhs_paths" = "xyes"],
572 [rundir='${prefix}/run'],
573 [rundir='${sysconfdir}'])])
575 AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
577 dnl Installed utility program prefixes (does not affect binaries
578 dnl installed into pkglibexecdir)
579 AC_MSG_CHECKING([for program prefix])
580 AC_ARG_WITH([program-prefix],
581 [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
582 [test "x$with_program_prefix" = "xno" && with_program_prefix=],
583 [with_program_prefix=])
584 AC_MSG_RESULT(["$with_program_prefix"])
585 PROGRAM_PREFIX="$with_program_prefix"
586 AC_SUBST([PROGRAM_PREFIX])
587 AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
589 dnl **********************************************************************
591 dnl **********************************************************************
593 AC_MSG_CHECKING([whether custom branding is requested])
594 AC_ARG_WITH(custom-branding,
595 AC_HELP_STRING([--with-custom-branding=NAME],
596 [Custom branding name.]),
597 [BRANDING_NAME=$withval
598 AC_MSG_RESULT([yes])],
599 [BRANDING_NAME=$PACKAGE_NAME
603 AC_MSG_CHECKING([whether a custom version is requested])
604 AC_ARG_WITH(custom-version,
605 AC_HELP_STRING([--with-custom-version=NAME],
606 [Custom version branding.]),
607 [BRANDING_VERSION=$withval
608 AC_MSG_RESULT([yes])],
609 [BRANDING_VERSION=$PACKAGE_VERSION
613 AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$BRANDING_NAME"], [Custom branding name.])
614 AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$BRANDING_VERSION"], [Custom branding name.])
616 if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then
617 AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.])
620 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
621 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
622 echo "Forcing $SELECT_TYPE to be enabled"
625 if test ! "x$use_ports" = "xno"; then
626 AC_CHECK_FUNCS(port_getn, [haveports=yes], [haveports=no])
627 if test "x$haveports" = "xyes" ; then
632 if test ! "x$use_select" = "xno"; then
633 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
634 if test "x$haveselect" = "xyes" ; then
639 if test ! "x$use_poll" = "xno"; then
640 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
641 if test "x$havepoll" = "xyes" ; then
646 if test ! "x$use_kqueue" = "xno"; then
647 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
648 if test "x$havekqueue" = "xyes" ; then
653 if test ! "x$use_epoll" = "xno"; then
654 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
655 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
656 if test "x$haveepoll" = "xyes" ; then
657 AC_MSG_CHECKING(for epoll support in kernel)
660 #include <sys/param.h>
661 #include <sys/types.h>
662 #include <sys/epoll.h>
663 #include <sys/syscall.h>
667 main(int argc, char **argv)
671 epfd = epoll_create(256);
672 return (epfd == -1 ? 1 : 0);
673 }, [AC_MSG_RESULT(yes)
674 AC_DEFINE(HAVE_EPOLL, 1,
675 [Define if your system supports the epoll system calls])
676 SELECT_TYPE="epoll"],
677 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
683 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
684 if test "x$haveepoll" = "xno" ; then
685 AC_MSG_CHECKING(for epoll system call)
688 #include <sys/param.h>
689 #include <sys/types.h>
690 #include <sys/epoll.h>
691 #include <sys/syscall.h>
695 epoll_create(int size)
697 return (syscall(__NR_epoll_create, size));
701 main(int argc, char **argv)
705 epfd = epoll_create(256);
706 exit (epfd == -1 ? 1 : 0);
707 }, [AC_MSG_RESULT(yes)
708 AC_DEFINE(HAVE_EPOLL, 1,
709 [Define if your system supports the epoll system calls])
710 SELECT_TYPE="epoll"],
711 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
719 if test -z "$SELECT_TYPE"; then
720 AC_MSG_ERROR([Unable to find a usable IO interface],)
723 echo "Using $SELECT_TYPE for select loop."
725 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
726 AC_SUBST(SELECT_TYPE)
729 dnl Debug-related options
730 dnl =====================
732 AC_ARG_ENABLE(assert,
733 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
734 [assert=$enableval], [assert=no])
736 if test "$assert" = no; then
737 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
738 elif test "$assert" = soft; then
739 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
740 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
741 elif test "$assert" = yes; then
745 AC_MSG_CHECKING(if you want IO Debugging hooks)
746 AC_ARG_ENABLE(iodebug,
747 AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
748 [iodebug=$enableval], [iodebug=no])
750 if test "$iodebug" = yes; then
751 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
758 AC_MSG_CHECKING(if you want to do a profile build)
759 AC_ARG_ENABLE(profile,
760 AC_HELP_STRING([--enable-profile],[Enable profiling]),
761 [profile=$enableval], [profile=no])
763 if test "$profile" = yes; then
764 if test "$ac_cv_c_compiler_gnu" = yes; then
765 IRC_CFLAGS="$IRC_CFLAGS -pg"
766 AC_MSG_RESULT([yes, adding -pg])
767 AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
769 AC_MSG_RESULT([no, profile builds only work with gcc])
775 AC_ARG_ENABLE(balloc,
776 AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
777 [balloc=$enableval], [balloc=yes])
779 if test "$balloc" = no; then
780 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
783 AC_ARG_ENABLE(small-net,
784 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
785 [small_net=$enableval], [small_net=no])
787 if test "$small_net" = yes; then
788 dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
789 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
790 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
791 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
792 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
793 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
794 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
795 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
796 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
797 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
798 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
799 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
800 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
801 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
802 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
803 AC_DEFINE([FD_HEAP_SIZE], 128, [Size of fd heap.])
804 AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.])
806 dnl These settings are for a large network like efnet..they will use lots of memory
807 dnl so enable small net unless you really need this much support
808 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
809 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
810 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
811 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
812 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
813 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
814 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
815 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
816 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
817 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
818 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
819 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
820 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
821 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
822 AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
823 AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
827 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]),
829 if ! expr "$withval" + 0 >/dev/null 2>&1; then
830 AC_ERROR([NICKLEN must be a numeric value])
832 if test $withval -gt 50; then
834 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
835 elif test $withval -lt 9; then
837 AC_MSG_WARN([NICKLEN has a lower limit of 9. Setting NICKLEN=9])
843 AC_ARG_WITH(topiclen,
844 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
846 if test $withval -ge 390; then
848 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
854 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
855 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
857 # rpath, for finding libratbox.so at run time
858 hold_ldflags=$LDFLAGS
859 AC_MSG_CHECKING(for the ld -rpath flag)
860 LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}"
861 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
862 LDFLAGS=$hold_ldflags
863 AC_MSG_RESULT($found)
864 if test "$found" = yes; then
865 LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}"
868 # This must be down here, or it will mess up checks like the ones
869 # for -Wl,-export-dynamic
872 AC_ARG_ENABLE(warnings,
873 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
875 IRC_CFLAGS="$IRC_CFLAGS -O0"
878 CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
879 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
880 CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
881 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
882 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
883 CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings)
884 CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration)
885 CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
886 CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
887 CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
888 CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
889 CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
890 CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
891 CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
892 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
893 CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
894 CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
895 CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
896 CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
897 CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format)
902 IRC_CFLAGS="$IRC_CFLAGS $CWARNS"
904 AC_SUBST(MODULES_LIBS)
907 AC_SUBST(SSL_SRCS_ENABLE)
908 AC_SUBST(SSL_INCLUDES)
917 if test "$prefix" = "NONE"; then
918 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
922 dnl Don't get bitten by Cygwin's stupidity if the user specified
923 dnl a custom prefix with a trailing slash
925 prefix=`echo $prefix | sed 's/\/$//'`
926 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
935 extensions/Makefile \
943 AC_CONFIG_COMMANDS([tools/genssl_chmod], [chmod 755 tools/genssl])
947 if test "$cf_openssl_version_ok" = yes; then
954 Configuration of ${BRANDING_NAME}-${BRANDING_VERSION}:
955 Install directory : $prefix
959 Socket Engine : $SELECT_TYPE
960 Small network : $small_net
961 Block allocator : $balloc
963 Nickname length : $NICKLEN
964 Topic length : $TOPICLEN
966 Use (g)make to compile $BRANDING_NAME, then (g)make install to install it.