1 dnl $Id: configure.ac 22543 2006-05-17 14:52:16Z 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 22543 2006-05-17 14:52:16Z jilles $])
13 AC_INIT([ircd-ratbox],[stable])
15 AC_CONFIG_HEADER(include/setup.h)
17 AC_PREFIX_DEFAULT(/usr/local/ircd)
22 dnl Checks for programs.
26 dnl Make sure autoconf doesn't interfere with cflags -jmallett
29 dnl Check for various compilers. -jmallett
30 dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk
32 if test "$ac_cv_c_compiler_gnu" != yes; then
35 AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
36 case `$CC -version 2>&1` in
38 AC_MSG_RESULT([yes, TenDRA])
40 CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
45 AC_MSG_RESULT([yes, MIPSpro])
56 AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
58 *Sun*WorkShop* | *Forte*Developer*)
59 AC_MSG_RESULT(Sun Workshop/Forte)
60 IRC_CFLAGS="-fast -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString"
65 AC_MSG_RESULT(Tru64 cc)
67 CPPFLAGS="-I/usr/local/include"
71 AC_MSG_RESULT(HPUX cc)
82 AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
86 dnl only do this if we haven't already detected the newer one
87 dnl and we're not already using gcc
89 if test "$HPUX" != yes -a "$ac_cv_c_compiler_gnu" = no; then
90 AC_MSG_RESULT(assuming old HPUX with its own cc)
91 IRC_CFLAGS="$IRC_CFLAGS +e"
94 AC_MSG_RESULT(already using newer HPUX)
102 AC_MSG_RESULT(SunOS or Solaris)
103 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
106 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
107 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
114 if test "$ac_cv_c_compiler_gnu" = yes; then
115 AC_MSG_CHECKING(if $CC is Apple GCC)
117 case `$CC -v 2>&1 | tail -1` in
128 IRC_CFLAGS="$IRC_CFLAGS -O2 -Wall"
131 dnl If we support -g, use it!
132 if test "$ac_cv_prog_cc_g" = yes; then
133 dnl Tru64 needs -g3 for -O2
134 if test "$Tru" = yes; then
135 IRC_CFLAGS="$IRC_CFLAGS -g3"
137 IRC_CFLAGS="$IRC_CFLAGS -g"
141 dnl SVR4 SGS based on what we know about the compiler -jmallett
142 AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces)
143 if test "$SGS" = "yes"; then
149 dnl We prefer gcc -MM because it's a lot less bloated
150 AC_PATH_PROG(MKDEP, mkdep)
151 AC_PATH_PROG(MAKEDEPEND, makedepend)
153 AC_MSG_CHECKING(how to generate dependency info)
157 if test "$ac_cv_c_compiler_gnu" = yes; then
158 AC_MSG_RESULT(gcc -MM)
160 elif test ! -z "$MKDEP"; then
163 dnl Tru64's mkdep is very loud
164 if test -z "$Tru"; then
167 STDOUT=" 2> /dev/null"
169 elif test "$SunWorkShop" = yes; then
170 AC_MSG_RESULT($CC -xM)
172 STDOUT="> .depend 2> /dev/null"
173 elif test ! -z "$MAKEDEPEND"; then
174 AC_MSG_RESULT(makedepend)
175 MKDEP="$MAKEDEPEND -f-"
177 AC_MSG_RESULT([nothing suitable.. forget it!])
184 dnl check for /dev/null so we can use it to hold evil fd's
185 AC_MSG_CHECKING([for /dev/null])
186 if test -c /dev/null ; then
187 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
190 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
191 AC_MSG_RESULT(no - using devnull.log)
194 dnl jdc -- If CFLAGS is defined, best use it everywhere...
195 dnl NOTE: jv says it must be added to the *END*, because things like
196 dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
197 if test ! -z "$CFLAGS"; then
198 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
203 AC_PROG_GCC_TRADITIONAL
210 AC_PATH_PROG(SED, sed)
213 AC_PATH_PROG(RANLIB, ranlib)
214 AC_PATH_PROG(TOUCH, touch)
217 dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
218 if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
219 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
224 if test "$LEX" = ":"; then
225 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
228 dnl use directory structure of cached as default (hack)
229 if test "$libexecdir" = '${exec_prefix}/libexec' &&
230 test "$localstatedir" = '${prefix}/var'; then
231 libexecdir='${bindir}'
232 localstatedir='${prefix}'
235 dnl Checks for header files.
238 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])
240 dnl Networking Functions
241 dnl ====================
243 AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
245 AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len'
246 member.])],,[[#include <sys/types.h>
247 #include <sys/socket.h>
250 AC_CHECK_TYPE(socklen_t, ,
251 [AC_DEFINE([socklen_t], [unsigned int],
252 [If we don't have a real socklen_t, unsigned int is good enough.])],
253 [#include <sys/types.h>
254 #include <sys/socket.h>])
257 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
259 if test $ipv6 != yes; then
262 AC_MSG_CHECKING([for core IPv6 support])
266 [[#define IN_AUTOCONF
267 #include <sys/types.h>
268 #include <sys/socket.h>
269 #include <netinet/in.h>]],
270 [[struct sockaddr_in6 s;
274 if test "$CYGWIN" = "yes"; then
275 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
279 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
281 AC_MSG_CHECKING([for struct in6addr_any])
284 [[#define IN_AUTOCONF
285 #include <sys/types.h>
286 #include <sys/socket.h>
287 #include <netinet/in.h>]],
288 [[struct in6_addr a = in6addr_any; ]]
290 [AC_MSG_RESULT(yes)],
293 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
303 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
305 CRYPT_LIB=$ac_cv_search_crypt
307 if test "$CRYPT_LIB" = "none required"; then
309 elif test "$CRYPT_LIB" = no; then
315 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
317 dnl We need one of the above to build viconf. Just a sanity check,
318 dnl we don't want to stop people from building the rest of ircd
319 dnl just because they can't build viconf.
326 dnl See whether we can include both string.h and strings.h.
327 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
328 gcc_cv_header_string,
332 #include <strings.h>],
333 [gcc_cv_header_string=yes],
334 [gcc_cv_header_string=no])
337 if test "$gcc_cv_header_string" = "yes"; then
338 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
343 dnl Check for stdarg.h - if we can't find it, halt configure
344 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
346 dnl Checks for the existence of strlcat, strlcpy, basename...
347 dnl This more reliable test only works with gcc though.
349 if test "$ac_cv_c_compiler_gnu" = yes; then
351 AC_MSG_CHECKING(for strlcpy)
353 CFLAGS="$CFLAGS -Wimplicit -Werror"
357 [[#include <string.h>
358 #include <stdlib.h>]],
359 [[char *a = malloc(6);
360 strlcpy(a, "hello", 6);]]
363 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
367 AC_MSG_CHECKING(for strlcat)
370 [[#include <string.h>
371 #include <stdlib.h>]],
372 [[char *a = malloc(6);
374 strlcat(a, "hello", 6);]]
377 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
385 dnl Better than nothing. The more complicated test above probably fixes powerpc,
388 AC_CHECK_FUNCS([strlcat strlcpy])
392 AX_CREATE_STDINT_H([include/_stdint.h])
394 AC_CHECK_TYPE([in_port_t], [],
395 [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
396 [[#include <sys/types.h>
397 #include <netinet/in.h>]])
399 AC_CHECK_TYPE([sa_family_t], [],
400 [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
401 [[#include <sys/types.h>
402 #include <sys/socket.h>]])
404 dnl check for various functions...
405 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
409 dnl Specialized functions checks
410 dnl ============================
412 dnl check for nanosleep
413 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
415 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
417 if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
419 AC_MSG_RESULT("nanosleep not found..using select for delay")
421 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
425 AC_MSG_CHECKING(for OpenSSL)
426 AC_ARG_ENABLE(openssl,
427 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
428 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
429 [cf_enable_openssl=$enableval],
430 [cf_enable_openssl="auto"])
432 if test "$cf_enable_openssl" != "no" ; then
433 cf_openssl_basedir=""
434 if test "$cf_enable_openssl" != "auto" &&
435 test "$cf_enable_openssl" != "yes" ; then
436 dnl Support for --enable-openssl=/some/place
437 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
439 dnl Do the auto-probe here. Check some common directory paths.
440 for dirs in /usr/local/ssl /usr/pkg /usr/local \
441 /usr/local/openssl ; do
442 if test -f "${dirs}/include/openssl/opensslv.h" ; then
443 cf_openssl_basedir="${dirs}"
449 dnl Now check cf_openssl_found to see if we found anything.
450 if test ! -z "$cf_openssl_basedir"; then
451 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
452 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
453 SSL_LIBS="-L${cf_openssl_basedir}/lib"
455 dnl OpenSSL wasn't found in the directory specified. Naughty
457 cf_openssl_basedir=""
460 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
461 dnl are in /usr/include and /usr/lib. In this case, we don't want to
462 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
463 dnl We can't do this check above, because some people want two versions
464 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
465 dnl and they want /usr/local/ssl to have preference.
466 if test -f "/usr/include/openssl/opensslv.h" ; then
467 cf_openssl_basedir="/usr"
471 dnl If we have a basedir defined, then everything is okay. Otherwise,
472 dnl we have a problem.
473 if test ! -z "$cf_openssl_basedir"; then
474 AC_MSG_RESULT($cf_openssl_basedir)
475 cf_enable_openssl="yes"
477 AC_MSG_RESULT([not found. Specify a correct path?])
478 cf_enable_openssl="no"
480 unset cf_openssl_basedir
482 dnl If --disable-openssl was specified
483 AC_MSG_RESULT(disabled)
486 save_CPPFLAGS="$CPPFLAGS"
487 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
489 LIBS="$LIBS $SSL_LIBS"
490 if test "$cf_enable_openssl" != no; then
491 dnl Check OpenSSL version (must be 0.9.6 or above!)
492 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
495 [#include <openssl/opensslv.h>
496 #include <stdlib.h>],
497 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
498 exit(0); else exit(1);]]),
499 cf_openssl_version_ok=yes,
500 cf_openssl_version_ok=no,
501 cf_openssl_version_ok=no)
503 if test "$cf_openssl_version_ok" = yes; then
506 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
507 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
508 AC_CHECK_LIB(crypto, RSA_free)
509 SSL_LIBS="$SSL_LIBS -lcrypto"
510 SSL_SRCS_ENABLE='$(SSL_SRCS)'
512 AC_MSG_RESULT(no - OpenSSL support disabled)
516 CPPFLAGS="$save_CPPFLAGS"
519 dnl End OpenSSL detection
522 dnl Specialized functions and libraries
523 dnl ===================================
525 AC_ARG_WITH(zlib-path,
526 AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
527 [LIBS="$LIBS -L$withval"],)
530 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
531 [zlib=$enableval],[zlib=yes])
533 if test "$zlib" = yes; then
535 AC_CHECK_HEADER(zlib.h, [
536 AC_CHECK_LIB(z, zlibVersion,
538 AC_SUBST(ZLIB_LD, -lz)
539 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
545 dnl IO Loop Selection
546 dnl =================
548 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
549 [ if test $enableval = yes; then
550 SELECT_TYPE_EXPLICIT="poll"
556 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
557 [ if test $enableval = yes; then
558 SELECT_TYPE_EXPLICIT="select"
564 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
565 [ if test $enableval = yes; then
566 SELECT_TYPE_EXPLICIT="kqueue"
572 AC_ARG_ENABLE(devpoll,AC_HELP_STRING([--enable-devpoll],[Force usage of /dev/poll.]),
573 [ if test $enableval = yes; then
574 SELECT_TYPE_EXPLICIT="devpoll"
575 dnl These need to be defined or not defined
576 AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])
582 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
583 [ if test $enableval = yes; then
584 SELECT_TYPE_EXPLICIT="epoll"
590 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
591 [ if test $enableval = yes; then
592 SELECT_TYPE_EXPLICIT="epoll"
598 AC_ARG_ENABLE(rtsigio, AC_HELP_STRING([--enable-rtsigio],[Force RT sigio usage (Linux only).]),
599 [ if test $enableval = yes; then
600 SELECT_TYPE_EXPLICIT="sigio"
606 dnl **********************************************************************
607 dnl Check for --with-confdir
608 dnl **********************************************************************
610 AC_MSG_CHECKING([whether to modify confdir])
612 AC_HELP_STRING([--with-confdir=DIR],
613 [Directory to install config files.]),
614 [ confdir=`echo $withval | sed 's/\/$//'`
616 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
617 AC_SUBST_DIR([confdir]) ],
618 [ confdir='${prefix}/etc'
620 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
621 AC_SUBST_DIR([confdir])]
624 dnl **********************************************************************
625 dnl Check for --with-logdir
626 dnl **********************************************************************
628 AC_MSG_CHECKING([whether to modify logdir])
630 AC_HELP_STRING([--with-logdir=DIR],
631 [Directory where to write logfiles.]),
632 [ logdir=`echo $withval | sed 's/\/$//'`
634 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
635 AC_SUBST_DIR([logdir]) ],
636 [ logdir='${prefix}/logs'
638 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
639 AC_SUBST_DIR([logdir])]
642 dnl **********************************************************************
643 dnl Check for --with-helpdir
644 dnl **********************************************************************
646 AC_MSG_CHECKING([whether to modify helpdir])
648 AC_HELP_STRING([--with-helpdir=DIR],
649 [Directory to install help files.]),
650 [ helpdir=`echo $withval | sed 's/\/$//'`
652 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
653 AC_SUBST_DIR([helpdir]) ],
654 [ helpdir='${prefix}/help'
656 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
657 AC_SUBST_DIR([helpdir])]
660 dnl **********************************************************************
661 dnl Check for --with-moduledir
662 dnl **********************************************************************
664 AC_MSG_CHECKING([whether to modify moduledir])
665 AC_ARG_WITH(moduledir,
666 AC_HELP_STRING([--with-moduledir=DIR],
667 [Directory to install modules.]),
668 [ moduledir=`echo $withval | sed 's/\/$//'`
670 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
671 AC_SUBST_DIR([moduledir]) ],
672 [ moduledir='${prefix}/modules'
674 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
675 AC_SUBST_DIR([moduledir])]
678 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
679 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
680 echo "Forcing $SELECT_TYPE to be enabled"
683 if test ! "x$use_select" = "xno"; then
684 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
685 if test "x$haveselect" = "xyes" ; then
690 if test ! "x$use_poll" = "xno"; then
691 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
692 if test "x$havepoll" = "xyes" ; then
697 if test ! "x$use_devpoll" = "xno"; then
698 AC_MSG_CHECKING(for /dev/poll)
699 if test -c "/dev/poll"; then
701 AC_CHECK_HEADERS([devpoll.h sys/devpoll.h])
702 SELECT_TYPE="devpoll"
708 if test ! "x$use_kqueue" = "xno"; then
709 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
710 if test "x$havekqueue" = "xyes" ; then
715 if test ! "x$use_epoll" = "xno"; then
716 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
717 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
718 if test "x$haveepoll" = "xyes" ; then
719 AC_MSG_CHECKING(for epoll support in kernel)
722 #include <sys/param.h>
723 #include <sys/types.h>
724 #include <sys/epoll.h>
725 #include <sys/syscall.h>
729 main(int argc, char **argv)
733 epfd = epoll_create(256);
734 exit (epfd == -1 ? 1 : 0);
735 }, [AC_MSG_RESULT(yes)
736 AC_DEFINE(HAVE_EPOLL, 1,
737 [Define if your system supports the epoll system calls])
738 SELECT_TYPE="epoll"],
739 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
745 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
746 if test "x$haveepoll" = "xno" ; then
747 AC_MSG_CHECKING(for epoll system call)
750 #include <sys/param.h>
751 #include <sys/types.h>
752 #include <sys/epoll.h>
753 #include <sys/syscall.h>
757 epoll_create(int size)
759 return (syscall(__NR_epoll_create, size));
763 main(int argc, char **argv)
767 epfd = epoll_create(256);
768 exit (epfd == -1 ? 1 : 0);
769 }, [AC_MSG_RESULT(yes)
770 AC_DEFINE(HAVE_EPOLL, 1,
771 [Define if your system supports the epoll system calls])
772 SELECT_TYPE="epoll"],
773 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
781 if test -z "$SELECT_TYPE"; then
782 AC_MSG_ERROR([Unable to find a usable IO interface],)
785 echo "Using $SELECT_TYPE for select loop."
787 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
788 AC_SUBST(SELECT_TYPE)
791 dnl Debug-related options
792 dnl =====================
794 AC_ARG_ENABLE(assert,
795 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
796 [assert=$enableval], [assert=no])
798 if test "$assert" = no; then
799 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
800 elif test "$assert" = soft; then
801 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
802 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
803 elif test "$assert" = yes; then
807 AC_MSG_CHECKING(if you want IO Debugging hooks)
808 AC_ARG_ENABLE(iodebug,
809 AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
810 [iodebug=$enableval], [iodebug=no])
812 if test "$iodebug" = yes; then
813 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
820 AC_MSG_CHECKING(if you want to do a profile build)
821 AC_ARG_ENABLE(profile,
822 AC_HELP_STRING([--enable-profile],[Enable profiling]),
823 [profile=$enableval], [profile=no])
825 if test "$profile" = yes; then
826 if test "$ac_cv_c_compiler_gnu" = yes; then
827 IRC_CFLAGS="$IRC_CFLAGS -pg -static"
828 AC_MSG_RESULT([yes, adding -pg -static])
829 AC_DEFINE(RATBOX_PROFILE, 1, [Defined to mark profiling is enabled])
831 AC_MSG_RESULT([no, profile builds only work with gcc])
837 AC_ARG_ENABLE(warnings,
838 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
839 [IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -Werror -Wcast-qual -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -W -Wno-unused -Wno-sign-compare -Wunused-function -Wunused-variable"],[])
844 AC_ARG_ENABLE(services,
845 AC_HELP_STRING([--enable-services],[Enable ratbox-services compatibility code.]),
846 [ratbox_services=$enableval], [ratbox_services=no])
850 if test "x$ratbox_services" = "xyes"; then
851 AC_DEFINE([ENABLE_SERVICES], 1, [ratbox-services compatibility code])
852 M_SERVICES="m_services.c"
857 AC_ARG_ENABLE(small-net,
858 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
859 [small_net=$enableval], [small_net=no])
861 if test "$small_net" = yes; then
862 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
863 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
864 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
865 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
866 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
867 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
868 AC_DEFINE([DNODE_HEAP_SIZE], 512, [Size of the dlink_node heap.])
869 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
870 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
871 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
872 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
873 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
874 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
875 AC_DEFINE([AUTH_HEAP_SIZE], 128, [Size of the auth heap.])
877 dnl These settings are for a large network like efnet..they will use lots of memory
878 dnl so enable small net unless you really need this much support
879 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
880 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
881 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
882 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
883 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
884 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
885 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
886 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
887 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
888 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
889 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
890 AC_DEFINE([CONFITEM_HEAP_SIZE], 1024, [Size of the confitem heap.])
891 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
892 AC_DEFINE([AUTH_HEAP_SIZE], 256, [Size of the auth heap.])
896 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 9, max 50)]),
898 if test $withval -ge 50; then
900 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
906 AC_ARG_WITH(topiclen,
907 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 160, max 390)]),
909 if test $withval -ge 390; then
911 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
918 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
919 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
920 AC_DEFINE_UNQUOTED(RATBOX_CONFIGURE_OPTS, "$ac_configure_args", [configure arguments])
922 AC_ARG_ENABLE(shared-modules,
923 AC_HELP_STRING([--disable-shared-modules],[ Disable shared modules.]),
924 [shared_modules=$enableval], [shared_modules="yes"])
926 dnl Some first-stage sanity checks.
927 if test "$shared_modules" = yes; then
929 if test "$profile" = "no"; then
932 AC_MSG_WARN([disabling shared modules; cannot coexist with profile builds])
936 if test "$CYGWIN" = yes; then
937 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
941 dnl TenDRA's cc is called tcc too.
942 if test "$CC" = tcc -a "$TenDRA" = "no"; then
943 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
948 dnl Second stage: check for functions and headers.
949 if test "$shared_modules" = yes; then
951 AC_CHECK_HEADERS(dlfcn.h)
952 AC_SEARCH_LIBS(shl_load, dld,
954 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
956 MOD_TARGET=hpux_shared
962 AC_SEARCH_LIBS(dlopen, [dl c_r],
964 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
966 MOD_TARGET=shared_modules
968 if test "$AppleGCC" = yes; then
969 AC_CHECK_HEADERS([mach-o/dyld.h])
971 AC_CHECK_FUNC(dlsym, ,
973 AC_MSG_WARN([dlsym is not available, shared modules disabled])
976 AC_CHECK_FUNCS(dlfunc)
984 AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
986 dnl Third stage - wrangling the linker.
987 if test "$shared_modules" = yes; then
988 # The GNU linker requires the -export-dynamic option to make
989 # all symbols visible in the dynamic symbol table.
990 hold_ldflags=$LDFLAGS
991 AC_MSG_CHECKING(for the ld -export-dynamic flag)
992 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
993 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
994 LDFLAGS=$hold_ldflags
996 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
997 found="no, IRIX ld uses -B,dynamic"
998 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1001 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1002 found="no, AIX ld uses -G -brtl"
1003 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1006 AC_MSG_RESULT($found)
1008 if test "$found" = yes; then
1009 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1012 AC_MSG_CHECKING(for compiler option to produce PIC)
1013 dnl The order should be here to check for groups of compilers,
1014 dnl then for odd compilers, then if no PICFLAGS were set up,
1015 dnl check for GCC and set defaults, or else error. -jmallett
1016 if test "$SGS" = "yes"; then
1017 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1018 PICFLAGS="-KPIC -DPIC -G"
1021 if test "$AppleGCC" = "yes"; then
1022 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1023 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1025 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1026 dnl while compiling modules, the compiler does not allow you to give arguments
1027 dnl to the linker. (I did not design this)
1028 dnl So we need -c in the first stage of module compilation.
1029 dnl In the second stage, we link the modules via ld -b.
1030 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1032 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1033 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1034 PICFLAGS="+z -r -q -n -c"
1035 AC_MSG_CHECKING([if +ESfic is required on this platform])
1037 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1041 PICFLAGS="$PICFLAGS +ESfic"
1044 LDFLAGS="${LDFLAGS} -Wl,-E"
1046 if test "$Tru" = yes -a "$CC" != gcc; then
1047 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1048 PICFLAGS="-shared -expect_unresolved '*' "
1049 LDFLAGS="-call_shared"
1051 if test -z "$PICFLAGS"; then
1052 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1053 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1054 PICFLAGS="-fPIC -DPIC -shared"
1055 IRC_CFLAGS="$IRC_CFLAGS -fPIC -DPIC"
1063 if test "$shared_modules" = no; then
1065 MOD_TARGET="libmodules.a"
1066 MODULES_LIBS="../modules/libmodules.a"
1068 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1069 AC_MSG_WARN([shared module support has been disabled!])
1072 dnl Stage 5 - underscores in front of symbol names.
1073 if test "$shared_modules" = yes; then
1075 AC_CHECK_FUNC(nlist,,
1076 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1077 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1081 dnl We need to find out whether underscores are appended to symbol
1082 dnl names in executable files. First, though, we need to see
1083 dnl where nlist.h is hiding.
1084 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1085 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1086 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1087 if test x"$nlist_h" = "x"; then
1088 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1090 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1091 AC_CACHE_VAL(symbol_underscores,
1093 cat << EOF > conftest.c
1097 void _modinit(void);
1098 int main(int argc, char *argv[[]]) {
1100 struct nlist nl[[5]];
1102 /* fill the names in this way, so it'll work almost everywhere */
1103 nl[[0]].n_name = "_modinit";
1104 nl[[1]].n_name = "__modinit";
1105 nl[[2]].n_name = "___modinit";
1106 nl[[3]].n_name = "____modinit";
1107 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1109 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1110 for(i = 0; i < 4; i++) {
1111 if(nl[[i]].n_value != NULL)
1114 for(j = 0; j < i; j++)
1121 void _modinit(void) { return; }
1123 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1124 symbol_underscores=`./conftest conftest`
1125 AC_MSG_RESULT($symbol_underscores)
1126 $RM -f conftest conftest.c
1128 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1132 AC_SUBST(MODULES_LIBS)
1133 AC_SUBST(MOD_TARGET)
1135 AC_SUBST(SSL_SRCS_ENABLE)
1136 AC_SUBST(SSL_INCLUDES)
1141 AC_SUBST(IRC_CFLAGS)
1145 if test "$prefix" = "NONE"; then
1146 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1150 dnl Don't get bitten by Cygwin's stupidity if the user specified
1151 dnl a custom prefix with a trailing slash
1153 prefix=`echo $prefix | sed 's/\/$//'`
1154 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1172 dnl Make it look sexay!
1175 echo "Compiling $PACKAGE_NAME $PACKAGE_VERSION"
1178 echo "Installing into: $prefix"
1180 echo "Ziplinks ....................... $zlib"
1182 echo "OpenSSL ........................ $cf_enable_openssl"
1184 if test "$shared_modules" = yes; then
1190 echo "Modules ........................ $tmpresult"
1191 echo "IPv6 support ................... $have_v6"
1192 echo "Net I/O implementation ......... $SELECT_TYPE"
1193 echo "IO Debugging hooks ............. $iodebug"
1194 echo "Assert debugging ............... $assert"
1195 echo "Small network .................. $small_net"
1196 echo "ratbox-services compatibility .. $ratbox_services"
1198 echo "Configured limits:"
1199 echo "NICKLEN ................. $NICKLEN"
1200 echo "TOPICLEN ................ $TOPICLEN"