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.
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.
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 $])
13 AC_INIT([charybdis],[3.0.0-alpha1])
15 AC_CONFIG_HEADER(include/setup.h)
17 AC_PREFIX_DEFAULT($HOME/ircd)
22 dnl Checks for programs.
26 dnl Make sure autoconf doesn't interfere with cflags -jmallett
29 AC_CONFIG_SUBDIRS(libratbox)
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
34 if test "$ac_cv_c_compiler_gnu" != yes; then
37 AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
38 case `$CC -version 2>&1` in
40 AC_MSG_RESULT([yes, TenDRA])
42 CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
47 AC_MSG_RESULT([yes, MIPSpro])
58 AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
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"
67 AC_MSG_RESULT(Tru64 cc)
69 CPPFLAGS="-I/usr/local/include"
73 AC_MSG_RESULT(HPUX cc)
84 AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
88 dnl only do this if we haven't already detected the newer one
89 dnl and we're not already using gcc
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"
96 AC_MSG_RESULT(already using newer HPUX)
100 AC_MSG_RESULT(Cygwin)
104 AC_MSG_RESULT(SunOS or Solaris)
105 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
109 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
110 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
117 if test "$ac_cv_c_compiler_gnu" = yes; then
118 AC_MSG_CHECKING(if $CC is Apple GCC)
120 case `$CC -v 2>&1 | tail -n 1` in
131 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
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"
140 IRC_CFLAGS="$IRC_CFLAGS -g"
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
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)
156 AC_MSG_CHECKING(how to generate dependency info)
160 if test "$ac_cv_c_compiler_gnu" = yes; then
161 AC_MSG_RESULT(gcc -MM)
163 elif test ! -z "$MKDEP"; then
166 dnl Tru64's mkdep is very loud
167 if test -z "$Tru"; then
170 STDOUT=" 2> /dev/null"
172 elif test "$SunWorkShop" = yes; then
173 AC_MSG_RESULT($CC -xM)
175 STDOUT="> .depend 2> /dev/null"
176 elif test ! -z "$MAKEDEPEND"; then
177 AC_MSG_RESULT(makedepend)
178 MKDEP="$MAKEDEPEND -f-"
180 AC_MSG_RESULT([nothing suitable.. forget it!])
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])
193 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
194 AC_MSG_RESULT(no - using devnull.log)
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"
206 AC_PROG_GCC_TRADITIONAL
213 AC_PATH_PROG(SED, sed)
216 AC_PATH_PROG(RANLIB, ranlib)
217 AC_PATH_PROG(TOUCH, touch)
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])
228 if test "$LEX" = ":"; then
229 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
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}'
239 dnl Checks for header files.
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])
244 dnl Stuff that the memory manager (imalloc) depends on
245 dnl ==================================================
248 if test "$ac_cv_header_machine_endian_h" = "no" ; then
253 AC_CHECK_SIZEOF(short)
255 AC_CHECK_SIZEOF(long)
256 AC_CHECK_SIZEOF(long long)
261 AC_MSG_CHECKING([the system's memory page size])
270 FILE *fp = fopen("conftest.malloc", "w");
273 fprintf(fp, "%d\n", getpagesize());
279 if test -f "conftest.malloc" ; then
280 pagesize=`cat conftest.malloc`
283 if test "$pagesize" != "no" ; then
284 AC_MSG_RESULT($pagesize)
286 if test "$ac_cv_sizeof_int" = "4" ; then
291 AC_MSG_RESULT([$pagesize (guessing)])
293 AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize,
294 [the system's memory page size])
296 dnl Networking Functions
297 dnl ====================
299 AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
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.])])
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>
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>])
318 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
320 if test $ipv6 != yes; then
323 AC_MSG_CHECKING([for core IPv6 support])
327 [[#define IN_AUTOCONF
328 #include <sys/types.h>
329 #include <sys/socket.h>
330 #include <netinet/in.h>]],
331 [[struct sockaddr_in6 s;
335 if test "$CYGWIN" = "yes"; then
336 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
340 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
342 AC_MSG_CHECKING([for struct in6addr_any])
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;]]
351 [AC_MSG_RESULT(yes)],
354 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
364 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
366 CRYPT_LIB=$ac_cv_search_crypt
368 if test "$CRYPT_LIB" = "none required"; then
370 elif test "$CRYPT_LIB" = no; then
376 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
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.
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,
393 #include <strings.h>],
394 [gcc_cv_header_string=yes],
395 [gcc_cv_header_string=no])
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])
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 **])])
407 dnl Checks for the existence of strlcat, strlcpy, basename...
408 dnl This more reliable test only works with gcc though.
410 if test "$ac_cv_c_compiler_gnu" = yes; then
412 AC_MSG_CHECKING(for strlcpy)
414 CFLAGS="$CFLAGS -Wimplicit -Werror"
418 [[#include <string.h>
419 #include <stdlib.h>]],
420 [[char *a = malloc(6);
421 strlcpy(a, "hello", 6);]]
424 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
428 AC_MSG_CHECKING(for strlcat)
431 [[#include <string.h>
432 #include <stdlib.h>]],
433 [[char *a = malloc(6);
435 strlcat(a, "hello", 6);]]
438 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
446 dnl Better than nothing. The more complicated test above probably fixes powerpc,
449 AC_CHECK_FUNCS([strlcat strlcpy])
453 AC_CHECK_TYPE([u_int32_t], [],
455 AC_CHECK_TYPE([uint32_t],
457 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
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.])
465 AC_CHECK_TYPE([u_int16_t], [],
467 AC_CHECK_TYPE([uint16_t],
469 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
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.])
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>]])
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>]])
487 AC_CHECK_TYPES([uintptr_t])
489 dnl check for various functions...
490 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
494 dnl Specialized functions checks
495 dnl ============================
497 dnl check for nanosleep
498 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
500 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
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
504 AC_MSG_RESULT("nanosleep not found..using select for delay")
506 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
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"])
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/\/$//'`"
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}"
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"
540 dnl OpenSSL wasn't found in the directory specified. Naughty
542 cf_openssl_basedir=""
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"
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"
562 AC_MSG_RESULT([not found. Specify a correct path?])
563 cf_enable_openssl="no"
565 unset cf_openssl_basedir
567 dnl If --disable-openssl was specified
568 AC_MSG_RESULT(disabled)
571 save_CPPFLAGS="$CPPFLAGS"
572 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
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)
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)
588 if test "$cf_openssl_version_ok" = yes; then
591 dnl Work around pmake/gmake conditional incompatibilities
592 AC_SUBST(ENCSPEED, encspeed)
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)'
600 AC_MSG_RESULT(no - OpenSSL support disabled)
604 CPPFLAGS="$save_CPPFLAGS"
607 dnl End OpenSSL detection
610 dnl Specialized functions and libraries
611 dnl ===================================
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"],)
618 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
619 [zlib=$enableval],[zlib=yes])
621 if test "$zlib" = yes; then
623 AC_CHECK_HEADER(zlib.h, [
624 AC_CHECK_LIB(z, zlibVersion,
626 AC_SUBST(ZLIB_LD, -lz)
627 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
633 dnl IO Loop Selection
634 dnl =================
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"
644 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
645 [ if test $enableval = yes; then
646 SELECT_TYPE_EXPLICIT="poll"
652 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
653 [ if test $enableval = yes; then
654 SELECT_TYPE_EXPLICIT="select"
660 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
661 [ if test $enableval = yes; then
662 SELECT_TYPE_EXPLICIT="kqueue"
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])
677 dnl **********************************************************************
678 dnl Check for --with-confdir
679 dnl **********************************************************************
681 AC_MSG_CHECKING([whether to modify confdir])
683 AC_HELP_STRING([--with-confdir=DIR],
684 [Directory to install config files.]),
685 [ confdir=`echo $withval | sed 's/\/$//'`
687 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
688 AC_SUBST_DIR([confdir]) ],
689 [ confdir='${prefix}/etc'
691 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
692 AC_SUBST_DIR([confdir])]
695 dnl **********************************************************************
696 dnl Check for --with-logdir
697 dnl **********************************************************************
699 AC_MSG_CHECKING([whether to modify logdir])
701 AC_HELP_STRING([--with-logdir=DIR],
702 [Directory where to write logfiles.]),
703 [ logdir=`echo $withval | sed 's/\/$//'`
705 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
706 AC_SUBST_DIR([logdir]) ],
707 [ logdir='${prefix}/logs'
709 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
710 AC_SUBST_DIR([logdir])]
713 dnl **********************************************************************
714 dnl Check for --with-helpdir
715 dnl **********************************************************************
717 AC_MSG_CHECKING([whether to modify helpdir])
719 AC_HELP_STRING([--with-helpdir=DIR],
720 [Directory to install help files.]),
721 [ helpdir=`echo $withval | sed 's/\/$//'`
723 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
724 AC_SUBST_DIR([helpdir]) ],
725 [ helpdir='${prefix}/help'
727 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
728 AC_SUBST_DIR([helpdir])]
731 dnl **********************************************************************
732 dnl Check for --with-moduledir
733 dnl **********************************************************************
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/\/$//'`
741 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
742 AC_SUBST_DIR([moduledir]) ],
743 [ moduledir='${prefix}/modules'
745 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
746 AC_SUBST_DIR([moduledir])]
749 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
750 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
751 echo "Forcing $SELECT_TYPE to be enabled"
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
761 if test ! "x$use_select" = "xno"; then
762 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
763 if test "x$haveselect" = "xyes" ; then
768 if test ! "x$use_poll" = "xno"; then
769 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
770 if test "x$havepoll" = "xyes" ; then
775 if test ! "x$use_kqueue" = "xno"; then
776 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
777 if test "x$havekqueue" = "xyes" ; then
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)
789 #include <sys/param.h>
790 #include <sys/types.h>
791 #include <sys/epoll.h>
792 #include <sys/syscall.h>
796 main(int argc, char **argv)
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))
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)
817 #include <sys/param.h>
818 #include <sys/types.h>
819 #include <sys/epoll.h>
820 #include <sys/syscall.h>
824 epoll_create(int size)
826 return (syscall(__NR_epoll_create, size));
830 main(int argc, char **argv)
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))
848 if test -z "$SELECT_TYPE"; then
849 AC_MSG_ERROR([Unable to find a usable IO interface],)
852 echo "Using $SELECT_TYPE for select loop."
854 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
855 AC_SUBST(SELECT_TYPE)
858 dnl Debug-related options
859 dnl =====================
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])
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
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])
879 if test "$iodebug" = yes; then
880 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
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])
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.])
898 AC_MSG_RESULT([no, profile builds only work with gcc])
904 AC_ARG_ENABLE(balloc,
905 AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
906 [balloc=$enableval], [balloc=yes])
908 if test "$balloc" = no; then
909 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
912 AC_ARG_ENABLE(small-net,
913 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
914 [small_net=$enableval], [small_net=no])
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([FD_HEAP_SIZE], 128, [Size of fd heap.])
933 AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.])
935 dnl These settings are for a large network like efnet..they will use lots of memory
936 dnl so enable small net unless you really need this much support
937 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
938 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
939 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
940 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
941 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
942 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
943 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
944 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
945 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
946 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
947 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
948 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
949 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
950 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
951 AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
952 AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
956 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
958 if test $withval -ge 50; then
960 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
966 AC_ARG_WITH(topiclen,
967 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
969 if test $withval -ge 390; then
971 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
977 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
978 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
981 dnl Some first-stage sanity checks.
982 if test "$shared_modules" = yes; then
984 if test "$CYGWIN" = yes; then
985 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
989 dnl TenDRA's cc is called tcc too.
990 if test "$CC" = tcc -a "$TenDRA" = "no"; then
991 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
996 dnl Second stage: check for functions and headers.
997 if test "$shared_modules" = yes; then
999 AC_CHECK_HEADERS(dlfcn.h)
1000 AC_SEARCH_LIBS(shl_load, dld,
1002 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1004 MOD_TARGET=hpux_shared
1005 SEDOBJ="s/\.o/.sl/g"
1010 AC_SEARCH_LIBS(dlopen, [dl c_r],
1012 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1014 MOD_TARGET=shared_modules
1015 SEDOBJ="s/\.o/.so/g"
1016 if test "$AppleGCC" = yes; then
1017 AC_CHECK_HEADERS([mach-o/dyld.h])
1019 AC_CHECK_FUNC(dlsym, ,
1021 AC_MSG_WARN([dlsym is not available, shared modules disabled])
1024 AC_CHECK_FUNCS(dlfunc)
1032 AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1034 dnl Third stage - wrangling the linker.
1035 if test "$shared_modules" = yes; then
1036 # The GNU linker requires the -export-dynamic option to make
1037 # all symbols visible in the dynamic symbol table.
1038 hold_ldflags=$LDFLAGS
1039 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1040 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1041 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1042 LDFLAGS=$hold_ldflags
1044 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1045 found="no, IRIX ld uses -B,dynamic"
1046 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1049 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1050 found="no, AIX ld uses -G -brtl"
1051 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1054 AC_MSG_RESULT($found)
1056 if test "$found" = yes; then
1057 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1060 AC_MSG_CHECKING(for compiler option to produce PIC)
1061 dnl The order should be here to check for groups of compilers,
1062 dnl then for odd compilers, then if no PICFLAGS were set up,
1063 dnl check for GCC and set defaults, or else error. -jmallett
1064 if test "$SGS" = "yes"; then
1065 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1066 PICFLAGS="-KPIC -DPIC -G"
1069 if test "$AppleGCC" = "yes"; then
1070 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1071 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1073 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1074 dnl while compiling modules, the compiler does not allow you to give arguments
1075 dnl to the linker. (I did not design this)
1076 dnl So we need -c in the first stage of module compilation.
1077 dnl In the second stage, we link the modules via ld -b.
1078 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1080 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1081 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1082 PICFLAGS="+z -r -q -n -c"
1083 AC_MSG_CHECKING([if +ESfic is required on this platform])
1085 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1089 PICFLAGS="$PICFLAGS +ESfic"
1092 LDFLAGS="${LDFLAGS} -Wl,-E"
1094 if test "$Tru" = yes -a "$CC" != gcc; then
1095 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1096 PICFLAGS="-shared -expect_unresolved '*' "
1097 LDFLAGS="-call_shared"
1099 if test -z "$PICFLAGS"; then
1100 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1101 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1102 PICFLAGS="-fPIC -DPIC -shared"
1110 # This must be down here, or it will mess up checks like the ones
1111 # for -Wl,-export-dynamic
1113 AC_ARG_ENABLE(warnings,
1114 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1116 IRC_CFLAGS="$IRC_CFLAGS -O0"
1117 CFLAGS="$IRC_CFLAGS"
1119 CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
1120 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
1121 CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
1122 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
1123 CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
1124 CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
1125 CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
1126 CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
1127 CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
1128 CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
1129 CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
1130 CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
1131 CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
1132 CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
1133 CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast)
1134 CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
1135 CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
1136 CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
1137 CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat=2], charybdis_cv_c_gcc_w_format)
1138 CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic)
1140 IRC_CFLAGS="$CFLAGS"
1143 if test "$shared_modules" = no; then
1145 MOD_TARGET="libmodules.a"
1146 MODULES_LIBS="../modules/libmodules.a"
1148 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1149 AC_MSG_WARN([shared module support has been disabled!])
1152 dnl Stage 5 - underscores in front of symbol names.
1153 if test "$shared_modules" = yes; then
1155 AC_CHECK_FUNC(nlist,,
1156 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1157 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1161 dnl We need to find out whether underscores are appended to symbol
1162 dnl names in executable files. First, though, we need to see
1163 dnl where nlist.h is hiding.
1164 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1165 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1166 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1167 if test x"$nlist_h" = "x"; then
1168 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1170 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1171 AC_CACHE_VAL(symbol_underscores,
1173 cat << EOF > conftest.c
1177 void _modinit(void);
1178 int main(int argc, char *argv[[]]) {
1180 struct nlist nl[[5]];
1182 /* fill the names in this way, so it'll work almost everywhere */
1183 nl[[0]].n_name = "_modinit";
1184 nl[[1]].n_name = "__modinit";
1185 nl[[2]].n_name = "___modinit";
1186 nl[[3]].n_name = "____modinit";
1187 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1189 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1190 for(i = 0; i < 4; i++) {
1191 if(nl[[i]].n_value != NULL)
1194 for(j = 0; j < i; j++)
1201 void _modinit(void) { return; }
1203 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1204 symbol_underscores=`./conftest conftest`
1205 AC_MSG_RESULT($symbol_underscores)
1206 $RM -f conftest conftest.c
1208 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1212 AC_SUBST(MODULES_LIBS)
1213 AC_SUBST(MOD_TARGET)
1215 AC_SUBST(SSL_SRCS_ENABLE)
1216 AC_SUBST(SSL_INCLUDES)
1221 AC_SUBST(IRC_CFLAGS)
1225 if test "$prefix" = "NONE"; then
1226 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1230 dnl Don't get bitten by Cygwin's stupidity if the user specified
1231 dnl a custom prefix with a trailing slash
1233 prefix=`echo $prefix | sed 's/\/$//'`
1234 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1241 extensions/Makefile \
1242 unsupported/Makefile \
1252 if test "$cf_openssl_version_ok" = yes; then
1258 if test "$shared_modules" = yes; then
1266 Install directory : $prefix
1270 IPv6 support : $have_v6
1271 Socket Engine : $SELECT_TYPE
1272 Small network : $small_net
1273 Block allocator : $balloc
1275 Nickname length : $NICKLEN
1276 Topic length : $TOPICLEN
1278 Use make to compile Charybdis, then make install to install it.