1 dnl Process this file with autoconf to produce a configure script.
3 dnl TODO: clean up all the OpenSSL and shared module checking stuff;
4 dnl the most major changes have already been made and it looks like
5 dnl said functions need to be just about as complex as they already are.
8 AC_INIT([ircd-seven],[0.9.0])
9 AC_CONFIG_HEADER(include/setup.h)
10 AC_PREFIX_DEFAULT($HOME/ircd)
15 dnl Checks for programs.
19 dnl Make sure autoconf doesn't interfere with cflags -jmallett
22 dnl Check for various compilers. -jmallett
23 dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk
25 if test "$ac_cv_c_compiler_gnu" != yes; then
28 AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
29 case `$CC -version 2>&1` in
31 AC_MSG_RESULT([yes, TenDRA])
33 CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
38 AC_MSG_RESULT([yes, MIPSpro])
49 AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
51 *Sun*WorkShop* | *Forte*Developer*)
52 AC_MSG_RESULT(Sun Workshop/Forte)
53 IRC_CFLAGS="-fast -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString"
58 AC_MSG_RESULT(Tru64 cc)
60 CPPFLAGS="-I/usr/local/include"
64 AC_MSG_RESULT(HPUX cc)
75 AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
79 dnl only do this if we haven't already detected the newer one
80 dnl and we're not already using gcc
82 if test "$HPUX" != yes -a "$ac_cv_c_compiler_gnu" = no; then
83 AC_MSG_RESULT(assuming old HPUX with its own cc)
84 IRC_CFLAGS="$IRC_CFLAGS +e"
87 AC_MSG_RESULT(already using newer HPUX)
95 AC_MSG_RESULT(SunOS or Solaris)
96 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
100 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
101 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
108 if test "$ac_cv_c_compiler_gnu" = yes; then
109 AC_MSG_CHECKING(if $CC is Apple GCC)
111 case `$CC -v 2>&1 | tail -n 1` in
122 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -Werror-implicit-function-declaration"
125 dnl If we support -g, use it!
126 if test "$ac_cv_prog_cc_g" = yes; then
127 dnl Tru64 needs -g3 for -O2
128 if test "$Tru" = yes; then
129 IRC_CFLAGS="$IRC_CFLAGS -g3"
131 IRC_CFLAGS="$IRC_CFLAGS -g"
135 dnl SVR4 SGS based on what we know about the compiler -jmallett
136 AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces)
137 if test "$SGS" = "yes"; then
143 dnl We prefer gcc -MM because it's a lot less bloated
144 AC_PATH_PROG(MKDEP, mkdep)
145 AC_PATH_PROG(MAKEDEPEND, makedepend)
147 AC_MSG_CHECKING(how to generate dependency info)
151 if test "$ac_cv_c_compiler_gnu" = yes; then
152 AC_MSG_RESULT(gcc -MM)
154 elif test ! -z "$MKDEP"; then
157 dnl Tru64's mkdep is very loud
158 if test -z "$Tru"; then
161 STDOUT=" 2> /dev/null"
163 elif test "$SunWorkShop" = yes; then
164 AC_MSG_RESULT($CC -xM)
166 STDOUT="> .depend 2> /dev/null"
167 elif test ! -z "$MAKEDEPEND"; then
168 AC_MSG_RESULT(makedepend)
169 MKDEP="$MAKEDEPEND -f-"
171 AC_MSG_RESULT([nothing suitable.. forget it!])
178 dnl check for /dev/null so we can use it to hold evil fd's
179 AC_MSG_CHECKING([for /dev/null])
180 if test -c /dev/null ; then
181 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
184 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
185 AC_MSG_RESULT(no - using devnull.log)
188 dnl jdc -- If CFLAGS is defined, best use it everywhere...
189 dnl NOTE: jv says it must be added to the *END*, because things like
190 dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
191 if test ! -z "$CFLAGS"; then
192 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
197 AC_PROG_GCC_TRADITIONAL
204 AC_PATH_PROG(SED, sed)
207 AC_PATH_PROG(RANLIB, ranlib)
208 AC_PATH_PROG(TOUCH, touch)
212 dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
213 if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
214 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
219 if test "$LEX" = ":"; then
220 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
223 dnl use directory structure of cached as default (hack)
224 if test "$libexecdir" = '${exec_prefix}/libexec' &&
225 test "$localstatedir" = '${prefix}/var'; then
226 libexecdir='${bindir}'
227 localstatedir='${prefix}'
230 dnl Checks for header files.
233 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])
235 dnl Stuff that the memory manager (imalloc) depends on
236 dnl ==================================================
239 if test "$ac_cv_header_machine_endian_h" = "no" ; then
244 AC_CHECK_SIZEOF(short)
246 AC_CHECK_SIZEOF(long)
247 AC_CHECK_SIZEOF(long long)
252 AC_MSG_CHECKING([the system's memory page size])
261 FILE *fp = fopen("conftest.malloc", "w");
264 fprintf(fp, "%d\n", getpagesize());
270 if test -f "conftest.malloc" ; then
271 pagesize=`cat conftest.malloc`
274 if test "$pagesize" != "no" ; then
275 AC_MSG_RESULT($pagesize)
277 if test "$ac_cv_sizeof_int" = "4" ; then
282 AC_MSG_RESULT([$pagesize (guessing)])
284 AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize,
285 [the system's memory page size])
287 dnl Networking Functions
288 dnl ====================
290 AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
292 dnl SunOS/Solaris required libnsl for inet_ntoa()
293 if test x"$SUN" = xyes; then
294 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
297 AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len'
298 member.])],,[[#include <sys/types.h>
299 #include <sys/socket.h>
302 AC_CHECK_TYPE(socklen_t, ,
303 [AC_DEFINE([socklen_t], [unsigned int],
304 [If we don't have a real socklen_t, unsigned int is good enough.])],
305 [#include <sys/types.h>
306 #include <sys/socket.h>])
309 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
311 if test $ipv6 != yes; then
314 AC_MSG_CHECKING([for core IPv6 support])
318 [[#define IN_AUTOCONF
319 #include <sys/types.h>
320 #include <sys/socket.h>
321 #include <netinet/in.h>]],
322 [[struct sockaddr_in6 s;
326 if test "$CYGWIN" = "yes"; then
327 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
331 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
333 AC_MSG_CHECKING([for struct in6addr_any])
336 [[#define IN_AUTOCONF
337 #include <sys/types.h>
338 #include <sys/socket.h>
339 #include <netinet/in.h>]],
340 [[struct in6_addr a = in6addr_any;]]
342 [AC_MSG_RESULT(yes)],
345 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
355 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
357 CRYPT_LIB=$ac_cv_search_crypt
359 if test "$CRYPT_LIB" = "none required"; then
361 elif test "$CRYPT_LIB" = no; then
367 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
369 dnl We need one of the above to build viconf. Just a sanity check,
370 dnl we don't want to stop people from building the rest of ircd
371 dnl just because they can't build viconf.
378 dnl See whether we can include both string.h and strings.h.
379 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
380 gcc_cv_header_string,
384 #include <strings.h>],
385 [gcc_cv_header_string=yes],
386 [gcc_cv_header_string=no])
389 if test "$gcc_cv_header_string" = "yes"; then
390 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
395 dnl Check for stdarg.h - if we can't find it, halt configure
396 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
398 dnl Checks for the existence of strlcat, strlcpy, basename...
399 dnl This more reliable test only works with gcc though.
401 if test "$ac_cv_c_compiler_gnu" = yes; then
403 AC_MSG_CHECKING(for strlcpy)
405 CFLAGS="$CFLAGS -Wimplicit -Werror"
409 [[#include <string.h>
410 #include <stdlib.h>]],
411 [[char *a = malloc(6);
412 strlcpy(a, "hello", 6);]]
415 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
419 AC_MSG_CHECKING(for strlcat)
422 [[#include <string.h>
423 #include <stdlib.h>]],
424 [[char *a = malloc(6);
426 strlcat(a, "hello", 6);]]
429 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
437 dnl Better than nothing. The more complicated test above probably fixes powerpc,
440 AC_CHECK_FUNCS([strlcat strlcpy])
444 AC_CHECK_TYPE([u_int32_t], [],
446 AC_CHECK_TYPE([uint32_t],
448 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
451 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
452 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
456 AC_CHECK_TYPE([u_int16_t], [],
458 AC_CHECK_TYPE([uint16_t],
460 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
463 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
464 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
468 AC_CHECK_TYPE([in_port_t], [],
469 [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
470 [[#include <sys/types.h>
471 #include <netinet/in.h>]])
473 AC_CHECK_TYPE([sa_family_t], [],
474 [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
475 [[#include <sys/types.h>
476 #include <sys/socket.h>]])
478 AC_CHECK_TYPES([uintptr_t])
480 dnl check for various functions...
481 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
485 dnl Specialized functions checks
486 dnl ============================
488 dnl check for nanosleep
489 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
491 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
493 if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
495 AC_MSG_RESULT("nanosleep not found..using select for delay")
497 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
501 AC_MSG_CHECKING(for OpenSSL)
502 AC_ARG_ENABLE(openssl,
503 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
504 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
505 [cf_enable_openssl=$enableval],
506 [cf_enable_openssl="auto"])
508 if test "$cf_enable_openssl" != "no" ; then
509 cf_openssl_basedir=""
510 if test "$cf_enable_openssl" != "auto" &&
511 test "$cf_enable_openssl" != "yes" ; then
512 dnl Support for --enable-openssl=/some/place
513 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
515 dnl Do the auto-probe here. Check some common directory paths.
516 for dirs in /usr/local/ssl /usr/pkg /usr/local \
517 /usr/local/openssl ; do
518 if test -f "${dirs}/include/openssl/opensslv.h" ; then
519 cf_openssl_basedir="${dirs}"
525 dnl Now check cf_openssl_found to see if we found anything.
526 if test ! -z "$cf_openssl_basedir"; then
527 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
528 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
529 SSL_LIBS="-L${cf_openssl_basedir}/lib"
531 dnl OpenSSL wasn't found in the directory specified. Naughty
533 cf_openssl_basedir=""
536 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
537 dnl are in /usr/include and /usr/lib. In this case, we don't want to
538 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
539 dnl We can't do this check above, because some people want two versions
540 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
541 dnl and they want /usr/local/ssl to have preference.
542 if test -f "/usr/include/openssl/opensslv.h" ; then
543 cf_openssl_basedir="/usr"
547 dnl If we have a basedir defined, then everything is okay. Otherwise,
548 dnl we have a problem.
549 if test ! -z "$cf_openssl_basedir"; then
550 AC_MSG_RESULT($cf_openssl_basedir)
551 cf_enable_openssl="yes"
553 AC_MSG_RESULT([not found. Specify a correct path?])
554 cf_enable_openssl="no"
556 unset cf_openssl_basedir
558 dnl If --disable-openssl was specified
559 AC_MSG_RESULT(disabled)
562 save_CPPFLAGS="$CPPFLAGS"
563 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
565 LIBS="$LIBS $SSL_LIBS"
566 if test "$cf_enable_openssl" != no; then
567 dnl Check OpenSSL version (must be 0.9.6 or above!)
568 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
571 [#include <openssl/opensslv.h>
572 #include <stdlib.h>],
573 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
574 exit(0); else exit(1);]]),
575 cf_openssl_version_ok=yes,
576 cf_openssl_version_ok=no,
577 cf_openssl_version_ok=no)
579 if test "$cf_openssl_version_ok" = yes; then
582 dnl Work around pmake/gmake conditional incompatibilities
583 AC_SUBST(ENCSPEED, encspeed)
585 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
586 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
587 AC_CHECK_LIB(crypto, RSA_free)
588 SSL_LIBS="$SSL_LIBS -lcrypto"
589 SSL_SRCS_ENABLE='$(SSL_SRCS)'
591 AC_MSG_RESULT(no - OpenSSL support disabled)
595 CPPFLAGS="$save_CPPFLAGS"
598 dnl End OpenSSL detection
601 dnl Specialized functions and libraries
602 dnl ===================================
604 AC_ARG_WITH(zlib-path,
605 AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
606 [LIBS="$LIBS -L$withval"],)
609 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
610 [zlib=$enableval],[zlib=yes])
612 if test "$zlib" = yes; then
614 AC_CHECK_HEADER(zlib.h, [
615 AC_CHECK_LIB(z, zlibVersion,
617 AC_SUBST(ZLIB_LD, -lz)
618 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
624 dnl IO Loop Selection
625 dnl =================
627 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
628 [ if test $enableval = yes; then
629 SELECT_TYPE_EXPLICIT="poll"
635 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
636 [ if test $enableval = yes; then
637 SELECT_TYPE_EXPLICIT="select"
643 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
644 [ if test $enableval = yes; then
645 SELECT_TYPE_EXPLICIT="kqueue"
651 AC_ARG_ENABLE(devpoll,AC_HELP_STRING([--enable-devpoll],[Force usage of /dev/poll.]),
652 [ if test $enableval = yes; then
653 SELECT_TYPE_EXPLICIT="devpoll"
654 dnl These need to be defined or not defined
655 AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])
661 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
662 [ if test $enableval = yes; then
663 SELECT_TYPE_EXPLICIT="epoll"
669 dnl **********************************************************************
670 dnl Check for --with-confdir
671 dnl **********************************************************************
673 AC_MSG_CHECKING([whether to modify confdir])
675 AC_HELP_STRING([--with-confdir=DIR],
676 [Directory to install config files.]),
677 [ confdir=`echo $withval | sed 's/\/$//'`
679 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
680 AC_SUBST_DIR([confdir]) ],
681 [ confdir='${prefix}/etc'
683 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
684 AC_SUBST_DIR([confdir])]
687 dnl **********************************************************************
688 dnl Check for --with-logdir
689 dnl **********************************************************************
691 AC_MSG_CHECKING([whether to modify logdir])
693 AC_HELP_STRING([--with-logdir=DIR],
694 [Directory where to write logfiles.]),
695 [ logdir=`echo $withval | sed 's/\/$//'`
697 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
698 AC_SUBST_DIR([logdir]) ],
699 [ logdir='${prefix}/logs'
701 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
702 AC_SUBST_DIR([logdir])]
705 dnl **********************************************************************
706 dnl Check for --with-helpdir
707 dnl **********************************************************************
709 AC_MSG_CHECKING([whether to modify helpdir])
711 AC_HELP_STRING([--with-helpdir=DIR],
712 [Directory to install help files.]),
713 [ helpdir=`echo $withval | sed 's/\/$//'`
715 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
716 AC_SUBST_DIR([helpdir]) ],
717 [ helpdir='${prefix}/help'
719 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
720 AC_SUBST_DIR([helpdir])]
723 dnl **********************************************************************
724 dnl Check for --with-moduledir
725 dnl **********************************************************************
727 AC_MSG_CHECKING([whether to modify moduledir])
728 AC_ARG_WITH(moduledir,
729 AC_HELP_STRING([--with-moduledir=DIR],
730 [Directory to install modules.]),
731 [ moduledir=`echo $withval | sed 's/\/$//'`
733 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
734 AC_SUBST_DIR([moduledir]) ],
735 [ moduledir='${prefix}/modules'
737 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
738 AC_SUBST_DIR([moduledir])]
741 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
742 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
743 echo "Forcing $SELECT_TYPE to be enabled"
746 if test ! "x$use_select" = "xno"; then
747 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
748 if test "x$haveselect" = "xyes" ; then
753 if test ! "x$use_poll" = "xno"; then
754 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
755 if test "x$havepoll" = "xyes" ; then
760 if test ! "x$use_devpoll" = "xno"; then
761 AC_MSG_CHECKING(for /dev/poll)
762 if test -c "/dev/poll"; then
764 AC_CHECK_HEADERS([devpoll.h sys/devpoll.h])
765 SELECT_TYPE="devpoll"
771 if test ! "x$use_kqueue" = "xno"; then
772 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
773 if test "x$havekqueue" = "xyes" ; then
778 if test ! "x$use_epoll" = "xno"; then
779 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
780 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
781 if test "x$haveepoll" = "xyes" ; then
782 AC_MSG_CHECKING(for epoll support in kernel)
785 #include <sys/param.h>
786 #include <sys/types.h>
787 #include <sys/epoll.h>
788 #include <sys/syscall.h>
792 main(int argc, char **argv)
796 epfd = epoll_create(256);
797 exit (epfd == -1 ? 1 : 0);
798 }, [AC_MSG_RESULT(yes)
799 AC_DEFINE(HAVE_EPOLL, 1,
800 [Define if your system supports the epoll system calls])
801 SELECT_TYPE="epoll"],
802 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
808 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
809 if test "x$haveepoll" = "xno" ; then
810 AC_MSG_CHECKING(for epoll system call)
813 #include <sys/param.h>
814 #include <sys/types.h>
815 #include <sys/epoll.h>
816 #include <sys/syscall.h>
820 epoll_create(int size)
822 return (syscall(__NR_epoll_create, size));
826 main(int argc, char **argv)
830 epfd = epoll_create(256);
831 exit (epfd == -1 ? 1 : 0);
832 }, [AC_MSG_RESULT(yes)
833 AC_DEFINE(HAVE_EPOLL, 1,
834 [Define if your system supports the epoll system calls])
835 SELECT_TYPE="epoll"],
836 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
844 if test -z "$SELECT_TYPE"; then
845 AC_MSG_ERROR([Unable to find a usable IO interface],)
848 echo "Using $SELECT_TYPE for select loop."
850 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
851 AC_SUBST(SELECT_TYPE)
854 dnl Debug-related options
855 dnl =====================
857 AC_ARG_ENABLE(assert,
858 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
859 [assert=$enableval], [assert=no])
861 if test "$assert" = no; then
862 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
863 elif test "$assert" = soft; then
864 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
865 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
866 elif test "$assert" = yes; then
870 AC_MSG_CHECKING(if you want IO Debugging hooks)
871 AC_ARG_ENABLE(iodebug,
872 AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
873 [iodebug=$enableval], [iodebug=no])
875 if test "$iodebug" = yes; then
876 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
883 AC_MSG_CHECKING(if you want to do a profile build)
884 AC_ARG_ENABLE(profile,
885 AC_HELP_STRING([--enable-profile],[Enable profiling]),
886 [profile=$enableval], [profile=no])
888 if test "$profile" = yes; then
889 if test "$ac_cv_c_compiler_gnu" = yes; then
890 IRC_CFLAGS="$IRC_CFLAGS -pg"
891 AC_MSG_RESULT([yes, adding -pg])
892 AC_DEFINE(SEVEN_PROFILE, 1, [Define this if you are profiling.])
894 AC_MSG_RESULT([no, profile builds only work with gcc])
900 AC_ARG_ENABLE(balloc,
901 AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
902 [balloc=$enableval], [balloc=yes])
904 if test "$balloc" = no; then
905 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
908 AC_ARG_ENABLE(small-net,
909 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
910 [small_net=$enableval], [small_net=no])
912 if test "$small_net" = yes; then
913 dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
914 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
915 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
916 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
917 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
918 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
919 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
920 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
921 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
922 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
923 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
924 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
925 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
926 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
927 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
929 dnl These settings are for a large network like efnet..they will use lots of memory
930 dnl so enable small net unless you really need this much support
931 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
932 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
933 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
934 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
935 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
936 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
937 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
938 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
939 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
940 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
941 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
942 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
943 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
944 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
948 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
950 if test $withval -ge 50; then
952 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
958 AC_ARG_WITH(topiclen,
959 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
961 if test $withval -ge 390; then
963 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
969 AC_ARG_WITH(maxclients,
970 AC_HELP_STRING([--with-maxclients=NUMBER],[Maximum number of connections the ircd can handle]),
971 MAX_CLIENTS="$withval", MAX_CLIENTS=3000)
974 if test "$MAX_CLIENTS" = yes; then
978 if test $MAX_CLIENTS -gt 65536; then
980 AC_MSG_WARN([Max connections cannot be larger than 65536!])
983 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
984 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
985 AC_DEFINE_UNQUOTED(MAX_CLIENTS, ${MAX_CLIENTS}, [Maximum number of network connections])
987 AC_ARG_ENABLE(shared-modules,
988 AC_HELP_STRING([--disable-shared-modules],[ Disable shared modules.]),
989 [shared_modules=$enableval], [shared_modules="yes"])
991 dnl Some first-stage sanity checks.
992 if test "$shared_modules" = yes; then
994 if test "$CYGWIN" = yes; then
995 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
999 dnl TenDRA's cc is called tcc too.
1000 if test "$CC" = tcc -a "$TenDRA" = "no"; then
1001 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
1006 dnl Second stage: check for functions and headers.
1007 if test "$shared_modules" = yes; then
1009 AC_CHECK_HEADERS(dlfcn.h)
1010 AC_SEARCH_LIBS(shl_load, dld,
1012 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1014 MOD_TARGET=hpux_shared
1015 SEDOBJ="s/\.o/.sl/g"
1020 AC_SEARCH_LIBS(dlopen, [dl c_r],
1022 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1024 MOD_TARGET=shared_modules
1025 SEDOBJ="s/\.o/.so/g"
1026 if test "$AppleGCC" = yes; then
1027 AC_CHECK_HEADERS([mach-o/dyld.h])
1029 AC_CHECK_FUNC(dlsym, ,
1031 AC_MSG_WARN([dlsym is not available, shared modules disabled])
1034 AC_CHECK_FUNCS(dlfunc)
1042 AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1044 dnl Third stage - wrangling the linker.
1045 if test "$shared_modules" = yes; then
1046 # The GNU linker requires the -export-dynamic option to make
1047 # all symbols visible in the dynamic symbol table.
1048 hold_ldflags=$LDFLAGS
1049 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1050 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1051 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1052 LDFLAGS=$hold_ldflags
1054 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1055 found="no, IRIX ld uses -B,dynamic"
1056 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1059 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1060 found="no, AIX ld uses -G -brtl"
1061 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1064 AC_MSG_RESULT($found)
1066 if test "$found" = yes; then
1067 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1070 AC_MSG_CHECKING(for compiler option to produce PIC)
1071 dnl The order should be here to check for groups of compilers,
1072 dnl then for odd compilers, then if no PICFLAGS were set up,
1073 dnl check for GCC and set defaults, or else error. -jmallett
1074 if test "$SGS" = "yes"; then
1075 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1076 PICFLAGS="-KPIC -DPIC -G"
1079 if test "$AppleGCC" = "yes"; then
1080 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1081 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1083 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1084 dnl while compiling modules, the compiler does not allow you to give arguments
1085 dnl to the linker. (I did not design this)
1086 dnl So we need -c in the first stage of module compilation.
1087 dnl In the second stage, we link the modules via ld -b.
1088 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1090 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1091 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1092 PICFLAGS="+z -r -q -n -c"
1093 AC_MSG_CHECKING([if +ESfic is required on this platform])
1095 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1099 PICFLAGS="$PICFLAGS +ESfic"
1102 LDFLAGS="${LDFLAGS} -Wl,-E"
1104 if test "$Tru" = yes -a "$CC" != gcc; then
1105 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1106 PICFLAGS="-shared -expect_unresolved '*' "
1107 LDFLAGS="-call_shared"
1109 if test -z "$PICFLAGS"; then
1110 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1111 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1112 PICFLAGS="-fPIC -DPIC -shared"
1120 # This must be down here, or it will mess up checks like the ones
1121 # for -Wl,-export-dynamic
1123 AC_ARG_ENABLE(warnings,
1124 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1126 IRC_CFLAGS="$IRC_CFLAGS -O0"
1127 CFLAGS="$IRC_CFLAGS"
1129 SEVEN_C_GCC_TRY_FLAGS([-Wall], seven_cv_c_gcc_w_all)
1130 SEVEN_C_GCC_TRY_FLAGS([-Wpointer-arith], seven_cv_c_gcc_w_pointer_arith)
1131 SEVEN_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], seven_cv_c_gcc_w_implicit)
1132 SEVEN_C_GCC_TRY_FLAGS([-Wcast-align], seven_cv_c_gcc_w_cast_align)
1133 SEVEN_C_GCC_TRY_FLAGS([-Wcast-qual], seven_cv_c_gcc_w_cast_qual)
1134 SEVEN_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], seven_cv_c_gcc_prototypes)
1135 SEVEN_C_GCC_TRY_FLAGS([-Wparenthesis], seven_cv_c_gcc_parenthesis)
1136 SEVEN_C_GCC_TRY_FLAGS([-W -Wno-unused], seven_cv_c_gcc_w)
1137 SEVEN_C_GCC_TRY_FLAGS([-Wextra], seven_cv_c_gcc_w_extra)
1138 SEVEN_C_GCC_TRY_FLAGS([-Wshadow], seven_cv_c_gcc_w_shadow)
1139 SEVEN_C_GCC_TRY_FLAGS([-Wmissing-noreturn], seven_cv_c_gcc_w_missing_noreturn)
1140 SEVEN_C_GCC_TRY_FLAGS([-Wundef], seven_cv_c_gcc_w_undef)
1141 SEVEN_C_GCC_TRY_FLAGS([-Wpacked], seven_cv_c_gcc_w_packed)
1142 SEVEN_C_GCC_TRY_FLAGS([-Wnested-externs], seven_cv_c_gcc_w_nested_externs)
1143 SEVEN_C_GCC_TRY_FLAGS([-Wbad-function-cast], seven_cv_c_gcc_w_bad_function_cast)
1144 SEVEN_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], seven_cv_c_gcc_w_unused)
1145 SEVEN_C_GCC_TRY_FLAGS([-Wredundant-decls], seven_cv_c_gcc_w_redundant_decls)
1146 SEVEN_C_GCC_TRY_FLAGS([-Wfloat-equal], seven_cv_c_gcc_w_float_equal)
1147 SEVEN_C_GCC_TRY_FLAGS([-Wformat=2], seven_cv_c_gcc_w_format)
1148 SEVEN_C_GCC_TRY_FLAGS([-pedantic], seven_cv_c_gcc_pedantic)
1150 IRC_CFLAGS="$CFLAGS"
1153 if test "$shared_modules" = no; then
1155 MOD_TARGET="libmodules.a"
1156 MODULES_LIBS="../modules/libmodules.a"
1158 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1159 AC_MSG_WARN([shared module support has been disabled!])
1162 dnl Stage 5 - underscores in front of symbol names.
1163 if test "$shared_modules" = yes; then
1165 AC_CHECK_FUNC(nlist,,
1166 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1167 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1171 dnl We need to find out whether underscores are appended to symbol
1172 dnl names in executable files. First, though, we need to see
1173 dnl where nlist.h is hiding.
1174 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1175 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1176 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1177 if test x"$nlist_h" = "x"; then
1178 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1180 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1181 AC_CACHE_VAL(symbol_underscores,
1183 cat << EOF > conftest.c
1187 void _modinit(void);
1188 int main(int argc, char *argv[[]]) {
1190 struct nlist nl[[5]];
1192 /* fill the names in this way, so it'll work almost everywhere */
1193 nl[[0]].n_name = "_modinit";
1194 nl[[1]].n_name = "__modinit";
1195 nl[[2]].n_name = "___modinit";
1196 nl[[3]].n_name = "____modinit";
1197 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1199 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1200 for(i = 0; i < 4; i++) {
1201 if(nl[[i]].n_value != NULL)
1204 for(j = 0; j < i; j++)
1211 void _modinit(void) { return; }
1213 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1214 symbol_underscores=`./conftest conftest`
1215 AC_MSG_RESULT($symbol_underscores)
1216 $RM -f conftest conftest.c
1218 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1222 AC_SUBST(MODULES_LIBS)
1223 AC_SUBST(MOD_TARGET)
1225 AC_SUBST(SSL_SRCS_ENABLE)
1226 AC_SUBST(SSL_INCLUDES)
1231 AC_SUBST(IRC_CFLAGS)
1235 if test "$prefix" = "NONE"; then
1236 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1240 dnl Don't get bitten by Cygwin's stupidity if the user specified
1241 dnl a custom prefix with a trailing slash
1243 prefix=`echo $prefix | sed 's/\/$//'`
1244 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1252 extensions/Makefile \
1262 if test "$cf_openssl_version_ok" = yes; then
1268 if test "$shared_modules" = yes; then
1276 Install directory : $prefix
1281 IPv6 support : $have_v6
1282 Socket Engine : $SELECT_TYPE
1283 Small network : $small_net
1284 Block allocator : $balloc
1285 ASM hashing code : $ricer_hashing
1287 Nickname length : $NICKLEN
1288 Topic length : $TOPICLEN
1290 Use make to compile ircd-seven, then make install to install it.