1 dnl $Id: configure.ac 183 2006-12-18 03:08:31Z beu $
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.
9 AC_INIT([ircd-seven],[0.9.0])
10 AC_CONFIG_HEADER(include/setup.h)
11 AC_PREFIX_DEFAULT($HOME/ircd)
16 dnl Checks for programs.
20 dnl Make sure autoconf doesn't interfere with cflags -jmallett
23 dnl Check for various compilers. -jmallett
24 dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk
26 if test "$ac_cv_c_compiler_gnu" != yes; then
29 AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
30 case `$CC -version 2>&1` in
32 AC_MSG_RESULT([yes, TenDRA])
34 CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
39 AC_MSG_RESULT([yes, MIPSpro])
50 AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
52 *Sun*WorkShop* | *Forte*Developer*)
53 AC_MSG_RESULT(Sun Workshop/Forte)
54 IRC_CFLAGS="-fast -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString"
59 AC_MSG_RESULT(Tru64 cc)
61 CPPFLAGS="-I/usr/local/include"
65 AC_MSG_RESULT(HPUX cc)
76 AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
80 dnl only do this if we haven't already detected the newer one
81 dnl and we're not already using gcc
83 if test "$HPUX" != yes -a "$ac_cv_c_compiler_gnu" = no; then
84 AC_MSG_RESULT(assuming old HPUX with its own cc)
85 IRC_CFLAGS="$IRC_CFLAGS +e"
88 AC_MSG_RESULT(already using newer HPUX)
96 AC_MSG_RESULT(SunOS or Solaris)
97 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
101 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
102 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
109 if test "$ac_cv_c_compiler_gnu" = yes; then
110 AC_MSG_CHECKING(if $CC is Apple GCC)
112 case `$CC -v 2>&1 | tail -n 1` in
123 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -Werror-implicit-function-declaration"
126 dnl If we support -g, use it!
127 if test "$ac_cv_prog_cc_g" = yes; then
128 dnl Tru64 needs -g3 for -O2
129 if test "$Tru" = yes; then
130 IRC_CFLAGS="$IRC_CFLAGS -g3"
132 IRC_CFLAGS="$IRC_CFLAGS -g"
136 dnl SVR4 SGS based on what we know about the compiler -jmallett
137 AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces)
138 if test "$SGS" = "yes"; then
144 dnl We prefer gcc -MM because it's a lot less bloated
145 AC_PATH_PROG(MKDEP, mkdep)
146 AC_PATH_PROG(MAKEDEPEND, makedepend)
148 AC_MSG_CHECKING(how to generate dependency info)
152 if test "$ac_cv_c_compiler_gnu" = yes; then
153 AC_MSG_RESULT(gcc -MM)
155 elif test ! -z "$MKDEP"; then
158 dnl Tru64's mkdep is very loud
159 if test -z "$Tru"; then
162 STDOUT=" 2> /dev/null"
164 elif test "$SunWorkShop" = yes; then
165 AC_MSG_RESULT($CC -xM)
167 STDOUT="> .depend 2> /dev/null"
168 elif test ! -z "$MAKEDEPEND"; then
169 AC_MSG_RESULT(makedepend)
170 MKDEP="$MAKEDEPEND -f-"
172 AC_MSG_RESULT([nothing suitable.. forget it!])
179 dnl check for /dev/null so we can use it to hold evil fd's
180 AC_MSG_CHECKING([for /dev/null])
181 if test -c /dev/null ; then
182 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
185 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
186 AC_MSG_RESULT(no - using devnull.log)
189 dnl jdc -- If CFLAGS is defined, best use it everywhere...
190 dnl NOTE: jv says it must be added to the *END*, because things like
191 dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
192 if test ! -z "$CFLAGS"; then
193 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
198 AC_PROG_GCC_TRADITIONAL
205 AC_PATH_PROG(SED, sed)
208 AC_PATH_PROG(RANLIB, ranlib)
209 AC_PATH_PROG(TOUCH, touch)
213 dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
214 if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
215 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
220 if test "$LEX" = ":"; then
221 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
224 dnl use directory structure of cached as default (hack)
225 if test "$libexecdir" = '${exec_prefix}/libexec' &&
226 test "$localstatedir" = '${prefix}/var'; then
227 libexecdir='${bindir}'
228 localstatedir='${prefix}'
231 dnl Checks for header files.
234 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])
236 dnl Stuff that the memory manager (imalloc) depends on
237 dnl ==================================================
240 if test "$ac_cv_header_machine_endian_h" = "no" ; then
245 AC_CHECK_SIZEOF(short)
247 AC_CHECK_SIZEOF(long)
248 AC_CHECK_SIZEOF(long long)
253 AC_MSG_CHECKING([the system's memory page size])
262 FILE *fp = fopen("conftest.malloc", "w");
265 fprintf(fp, "%d\n", getpagesize());
271 if test -f "conftest.malloc" ; then
272 pagesize=`cat conftest.malloc`
275 if test "$pagesize" != "no" ; then
276 AC_MSG_RESULT($pagesize)
278 if test "$ac_cv_sizeof_int" = "4" ; then
283 AC_MSG_RESULT([$pagesize (guessing)])
285 AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize,
286 [the system's memory page size])
288 dnl Networking Functions
289 dnl ====================
291 AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
293 dnl SunOS/Solaris required libnsl for inet_ntoa()
294 if test x"$SUN" = xyes; then
295 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
298 AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len'
299 member.])],,[[#include <sys/types.h>
300 #include <sys/socket.h>
303 AC_CHECK_TYPE(socklen_t, ,
304 [AC_DEFINE([socklen_t], [unsigned int],
305 [If we don't have a real socklen_t, unsigned int is good enough.])],
306 [#include <sys/types.h>
307 #include <sys/socket.h>])
310 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
312 if test $ipv6 != yes; then
315 AC_MSG_CHECKING([for core IPv6 support])
319 [[#define IN_AUTOCONF
320 #include <sys/types.h>
321 #include <sys/socket.h>
322 #include <netinet/in.h>]],
323 [[struct sockaddr_in6 s;
327 if test "$CYGWIN" = "yes"; then
328 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
332 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
334 AC_MSG_CHECKING([for struct in6addr_any])
337 [[#define IN_AUTOCONF
338 #include <sys/types.h>
339 #include <sys/socket.h>
340 #include <netinet/in.h>]],
341 [[struct in6_addr a = in6addr_any;]]
343 [AC_MSG_RESULT(yes)],
346 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
356 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
358 CRYPT_LIB=$ac_cv_search_crypt
360 if test "$CRYPT_LIB" = "none required"; then
362 elif test "$CRYPT_LIB" = no; then
368 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
370 dnl We need one of the above to build viconf. Just a sanity check,
371 dnl we don't want to stop people from building the rest of ircd
372 dnl just because they can't build viconf.
379 dnl See whether we can include both string.h and strings.h.
380 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
381 gcc_cv_header_string,
385 #include <strings.h>],
386 [gcc_cv_header_string=yes],
387 [gcc_cv_header_string=no])
390 if test "$gcc_cv_header_string" = "yes"; then
391 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
396 dnl Check for stdarg.h - if we can't find it, halt configure
397 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
399 dnl Checks for the existence of strlcat, strlcpy, basename...
400 dnl This more reliable test only works with gcc though.
402 if test "$ac_cv_c_compiler_gnu" = yes; then
404 AC_MSG_CHECKING(for strlcpy)
406 CFLAGS="$CFLAGS -Wimplicit -Werror"
410 [[#include <string.h>
411 #include <stdlib.h>]],
412 [[char *a = malloc(6);
413 strlcpy(a, "hello", 6);]]
416 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
420 AC_MSG_CHECKING(for strlcat)
423 [[#include <string.h>
424 #include <stdlib.h>]],
425 [[char *a = malloc(6);
427 strlcat(a, "hello", 6);]]
430 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
438 dnl Better than nothing. The more complicated test above probably fixes powerpc,
441 AC_CHECK_FUNCS([strlcat strlcpy])
445 AC_CHECK_TYPE([u_int32_t], [],
447 AC_CHECK_TYPE([uint32_t],
449 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
452 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
453 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
457 AC_CHECK_TYPE([u_int16_t], [],
459 AC_CHECK_TYPE([uint16_t],
461 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
464 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
465 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
469 AC_CHECK_TYPE([in_port_t], [],
470 [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
471 [[#include <sys/types.h>
472 #include <netinet/in.h>]])
474 AC_CHECK_TYPE([sa_family_t], [],
475 [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
476 [[#include <sys/types.h>
477 #include <sys/socket.h>]])
479 AC_CHECK_TYPES([uintptr_t])
481 dnl check for various functions...
482 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
486 dnl Specialized functions checks
487 dnl ============================
489 dnl check for nanosleep
490 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
492 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
494 if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
496 AC_MSG_RESULT("nanosleep not found..using select for delay")
498 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
502 AC_MSG_CHECKING(for OpenSSL)
503 AC_ARG_ENABLE(openssl,
504 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
505 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
506 [cf_enable_openssl=$enableval],
507 [cf_enable_openssl="auto"])
509 if test "$cf_enable_openssl" != "no" ; then
510 cf_openssl_basedir=""
511 if test "$cf_enable_openssl" != "auto" &&
512 test "$cf_enable_openssl" != "yes" ; then
513 dnl Support for --enable-openssl=/some/place
514 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
516 dnl Do the auto-probe here. Check some common directory paths.
517 for dirs in /usr/local/ssl /usr/pkg /usr/local \
518 /usr/local/openssl ; do
519 if test -f "${dirs}/include/openssl/opensslv.h" ; then
520 cf_openssl_basedir="${dirs}"
526 dnl Now check cf_openssl_found to see if we found anything.
527 if test ! -z "$cf_openssl_basedir"; then
528 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
529 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
530 SSL_LIBS="-L${cf_openssl_basedir}/lib"
532 dnl OpenSSL wasn't found in the directory specified. Naughty
534 cf_openssl_basedir=""
537 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
538 dnl are in /usr/include and /usr/lib. In this case, we don't want to
539 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
540 dnl We can't do this check above, because some people want two versions
541 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
542 dnl and they want /usr/local/ssl to have preference.
543 if test -f "/usr/include/openssl/opensslv.h" ; then
544 cf_openssl_basedir="/usr"
548 dnl If we have a basedir defined, then everything is okay. Otherwise,
549 dnl we have a problem.
550 if test ! -z "$cf_openssl_basedir"; then
551 AC_MSG_RESULT($cf_openssl_basedir)
552 cf_enable_openssl="yes"
554 AC_MSG_RESULT([not found. Specify a correct path?])
555 cf_enable_openssl="no"
557 unset cf_openssl_basedir
559 dnl If --disable-openssl was specified
560 AC_MSG_RESULT(disabled)
563 save_CPPFLAGS="$CPPFLAGS"
564 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
566 LIBS="$LIBS $SSL_LIBS"
567 if test "$cf_enable_openssl" != no; then
568 dnl Check OpenSSL version (must be 0.9.6 or above!)
569 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
572 [#include <openssl/opensslv.h>
573 #include <stdlib.h>],
574 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
575 exit(0); else exit(1);]]),
576 cf_openssl_version_ok=yes,
577 cf_openssl_version_ok=no,
578 cf_openssl_version_ok=no)
580 if test "$cf_openssl_version_ok" = yes; then
583 dnl Work around pmake/gmake conditional incompatibilities
584 AC_SUBST(ENCSPEED, encspeed)
586 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
587 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
588 AC_CHECK_LIB(crypto, RSA_free)
589 SSL_LIBS="$SSL_LIBS -lcrypto"
590 SSL_SRCS_ENABLE='$(SSL_SRCS)'
592 AC_MSG_RESULT(no - OpenSSL support disabled)
596 CPPFLAGS="$save_CPPFLAGS"
599 dnl End OpenSSL detection
602 dnl Specialized functions and libraries
603 dnl ===================================
605 AC_ARG_WITH(zlib-path,
606 AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
607 [LIBS="$LIBS -L$withval"],)
610 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
611 [zlib=$enableval],[zlib=yes])
613 if test "$zlib" = yes; then
615 AC_CHECK_HEADER(zlib.h, [
616 AC_CHECK_LIB(z, zlibVersion,
618 AC_SUBST(ZLIB_LD, -lz)
619 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
625 dnl IO Loop Selection
626 dnl =================
628 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
629 [ if test $enableval = yes; then
630 SELECT_TYPE_EXPLICIT="poll"
636 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
637 [ if test $enableval = yes; then
638 SELECT_TYPE_EXPLICIT="select"
644 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
645 [ if test $enableval = yes; then
646 SELECT_TYPE_EXPLICIT="kqueue"
652 AC_ARG_ENABLE(devpoll,AC_HELP_STRING([--enable-devpoll],[Force usage of /dev/poll.]),
653 [ if test $enableval = yes; then
654 SELECT_TYPE_EXPLICIT="devpoll"
655 dnl These need to be defined or not defined
656 AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])
662 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
663 [ if test $enableval = yes; then
664 SELECT_TYPE_EXPLICIT="epoll"
670 dnl **********************************************************************
671 dnl Check for --with-confdir
672 dnl **********************************************************************
674 AC_MSG_CHECKING([whether to modify confdir])
676 AC_HELP_STRING([--with-confdir=DIR],
677 [Directory to install config files.]),
678 [ confdir=`echo $withval | sed 's/\/$//'`
680 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
681 AC_SUBST_DIR([confdir]) ],
682 [ confdir='${prefix}/etc'
684 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
685 AC_SUBST_DIR([confdir])]
688 dnl **********************************************************************
689 dnl Check for --with-logdir
690 dnl **********************************************************************
692 AC_MSG_CHECKING([whether to modify logdir])
694 AC_HELP_STRING([--with-logdir=DIR],
695 [Directory where to write logfiles.]),
696 [ logdir=`echo $withval | sed 's/\/$//'`
698 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
699 AC_SUBST_DIR([logdir]) ],
700 [ logdir='${prefix}/logs'
702 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
703 AC_SUBST_DIR([logdir])]
706 dnl **********************************************************************
707 dnl Check for --with-helpdir
708 dnl **********************************************************************
710 AC_MSG_CHECKING([whether to modify helpdir])
712 AC_HELP_STRING([--with-helpdir=DIR],
713 [Directory to install help files.]),
714 [ helpdir=`echo $withval | sed 's/\/$//'`
716 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
717 AC_SUBST_DIR([helpdir]) ],
718 [ helpdir='${prefix}/help'
720 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
721 AC_SUBST_DIR([helpdir])]
724 dnl **********************************************************************
725 dnl Check for --with-moduledir
726 dnl **********************************************************************
728 AC_MSG_CHECKING([whether to modify moduledir])
729 AC_ARG_WITH(moduledir,
730 AC_HELP_STRING([--with-moduledir=DIR],
731 [Directory to install modules.]),
732 [ moduledir=`echo $withval | sed 's/\/$//'`
734 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
735 AC_SUBST_DIR([moduledir]) ],
736 [ moduledir='${prefix}/modules'
738 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
739 AC_SUBST_DIR([moduledir])]
742 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
743 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
744 echo "Forcing $SELECT_TYPE to be enabled"
747 if test ! "x$use_select" = "xno"; then
748 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
749 if test "x$haveselect" = "xyes" ; then
754 if test ! "x$use_poll" = "xno"; then
755 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
756 if test "x$havepoll" = "xyes" ; then
761 if test ! "x$use_devpoll" = "xno"; then
762 AC_MSG_CHECKING(for /dev/poll)
763 if test -c "/dev/poll"; then
765 AC_CHECK_HEADERS([devpoll.h sys/devpoll.h])
766 SELECT_TYPE="devpoll"
772 if test ! "x$use_kqueue" = "xno"; then
773 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
774 if test "x$havekqueue" = "xyes" ; then
779 if test ! "x$use_epoll" = "xno"; then
780 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
781 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
782 if test "x$haveepoll" = "xyes" ; then
783 AC_MSG_CHECKING(for epoll support in kernel)
786 #include <sys/param.h>
787 #include <sys/types.h>
788 #include <sys/epoll.h>
789 #include <sys/syscall.h>
793 main(int argc, char **argv)
797 epfd = epoll_create(256);
798 exit (epfd == -1 ? 1 : 0);
799 }, [AC_MSG_RESULT(yes)
800 AC_DEFINE(HAVE_EPOLL, 1,
801 [Define if your system supports the epoll system calls])
802 SELECT_TYPE="epoll"],
803 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
809 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
810 if test "x$haveepoll" = "xno" ; then
811 AC_MSG_CHECKING(for epoll system call)
814 #include <sys/param.h>
815 #include <sys/types.h>
816 #include <sys/epoll.h>
817 #include <sys/syscall.h>
821 epoll_create(int size)
823 return (syscall(__NR_epoll_create, size));
827 main(int argc, char **argv)
831 epfd = epoll_create(256);
832 exit (epfd == -1 ? 1 : 0);
833 }, [AC_MSG_RESULT(yes)
834 AC_DEFINE(HAVE_EPOLL, 1,
835 [Define if your system supports the epoll system calls])
836 SELECT_TYPE="epoll"],
837 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
845 if test -z "$SELECT_TYPE"; then
846 AC_MSG_ERROR([Unable to find a usable IO interface],)
849 echo "Using $SELECT_TYPE for select loop."
851 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
852 AC_SUBST(SELECT_TYPE)
855 dnl Debug-related options
856 dnl =====================
858 AC_ARG_ENABLE(assert,
859 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
860 [assert=$enableval], [assert=no])
862 if test "$assert" = no; then
863 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
864 elif test "$assert" = soft; then
865 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
866 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
867 elif test "$assert" = yes; then
871 AC_MSG_CHECKING(if you want IO Debugging hooks)
872 AC_ARG_ENABLE(iodebug,
873 AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
874 [iodebug=$enableval], [iodebug=no])
876 if test "$iodebug" = yes; then
877 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
884 AC_MSG_CHECKING(if you want to do a profile build)
885 AC_ARG_ENABLE(profile,
886 AC_HELP_STRING([--enable-profile],[Enable profiling]),
887 [profile=$enableval], [profile=no])
889 if test "$profile" = yes; then
890 if test "$ac_cv_c_compiler_gnu" = yes; then
891 IRC_CFLAGS="$IRC_CFLAGS -pg"
892 AC_MSG_RESULT([yes, adding -pg])
893 AC_DEFINE(SEVEN_PROFILE, 1, [Define this if you are profiling.])
895 AC_MSG_RESULT([no, profile builds only work with gcc])
901 AC_ARG_ENABLE(balloc,
902 AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
903 [balloc=$enableval], [balloc=yes])
905 if test "$balloc" = no; then
906 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
909 AC_ARG_ENABLE(small-net,
910 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
911 [small_net=$enableval], [small_net=no])
913 if test "$small_net" = yes; then
914 dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
915 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
916 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
917 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
918 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
919 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
920 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
921 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
922 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
923 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
924 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
925 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
926 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
927 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
928 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
930 dnl These settings are for a large network like efnet..they will use lots of memory
931 dnl so enable small net unless you really need this much support
932 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
933 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
934 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
935 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
936 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
937 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
938 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
939 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
940 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
941 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
942 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
943 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
944 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
945 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
949 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
951 if test $withval -ge 50; then
953 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
959 AC_ARG_WITH(topiclen,
960 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
962 if test $withval -ge 390; then
964 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
970 AC_ARG_WITH(maxclients,
971 AC_HELP_STRING([--with-maxclients=NUMBER],[Maximum number of connections the ircd can handle]),
972 MAX_CLIENTS="$withval", MAX_CLIENTS=3000)
975 if test "$MAX_CLIENTS" = yes; then
979 if test $MAX_CLIENTS -gt 65536; then
981 AC_MSG_WARN([Max connections cannot be larger than 65536!])
984 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
985 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
986 AC_DEFINE_UNQUOTED(MAX_CLIENTS, ${MAX_CLIENTS}, [Maximum number of network connections])
988 AC_ARG_ENABLE(shared-modules,
989 AC_HELP_STRING([--disable-shared-modules],[ Disable shared modules.]),
990 [shared_modules=$enableval], [shared_modules="yes"])
992 dnl Some first-stage sanity checks.
993 if test "$shared_modules" = yes; then
995 if test "$CYGWIN" = yes; then
996 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
1000 dnl TenDRA's cc is called tcc too.
1001 if test "$CC" = tcc -a "$TenDRA" = "no"; then
1002 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
1007 dnl Second stage: check for functions and headers.
1008 if test "$shared_modules" = yes; then
1010 AC_CHECK_HEADERS(dlfcn.h)
1011 AC_SEARCH_LIBS(shl_load, dld,
1013 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1015 MOD_TARGET=hpux_shared
1016 SEDOBJ="s/\.o/.sl/g"
1021 AC_SEARCH_LIBS(dlopen, [dl c_r],
1023 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1025 MOD_TARGET=shared_modules
1026 SEDOBJ="s/\.o/.so/g"
1027 if test "$AppleGCC" = yes; then
1028 AC_CHECK_HEADERS([mach-o/dyld.h])
1030 AC_CHECK_FUNC(dlsym, ,
1032 AC_MSG_WARN([dlsym is not available, shared modules disabled])
1035 AC_CHECK_FUNCS(dlfunc)
1043 AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1045 dnl Third stage - wrangling the linker.
1046 if test "$shared_modules" = yes; then
1047 # The GNU linker requires the -export-dynamic option to make
1048 # all symbols visible in the dynamic symbol table.
1049 hold_ldflags=$LDFLAGS
1050 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1051 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1052 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1053 LDFLAGS=$hold_ldflags
1055 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1056 found="no, IRIX ld uses -B,dynamic"
1057 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1060 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1061 found="no, AIX ld uses -G -brtl"
1062 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1065 AC_MSG_RESULT($found)
1067 if test "$found" = yes; then
1068 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1071 AC_MSG_CHECKING(for compiler option to produce PIC)
1072 dnl The order should be here to check for groups of compilers,
1073 dnl then for odd compilers, then if no PICFLAGS were set up,
1074 dnl check for GCC and set defaults, or else error. -jmallett
1075 if test "$SGS" = "yes"; then
1076 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1077 PICFLAGS="-KPIC -DPIC -G"
1080 if test "$AppleGCC" = "yes"; then
1081 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1082 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1084 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1085 dnl while compiling modules, the compiler does not allow you to give arguments
1086 dnl to the linker. (I did not design this)
1087 dnl So we need -c in the first stage of module compilation.
1088 dnl In the second stage, we link the modules via ld -b.
1089 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1091 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1092 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1093 PICFLAGS="+z -r -q -n -c"
1094 AC_MSG_CHECKING([if +ESfic is required on this platform])
1096 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1100 PICFLAGS="$PICFLAGS +ESfic"
1103 LDFLAGS="${LDFLAGS} -Wl,-E"
1105 if test "$Tru" = yes -a "$CC" != gcc; then
1106 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1107 PICFLAGS="-shared -expect_unresolved '*' "
1108 LDFLAGS="-call_shared"
1110 if test -z "$PICFLAGS"; then
1111 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1112 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1113 PICFLAGS="-fPIC -DPIC -shared"
1121 # This must be down here, or it will mess up checks like the ones
1122 # for -Wl,-export-dynamic
1124 AC_ARG_ENABLE(warnings,
1125 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1127 IRC_CFLAGS="$IRC_CFLAGS -O0"
1128 CFLAGS="$IRC_CFLAGS"
1130 SEVEN_C_GCC_TRY_FLAGS([-Wall], seven_cv_c_gcc_w_all)
1131 SEVEN_C_GCC_TRY_FLAGS([-Wpointer-arith], seven_cv_c_gcc_w_pointer_arith)
1132 SEVEN_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], seven_cv_c_gcc_w_implicit)
1133 SEVEN_C_GCC_TRY_FLAGS([-Wcast-align], seven_cv_c_gcc_w_cast_align)
1134 SEVEN_C_GCC_TRY_FLAGS([-Wcast-qual], seven_cv_c_gcc_w_cast_qual)
1135 SEVEN_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], seven_cv_c_gcc_prototypes)
1136 SEVEN_C_GCC_TRY_FLAGS([-Wparenthesis], seven_cv_c_gcc_parenthesis)
1137 SEVEN_C_GCC_TRY_FLAGS([-W -Wno-unused], seven_cv_c_gcc_w)
1138 SEVEN_C_GCC_TRY_FLAGS([-Wextra], seven_cv_c_gcc_w_extra)
1139 SEVEN_C_GCC_TRY_FLAGS([-Wshadow], seven_cv_c_gcc_w_shadow)
1140 SEVEN_C_GCC_TRY_FLAGS([-Wmissing-noreturn], seven_cv_c_gcc_w_missing_noreturn)
1141 SEVEN_C_GCC_TRY_FLAGS([-Wundef], seven_cv_c_gcc_w_undef)
1142 SEVEN_C_GCC_TRY_FLAGS([-Wpacked], seven_cv_c_gcc_w_packed)
1143 SEVEN_C_GCC_TRY_FLAGS([-Wnested-externs], seven_cv_c_gcc_w_nested_externs)
1144 SEVEN_C_GCC_TRY_FLAGS([-Wbad-function-cast], seven_cv_c_gcc_w_bad_function_cast)
1145 SEVEN_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], seven_cv_c_gcc_w_unused)
1146 SEVEN_C_GCC_TRY_FLAGS([-Wredundant-decls], seven_cv_c_gcc_w_redundant_decls)
1147 SEVEN_C_GCC_TRY_FLAGS([-Wfloat-equal], seven_cv_c_gcc_w_float_equal)
1148 SEVEN_C_GCC_TRY_FLAGS([-Wformat=2], seven_cv_c_gcc_w_format)
1149 SEVEN_C_GCC_TRY_FLAGS([-pedantic], seven_cv_c_gcc_pedantic)
1151 IRC_CFLAGS="$CFLAGS"
1154 if test "$shared_modules" = no; then
1156 MOD_TARGET="libmodules.a"
1157 MODULES_LIBS="../modules/libmodules.a"
1159 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1160 AC_MSG_WARN([shared module support has been disabled!])
1163 dnl Stage 5 - underscores in front of symbol names.
1164 if test "$shared_modules" = yes; then
1166 AC_CHECK_FUNC(nlist,,
1167 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1168 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1172 dnl We need to find out whether underscores are appended to symbol
1173 dnl names in executable files. First, though, we need to see
1174 dnl where nlist.h is hiding.
1175 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1176 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1177 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1178 if test x"$nlist_h" = "x"; then
1179 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1181 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1182 AC_CACHE_VAL(symbol_underscores,
1184 cat << EOF > conftest.c
1188 void _modinit(void);
1189 int main(int argc, char *argv[[]]) {
1191 struct nlist nl[[5]];
1193 /* fill the names in this way, so it'll work almost everywhere */
1194 nl[[0]].n_name = "_modinit";
1195 nl[[1]].n_name = "__modinit";
1196 nl[[2]].n_name = "___modinit";
1197 nl[[3]].n_name = "____modinit";
1198 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1200 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1201 for(i = 0; i < 4; i++) {
1202 if(nl[[i]].n_value != NULL)
1205 for(j = 0; j < i; j++)
1212 void _modinit(void) { return; }
1214 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1215 symbol_underscores=`./conftest conftest`
1216 AC_MSG_RESULT($symbol_underscores)
1217 $RM -f conftest conftest.c
1219 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1223 AC_SUBST(MODULES_LIBS)
1224 AC_SUBST(MOD_TARGET)
1226 AC_SUBST(SSL_SRCS_ENABLE)
1227 AC_SUBST(SSL_INCLUDES)
1232 AC_SUBST(IRC_CFLAGS)
1236 if test "$prefix" = "NONE"; then
1237 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1241 dnl Don't get bitten by Cygwin's stupidity if the user specified
1242 dnl a custom prefix with a trailing slash
1244 prefix=`echo $prefix | sed 's/\/$//'`
1245 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1253 extensions/Makefile \
1263 if test "$cf_openssl_version_ok" = yes; then
1269 if test "$shared_modules" = yes; then
1277 Install directory : $prefix
1282 IPv6 support : $have_v6
1283 Socket Engine : $SELECT_TYPE
1284 Small network : $small_net
1285 Block allocator : $balloc
1286 ASM hashing code : $ricer_hashing
1288 Nickname length : $NICKLEN
1289 Topic length : $TOPICLEN
1291 Use make to compile ircd-seven, then make install to install it.