Replace all occurances of "charybdis" with "seven".
[seven-1.x.git] / ircd / configure.ac
blob410d4fcf97fbc1d435e13824a7e5df31d93e929d
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.
8 AC_PREREQ(2.57)
10 dnl Sneaky way to get an Id tag into the configure script
11 AC_COPYRIGHT([$Id: configure.ac 183 2006-12-18 03:08:31Z beu $])
13 AC_INIT([ircd-seven],[1.0.0])
15 AC_CONFIG_HEADER(include/setup.h)
17 AC_PREFIX_DEFAULT($HOME/ircd)
19 AC_GNU_SOURCE
21 OLD_CFLAGS="$CFLAGS"
22 dnl Checks for programs.
23 AC_PROG_CC
24 AC_LANG(C)
26 dnl Make sure autoconf doesn't interfere with cflags -jmallett
27 CFLAGS="$OLD_CFLAGS"
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
34 SGS=no
35 AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
36 case `$CC -version 2>&1` in
37 *TenDRA*)
38         AC_MSG_RESULT([yes, TenDRA])
39         IRC_CFLAGS=""
40         CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
41         SGS=yes
42         TenDRA=yes
44 *MIPSpro*)
45         AC_MSG_RESULT([yes, MIPSpro])
46         MIPSpro=yes
47         SGS=yes
50         AC_MSG_RESULT(no)
51         TenDRA=no
52         MIPSpro=no
54 esac
56 AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
57 case `$CC -V 2>&1` in
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"
61         SunWorkShop=yes
62         SGS=yes
64 *Tru64*)
65         AC_MSG_RESULT(Tru64 cc)
66         IRC_CFLAGS="-O2"
67         CPPFLAGS="-I/usr/local/include"
68         Tru=yes
70 *HP*ANSI*)
71         AC_MSG_RESULT(HPUX cc)
72         HPUX=yes
73         IRC_CFLAGS="+e"
76         AC_MSG_RESULT(no)
78 esac
82 AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
83 OSNAME=`uname -s`
84 case "$OSNAME" in
85         HP-UX*)
86         dnl only do this if we haven't already detected the newer one
87         dnl and we're not already using gcc
88         
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"
92                         HPUX=yes
93                 else
94                         AC_MSG_RESULT(already using newer HPUX)
95                 fi
96         ;;
97         CYGWIN*)
98                 AC_MSG_RESULT(Cygwin)
99                 CYGWIN=yes
100         ;;
101         SunOS*)
102                 AC_MSG_RESULT(SunOS or Solaris)
103                 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
104                 SUN=yes
105         ;;
106         AIX*)
107                 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
108                 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
109         ;;
110         *)
111                 AC_MSG_RESULT(no)
112         ;;
113 esac
115 if test "$ac_cv_c_compiler_gnu" = yes; then
116         AC_MSG_CHECKING(if $CC is Apple GCC)
118         case `$CC -v 2>&1 | tail -n 1` in
119         *Apple*)
120                 AC_MSG_RESULT(yes)
121                 AppleGCC=yes
122         ;;
123         *)
124                 AC_MSG_RESULT(no)
125                 AppleGCC=no
126         ;;
127         esac
129         IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -Werror-implicit-function-declaration"
132 dnl If we support -g, use it!
133 if test "$ac_cv_prog_cc_g" = yes; then
134         dnl Tru64 needs -g3 for -O2
135         if test "$Tru" = yes; then
136                 IRC_CFLAGS="$IRC_CFLAGS -g3"
137         else
138                 IRC_CFLAGS="$IRC_CFLAGS -g"
139         fi
142 dnl SVR4 SGS based on what we know about the compiler -jmallett
143 AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces)
144 if test "$SGS" = "yes"; then
145         AC_MSG_RESULT(yes)
146 else
147         AC_MSG_RESULT(no)
150 dnl We prefer gcc -MM because it's a lot less bloated
151 AC_PATH_PROG(MKDEP, mkdep)
152 AC_PATH_PROG(MAKEDEPEND, makedepend)
154 AC_MSG_CHECKING(how to generate dependency info)
156 STDOUT="> .depend"
158 if test "$ac_cv_c_compiler_gnu" = yes; then
159         AC_MSG_RESULT(gcc -MM)
160         MKDEP="$CC -MM"
161 elif test ! -z "$MKDEP"; then
162         AC_MSG_RESULT(mkdep)
164         dnl Tru64's mkdep is very loud
165         if test -z "$Tru"; then
166                 STDOUT=""
167         else
168                 STDOUT=" 2> /dev/null"
169         fi
170 elif test "$SunWorkShop" = yes; then
171         AC_MSG_RESULT($CC -xM)
172         MKDEP="$CC -xM"
173         STDOUT="> .depend 2> /dev/null"
174 elif test ! -z "$MAKEDEPEND"; then
175         AC_MSG_RESULT(makedepend)
176         MKDEP="$MAKEDEPEND -f-"
177 else
178         AC_MSG_RESULT([nothing suitable.. forget it!])
179         MKDEP=":"
182 AC_SUBST(MKDEP)
183 AC_SUBST(STDOUT)
185 dnl check for /dev/null so we can use it to hold evil fd's
186 AC_MSG_CHECKING([for /dev/null])
187 if test -c /dev/null ; then
188         AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
189         AC_MSG_RESULT(yes)
190 else
191         AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
192         AC_MSG_RESULT(no - using devnull.log)
195 dnl jdc -- If CFLAGS is defined, best use it everywhere...
196 dnl NOTE: jv says it must be added to the *END*, because things like
197 dnl "gcc -O9 -O2" will result in -O2 getting preference.  How stupid.
198 if test ! -z "$CFLAGS"; then
199         IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
202 AC_ISC_POSIX
203 AC_C_INLINE
204 AC_PROG_GCC_TRADITIONAL
205 AC_PROG_MAKE_SET
206 AC_PROG_INSTALL
207 AC_PATH_PROG(RM, rm)
208 AC_PATH_PROG(CP, cp)
209 AC_PATH_PROG(MV, mv)
210 AC_PATH_PROG(LN, ln)
211 AC_PATH_PROG(SED, sed)
212 AC_PATH_PROG(AR, ar)
213 AC_PATH_PROG(LD, ld)
214 AC_PATH_PROG(RANLIB, ranlib)
215 AC_PATH_PROG(TOUCH, touch)
217 AC_PROG_YACC
219 dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
220 if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
221         AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
224 AC_PROG_LEX
226 if test "$LEX" = ":"; then
227         AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
230 dnl use directory structure of cached as default (hack)
231 if test "$libexecdir" = '${exec_prefix}/libexec' &&
232    test "$localstatedir" = '${prefix}/var'; then
233         libexecdir='${bindir}'
234         localstatedir='${prefix}'
237 dnl Checks for header files.
238 AC_HEADER_STDC
240 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])
242 dnl Stuff that the memory manager (imalloc) depends on
243 dnl ==================================================
245 AC_C_CONST
246 if test "$ac_cv_header_machine_endian_h" = "no" ; then
247     AC_C_BIGENDIAN
249 AC_TYPE_PID_T
250 AC_TYPE_SIZE_T
251 AC_CHECK_SIZEOF(short)
252 AC_CHECK_SIZEOF(int)
253 AC_CHECK_SIZEOF(long)
254 AC_CHECK_SIZEOF(long long)
256 dnl Memory manager
257 dnl ==============
259 AC_MSG_CHECKING([the system's memory page size])
260 pagesize="no"
261 AC_TRY_RUN([
262 #include <stdio.h>
263 #if HAVE_UNISTD_H
264 # include <unistd.h>
265 #endif
267 int main(void) {
268     FILE *fp = fopen("conftest.malloc", "w");
270     if (fp != NULL) {
271         fprintf(fp, "%d\n", getpagesize());
272         fclose(fp);
273     } else
274         exit(1);
275     exit(0);
276 }],[
277 if test -f "conftest.malloc" ; then
278     pagesize=`cat conftest.malloc`
281 if test "$pagesize" != "no" ; then
282     AC_MSG_RESULT($pagesize)
283 else
284     if test "$ac_cv_sizeof_int" = "4" ; then
285         pagesize=4096
286     else
287         pagesize=8192
288     fi
289     AC_MSG_RESULT([$pagesize (guessing)])
291 AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize,
292     [the system's memory page size])
294 dnl Networking Functions
295 dnl ====================
297 AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
299 dnl SunOS/Solaris required libnsl for inet_ntoa()
300 if test x"$SUN" = xyes; then
301         AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
304 AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len'
305 member.])],,[[#include <sys/types.h>
306 #include <sys/socket.h>
309 AC_CHECK_TYPE(socklen_t, ,
310 [AC_DEFINE([socklen_t], [unsigned int],
311 [If we don't have a real socklen_t, unsigned int is good enough.])],
312 [#include <sys/types.h>
313 #include <sys/socket.h>])
315 AC_ARG_ENABLE(ipv6,
316 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
318 if test $ipv6 != yes; then
319         have_v6="no"
320 else
321 AC_MSG_CHECKING([for core IPv6 support])
323 AC_COMPILE_IFELSE(
324 [AC_LANG_PROGRAM(
325         [[#define IN_AUTOCONF
326         #include <sys/types.h>
327         #include <sys/socket.h>
328         #include <netinet/in.h>]],
329         [[struct sockaddr_in6 s; 
330           s.sin6_family = 0;]]
331         )],
333         if test "$CYGWIN" = "yes"; then
334                 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
335                 have_v6=no
336         else
337                 have_v6=yes
338                 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
339                 AC_MSG_RESULT(yes)
340                 AC_MSG_CHECKING([for struct in6addr_any])
341                 AC_COMPILE_IFELSE(
342                         [AC_LANG_PROGRAM(
343                                 [[#define IN_AUTOCONF
344                                 #include <sys/types.h>
345                                 #include <sys/socket.h>
346                                 #include <netinet/in.h>]],
347                                 [[struct in6_addr a = in6addr_any;]]
348                         )],
349                         [AC_MSG_RESULT(yes)],
350                         [
351                                 AC_MSG_RESULT(no)
352                                 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
353                                 inet_misc=1
354                         ]
355                 )
356         fi
358 [AC_MSG_RESULT(no)
359 have_v6="no"])
362 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
364 CRYPT_LIB=$ac_cv_search_crypt
366 if test "$CRYPT_LIB" = "none required"; then
367         unset CRYPT_LIB
368 elif test "$CRYPT_LIB" = no; then
369         unset CRYPT_LIB
372 AC_SUBST(CRYPT_LIB)
374 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
375         VICONF=viconf
376         dnl We need one of the above to build viconf. Just a sanity check,
377         dnl we don't want to stop people from building the rest of ircd
378         dnl just because they can't build viconf.
379 else
380         VICONF=""
383 AC_SUBST(VICONF)
385 dnl See whether we can include both string.h and strings.h.
386 AC_CACHE_CHECK([whether string.h and strings.h may both be included],
387 gcc_cv_header_string,
389         AC_COMPILE_IFELSE(
390         [#include <string.h>
391         #include <strings.h>], 
392         [gcc_cv_header_string=yes],
393         [gcc_cv_header_string=no])
396 if test "$gcc_cv_header_string" = "yes"; then
397         AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
400 AC_C_BIGENDIAN
402 dnl Check for stdarg.h - if we can't find it, halt configure
403 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
405 dnl Checks for the existence of strlcat, strlcpy, basename...
406 dnl This more reliable test only works with gcc though.
408 if test "$ac_cv_c_compiler_gnu" = yes; then
410 AC_MSG_CHECKING(for strlcpy)
411 save_CFLAGS=$CFLAGS
412 CFLAGS="$CFLAGS -Wimplicit -Werror"
414 AC_LINK_IFELSE(
415         [AC_LANG_PROGRAM(
416                 [[#include <string.h>
417                 #include <stdlib.h>]],
418                 [[char *a = malloc(6);
419                 strlcpy(a, "hello", 6);]]
420         )],
421         [AC_MSG_RESULT(yes)
422         AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
423         [AC_MSG_RESULT(no)]
426 AC_MSG_CHECKING(for strlcat)
427 AC_LINK_IFELSE(
428         [AC_LANG_PROGRAM(
429                 [[#include <string.h>
430                 #include <stdlib.h>]],
431                 [[char *a = malloc(6);
432                 a[0] = '\0';
433                 strlcat(a, "hello", 6);]]
434         )],
435         [AC_MSG_RESULT(yes)
436         AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
437         [AC_MSG_RESULT(no)]
440 CFLAGS=$save_CFLAGS
442 else
444 dnl Better than nothing. The more complicated test above probably fixes powerpc,
445 dnl so who cares.
447 AC_CHECK_FUNCS([strlcat strlcpy])
451 AC_CHECK_TYPE([u_int32_t], [],
453         AC_CHECK_TYPE([uint32_t],
454         [
455                 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
456         ],
457         [
458                 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
459                 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
460         ])
463 AC_CHECK_TYPE([u_int16_t], [],
465         AC_CHECK_TYPE([uint16_t],
466         [
467                 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
468         ],
469         [
470                 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
471                 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
472         ])
475 AC_CHECK_TYPE([in_port_t], [],
476 [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
477 [[#include <sys/types.h>
478 #include <netinet/in.h>]])
480 AC_CHECK_TYPE([sa_family_t], [],
481 [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
482 [[#include <sys/types.h>
483 #include <sys/socket.h>]])
485 AC_CHECK_TYPES([uintptr_t])
487 dnl check for various functions...
488 AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
490 AC_FUNC_ALLOCA
492 dnl Specialized functions checks
493 dnl ============================
495 dnl check for nanosleep          
496 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
497                  LIBS="${LIBS} -lrt",
498                  [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
499                  )])])
500 if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno  && test x$ac_cv_lib_rt_nanosleep = xno
501 then     
502          AC_MSG_RESULT("nanosleep not found..using select for delay")
503 else     
504          AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
507 dnl OpenSSL support
508 AC_MSG_CHECKING(for OpenSSL)
509 AC_ARG_ENABLE(openssl,
510 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
511 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
512 [cf_enable_openssl=$enableval],
513 [cf_enable_openssl="auto"])
515 if test "$cf_enable_openssl" != "no" ; then
516         cf_openssl_basedir=""
517         if test "$cf_enable_openssl" != "auto" &&
518         test "$cf_enable_openssl" != "yes" ; then
519                 dnl Support for --enable-openssl=/some/place
520                 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
521         else
522         dnl Do the auto-probe here.  Check some common directory paths.
523                 for dirs in /usr/local/ssl /usr/pkg /usr/local \
524                 /usr/local/openssl ; do
525                         if test -f "${dirs}/include/openssl/opensslv.h" ; then
526                                 cf_openssl_basedir="${dirs}"
527                         break
528                         fi
529                 done
530                 unset dirs
531         fi
532         dnl Now check cf_openssl_found to see if we found anything.
533         if test ! -z "$cf_openssl_basedir"; then
534                 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
535                         SSL_INCLUDES="-I${cf_openssl_basedir}/include"
536                         SSL_LIBS="-L${cf_openssl_basedir}/lib"
537                 else
538                 dnl OpenSSL wasn't found in the directory specified.  Naughty
539                 dnl administrator...
540                 cf_openssl_basedir=""
541                 fi
542         else
543         dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
544         dnl are in /usr/include and /usr/lib.  In this case, we don't want to
545         dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
546         dnl We can't do this check above, because some people want two versions
547         dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
548         dnl and they want /usr/local/ssl to have preference.
549                 if test -f "/usr/include/openssl/opensslv.h" ; then
550                         cf_openssl_basedir="/usr"
551                 fi
552         fi
554         dnl If we have a basedir defined, then everything is okay.  Otherwise,
555         dnl we have a problem.
556         if test ! -z "$cf_openssl_basedir"; then
557                 AC_MSG_RESULT($cf_openssl_basedir)
558                 cf_enable_openssl="yes"
559         else
560                 AC_MSG_RESULT([not found. Specify a correct path?])
561                 cf_enable_openssl="no"
562         fi
563         unset cf_openssl_basedir
564 else
565         dnl If --disable-openssl was specified
566         AC_MSG_RESULT(disabled)
569 save_CPPFLAGS="$CPPFLAGS"
570 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
571 save_LIBS="$LIBS"
572 LIBS="$LIBS $SSL_LIBS"
573 if test "$cf_enable_openssl" != no; then
574         dnl Check OpenSSL version (must be 0.9.6 or above!)
575         AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
576         AC_RUN_IFELSE(
577                 AC_LANG_PROGRAM(
578                 [#include <openssl/opensslv.h>
579                 #include <stdlib.h>],
580                 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
581                 exit(0); else exit(1);]]),
582         cf_openssl_version_ok=yes,
583         cf_openssl_version_ok=no,
584         cf_openssl_version_ok=no)
586         if test "$cf_openssl_version_ok" = yes; then
587                 AC_MSG_RESULT(found)
589                 dnl Work around pmake/gmake conditional incompatibilities
590                 AC_SUBST(ENCSPEED, encspeed)
591                 
592                 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
593                 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
594                 AC_CHECK_LIB(crypto, RSA_free)
595                 SSL_LIBS="$SSL_LIBS -lcrypto"
596                 SSL_SRCS_ENABLE='$(SSL_SRCS)'
597         else
598                 AC_MSG_RESULT(no - OpenSSL support disabled)
599         fi
602 CPPFLAGS="$save_CPPFLAGS"
603 LIBS="$save_LIBS"
605 dnl End OpenSSL detection
608 dnl Specialized functions and libraries
609 dnl ===================================
611 AC_ARG_WITH(zlib-path,
612 AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
613 [LIBS="$LIBS -L$withval"],)
615 AC_ARG_ENABLE(zlib,
616 AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
617 [zlib=$enableval],[zlib=yes])
619 if test "$zlib" = yes; then
621 AC_CHECK_HEADER(zlib.h, [
622         AC_CHECK_LIB(z, zlibVersion,
623         [
624                 AC_SUBST(ZLIB_LD, -lz)
625                 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
626         ], zlib=no)
627 ], zlib=no)
631 dnl IO Loop Selection
632 dnl =================
634 AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
635 [ if test $enableval = yes; then 
636         SELECT_TYPE_EXPLICIT="poll"
637   else
638         use_poll=no
639   fi
642 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
643 [ if test $enableval = yes; then 
644         SELECT_TYPE_EXPLICIT="select" 
645   else
646         use_select=no
647   fi
650 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
651 [ if test $enableval = yes; then 
652         SELECT_TYPE_EXPLICIT="kqueue"
653   else
654         use_kqueue=no
655   fi
658 AC_ARG_ENABLE(devpoll,AC_HELP_STRING([--enable-devpoll],[Force usage of /dev/poll.]),
659 [ if test $enableval = yes; then 
660         SELECT_TYPE_EXPLICIT="devpoll" 
661         dnl These need to be defined or not defined
662         AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])
663   else
664         use_devpoll=no;
665   fi
668 AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
669 [ if test $enableval = yes; then 
670         SELECT_TYPE_EXPLICIT="epoll"
671   else
672         use_epoll=no
673   fi
676 dnl **********************************************************************
677 dnl Check for --with-confdir
678 dnl **********************************************************************
680 AC_MSG_CHECKING([whether to modify confdir])
681 AC_ARG_WITH(confdir, 
682 AC_HELP_STRING([--with-confdir=DIR],
683                [Directory to install config files.]),
684                [ confdir=`echo $withval | sed 's/\/$//'`
685                  AC_MSG_RESULT(yes)
686                  AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
687                  AC_SUBST_DIR([confdir]) ],
688                [ confdir='${prefix}/etc'
689                  AC_MSG_RESULT(no)
690                  AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
691                  AC_SUBST_DIR([confdir])]
694 dnl **********************************************************************
695 dnl Check for --with-logdir
696 dnl **********************************************************************
698 AC_MSG_CHECKING([whether to modify logdir])
699 AC_ARG_WITH(logdir, 
700 AC_HELP_STRING([--with-logdir=DIR],
701                [Directory where to write logfiles.]),
702                [ logdir=`echo $withval | sed 's/\/$//'`
703                  AC_MSG_RESULT(yes)
704                  AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
705                  AC_SUBST_DIR([logdir]) ],
706                [ logdir='${prefix}/logs'
707                  AC_MSG_RESULT(no)
708                  AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
709                  AC_SUBST_DIR([logdir])]
712 dnl **********************************************************************
713 dnl Check for --with-helpdir
714 dnl **********************************************************************
716 AC_MSG_CHECKING([whether to modify helpdir])
717 AC_ARG_WITH(helpdir, 
718 AC_HELP_STRING([--with-helpdir=DIR],
719                [Directory to install help files.]),
720                [ helpdir=`echo $withval | sed 's/\/$//'`
721                  AC_MSG_RESULT(yes)
722                  AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
723                  AC_SUBST_DIR([helpdir]) ],
724                [ helpdir='${prefix}/help'
725                  AC_MSG_RESULT(no)
726                  AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
727                  AC_SUBST_DIR([helpdir])]
730 dnl **********************************************************************
731 dnl Check for --with-moduledir
732 dnl **********************************************************************
734 AC_MSG_CHECKING([whether to modify moduledir])
735 AC_ARG_WITH(moduledir, 
736 AC_HELP_STRING([--with-moduledir=DIR],
737                [Directory to install modules.]),
738                [ moduledir=`echo $withval | sed 's/\/$//'`
739                  AC_MSG_RESULT(yes)
740                  AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
741                  AC_SUBST_DIR([moduledir]) ],
742                [ moduledir='${prefix}/modules'
743                  AC_MSG_RESULT(no)
744                  AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
745                  AC_SUBST_DIR([moduledir])]
748 if test ! -z "$SELECT_TYPE_EXPLICIT"; then
749         SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
750         echo "Forcing $SELECT_TYPE to be enabled"
751 else
753 if test ! "x$use_select" = "xno"; then
754         AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
755         if test "x$haveselect" = "xyes" ; then
756                 SELECT_TYPE="select"
757         fi
760 if test ! "x$use_poll" = "xno"; then
761         AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
762         if test "x$havepoll" = "xyes" ; then
763                 SELECT_TYPE="poll"
764         fi
767 if test ! "x$use_devpoll" = "xno"; then
768         AC_MSG_CHECKING(for /dev/poll)
769         if test -c "/dev/poll"; then
770                 AC_MSG_RESULT(yes)
771                 AC_CHECK_HEADERS([devpoll.h sys/devpoll.h])
772                 SELECT_TYPE="devpoll"
773         else
774                 AC_MSG_RESULT(no)       
775         fi
778 if test ! "x$use_kqueue" = "xno"; then
779         AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
780         if test "x$havekqueue" = "xyes" ; then
781                 SELECT_TYPE="kqueue"
782         fi
785 if test ! "x$use_epoll" = "xno"; then
786         AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
787         if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
788                 if test "x$haveepoll" = "xyes" ; then
789                         AC_MSG_CHECKING(for epoll support in kernel)
790                         AC_TRY_RUN(
791 #include <stdint.h>
792 #include <sys/param.h>
793 #include <sys/types.h>
794 #include <sys/epoll.h>
795 #include <sys/syscall.h>
796 #include <unistd.h>     
799 main(int argc, char **argv)
801         int epfd;
803         epfd = epoll_create(256);
804         exit (epfd == -1 ? 1 : 0);
805 }, [AC_MSG_RESULT(yes)
806             AC_DEFINE(HAVE_EPOLL, 1,
807                 [Define if your system supports the epoll system calls])
808             SELECT_TYPE="epoll"], 
809             AC_MSG_RESULT(no), AC_MSG_RESULT(no))
810                 fi
811         fi
813 haveepollsyscall=no
815 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
816         if test "x$haveepoll" = "xno" ; then
817                 AC_MSG_CHECKING(for epoll system call)
818                 AC_TRY_RUN(
819 #include <stdint.h>
820 #include <sys/param.h>
821 #include <sys/types.h>
822 #include <sys/epoll.h>
823 #include <sys/syscall.h>
824 #include <unistd.h>     
827 epoll_create(int size)
829         return (syscall(__NR_epoll_create, size));
833 main(int argc, char **argv)
835         int epfd;
837         epfd = epoll_create(256);
838         exit (epfd == -1 ? 1 : 0);
839 }, [AC_MSG_RESULT(yes)
840     AC_DEFINE(HAVE_EPOLL, 1,
841         [Define if your system supports the epoll system calls])
842     SELECT_TYPE="epoll"], 
843     AC_MSG_RESULT(no), AC_MSG_RESULT(no))
844         fi
851 if test -z "$SELECT_TYPE"; then
852         AC_MSG_ERROR([Unable to find a usable IO interface],)
855 echo "Using $SELECT_TYPE for select loop."
857 AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
858 AC_SUBST(SELECT_TYPE)
861 dnl Debug-related options
862 dnl =====================
864 AC_ARG_ENABLE(assert,
865 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
866 [assert=$enableval], [assert=no])
868 if test "$assert" = no; then
869         AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
870 elif test "$assert" = soft; then
871         AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
872         AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
873 elif test "$assert" = yes; then
874         assert = "hard";
877 AC_MSG_CHECKING(if you want IO Debugging hooks)
878 AC_ARG_ENABLE(iodebug,
879 AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
880 [iodebug=$enableval], [iodebug=no])
882 if test "$iodebug" = yes; then
883         AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
884         AC_MSG_RESULT(yes)
885 else
886         AC_MSG_RESULT(no)
890 AC_MSG_CHECKING(if you want to do a profile build)
891 AC_ARG_ENABLE(profile,
892 AC_HELP_STRING([--enable-profile],[Enable profiling]),
893 [profile=$enableval], [profile=no])
895 if test "$profile" = yes; then
896         if test "$ac_cv_c_compiler_gnu" = yes; then
897                 IRC_CFLAGS="$IRC_CFLAGS -pg"
898                 AC_MSG_RESULT([yes, adding -pg])
899                 AC_DEFINE(SEVEN_PROFILE, 1, [Define this if you are profiling.])
900         else
901                 AC_MSG_RESULT([no, profile builds only work with gcc])
902         fi
903 else
904         AC_MSG_RESULT(no)
907 AC_ARG_ENABLE(balloc,
908 AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
909 [balloc=$enableval], [balloc=yes])
911 if test "$balloc" = no; then
912         AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
915 AC_ARG_ENABLE(ricer-hashing,
916 AC_HELP_STRING([--enable-ricer-hashing],[Enable assembly-based hashing routines.]),
917 [ricer_hashing=$enableval], [ricer_hashing=no])
919 FNVHASH_S=""
921 if test "$ricer_hashing" = "yes"; then
922         AC_DEFINE([RICER_HASHING], 1, [Define to 1 if you are using the assembly-based hashing routines.])
923         FNVHASH_S="fnvhash.s"
926 AC_SUBST(FNVHASH_S)
928 AC_ARG_ENABLE(small-net,
929 AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
930 [small_net=$enableval], [small_net=no])
932 if test "$small_net" = yes; then
933 dnl     AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
934         AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
935         AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
936         AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
937         AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
938         AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
939         AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
940         AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
941         AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
942         AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
943         AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
944         AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
945         AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
946         AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
947         AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
948 else
949 dnl These settings are for a large network like efnet..they will use lots of memory
950 dnl so enable small net unless you really need this much support
951         AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
952         AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
953         AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
954         AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
955         AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
956         AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
957         AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
958         AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
959         AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
960         AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
961         AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
962         AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
963         AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
964         AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
967 AC_ARG_WITH(nicklen,
968 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
970   if test $withval -ge 50; then
971         NICKLEN=50
972         AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
973   else
974         NICKLEN="$withval"
975   fi
976 ], [NICKLEN=15])
978 AC_ARG_WITH(topiclen,           
979 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
981  if test $withval -ge 390; then
982         TOPICLEN=390
983         AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
984  else
985         TOPICLEN=$withval
986  fi
987 ], [TOPICLEN=390])
989 AC_ARG_WITH(maxclients,
990 AC_HELP_STRING([--with-maxclients=NUMBER],[Maximum number of connections the ircd can handle]),
991         MAX_CLIENTS="$withval", MAX_CLIENTS=3000)
994 if test "$MAX_CLIENTS" = yes; then
995         MAX_CLIENTS=3000
998 if test $MAX_CLIENTS -gt 65536; then
999         MAX_CLIENTS=65536
1000         AC_MSG_WARN([Max connections cannot be larger than 65536!])
1003 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
1004 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
1005 AC_DEFINE_UNQUOTED(MAX_CLIENTS, ${MAX_CLIENTS}, [Maximum number of network connections])
1007 AC_ARG_ENABLE(shared-modules,
1008 AC_HELP_STRING([--disable-shared-modules],[ Disable shared modules.]),
1009 [shared_modules=$enableval], [shared_modules="yes"])
1011 dnl Some first-stage sanity checks.
1012 if test "$shared_modules" = yes; then
1013         
1014         if test "$CYGWIN" = yes; then
1015                 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
1016                 shared_modules="no"
1017         fi
1019         dnl TenDRA's cc is called tcc too.
1020         if test "$CC" = tcc -a "$TenDRA" = "no"; then
1021                 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
1022                 shared_modules="no"
1023         fi
1026 dnl Second stage: check for functions and headers.
1027 if test "$shared_modules" = yes; then
1028         DYNLINK_C=dynlink.c
1029         AC_CHECK_HEADERS(dlfcn.h)
1030         AC_SEARCH_LIBS(shl_load, dld, 
1031         [
1032           AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1033           SUFFIX=".sl"
1034           MOD_TARGET=hpux_shared
1035           SEDOBJ="s/\.o/.sl/g"  
1036         ],
1037         dnl !shl_load:
1038         [
1039           dnl standard dlopen
1040           AC_SEARCH_LIBS(dlopen, [dl c_r],
1041           [
1042             AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1043             SUFFIX=".so"
1044             MOD_TARGET=shared_modules
1045             SEDOBJ="s/\.o/.so/g"
1046             if test "$AppleGCC" = yes; then
1047               AC_CHECK_HEADERS([mach-o/dyld.h])
1048             fi
1049             AC_CHECK_FUNC(dlsym, ,
1050             [
1051               AC_MSG_WARN([dlsym is not available, shared modules disabled])
1052               shared_modules=no
1053             ])
1054             AC_CHECK_FUNCS(dlfunc)
1055           ],
1056           [
1057             shared_modules=no
1058           ])
1059         ])
1062 AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1064 dnl Third stage - wrangling the linker.
1065 if test "$shared_modules" = yes; then
1066         # The GNU linker requires the -export-dynamic option to make
1067         # all symbols visible in the dynamic symbol table.
1068         hold_ldflags=$LDFLAGS
1069         AC_MSG_CHECKING(for the ld -export-dynamic flag)
1070         LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1071         AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1072         LDFLAGS=$hold_ldflags
1074         if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1075                 found="no, IRIX ld uses -B,dynamic"
1076                 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1077         fi
1078         
1079         if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1080                 found="no, AIX ld uses -G -brtl"
1081                 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1082         fi
1084         AC_MSG_RESULT($found)
1086         if test "$found" = yes; then
1087                 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1088         fi
1090         AC_MSG_CHECKING(for compiler option to produce PIC)
1091         dnl The order should be here to check for groups of compilers,
1092         dnl then for odd compilers, then if no PICFLAGS were set up,
1093         dnl check for GCC and set defaults, or else error. -jmallett
1094         if test "$SGS" = "yes"; then
1095                 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1096                 PICFLAGS="-KPIC -DPIC -G"
1097         fi
1098         
1099         if test "$AppleGCC" = "yes"; then
1100                 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1101                 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1102         fi
1103         dnl Please note, that on HPUX two different stages of module compilation occurs, since
1104         dnl while compiling modules, the compiler does not allow you to give arguments
1105         dnl to the linker. (I did not design this) 
1106         dnl So we need -c in the first stage of module compilation.
1107         dnl In the second stage, we link the modules via ld -b.
1108         dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1109         dnl -TimeMr14C
1110         if test "$HPUX" = "yes" -a "$CC" != gcc; then
1111                 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1112                 PICFLAGS="+z -r -q -n -c"
1113                 AC_MSG_CHECKING([if +ESfic is required on this platform])
1114                 
1115                 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then 
1116                         AC_MSG_RESULT(no)
1117                 else
1118                         AC_MSG_RESULT(yes)
1119                         PICFLAGS="$PICFLAGS +ESfic"
1120                 fi
1122                 LDFLAGS="${LDFLAGS} -Wl,-E"
1123         fi
1124         if test "$Tru" = yes -a "$CC" != gcc; then
1125                 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1126                 PICFLAGS="-shared -expect_unresolved '*' "
1127                 LDFLAGS="-call_shared"
1128         fi
1129         if test -z "$PICFLAGS"; then
1130                 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1131                         AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1132                         PICFLAGS="-fPIC -DPIC -shared"
1133                 else
1134                         AC_MSG_RESULT(no)
1135                         shared_modules=no
1136                 fi
1137         fi
1140 # This must be down here, or it will mess up checks like the ones
1141 # for -Wl,-export-dynamic
1142 # -- jilles
1143 AC_ARG_ENABLE(warnings,
1144 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1146 IRC_CFLAGS="$IRC_CFLAGS -O0"
1147 CFLAGS="$IRC_CFLAGS"
1149 SEVEN_C_GCC_TRY_FLAGS([-Wall], seven_cv_c_gcc_w_all)
1150 SEVEN_C_GCC_TRY_FLAGS([-Wpointer-arith], seven_cv_c_gcc_w_pointer_arith)
1151 SEVEN_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], seven_cv_c_gcc_w_implicit)
1152 SEVEN_C_GCC_TRY_FLAGS([-Wcast-align], seven_cv_c_gcc_w_cast_align)
1153 SEVEN_C_GCC_TRY_FLAGS([-Wcast-qual], seven_cv_c_gcc_w_cast_qual)
1154 SEVEN_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], seven_cv_c_gcc_prototypes)
1155 SEVEN_C_GCC_TRY_FLAGS([-Wparenthesis], seven_cv_c_gcc_parenthesis)
1156 SEVEN_C_GCC_TRY_FLAGS([-W -Wno-unused], seven_cv_c_gcc_w)
1157 SEVEN_C_GCC_TRY_FLAGS([-Wextra], seven_cv_c_gcc_w_extra)
1158 SEVEN_C_GCC_TRY_FLAGS([-Wshadow], seven_cv_c_gcc_w_shadow)
1159 SEVEN_C_GCC_TRY_FLAGS([-Wmissing-noreturn], seven_cv_c_gcc_w_missing_noreturn)
1160 SEVEN_C_GCC_TRY_FLAGS([-Wundef], seven_cv_c_gcc_w_undef)
1161 SEVEN_C_GCC_TRY_FLAGS([-Wpacked], seven_cv_c_gcc_w_packed)
1162 SEVEN_C_GCC_TRY_FLAGS([-Wnested-externs], seven_cv_c_gcc_w_nested_externs)
1163 SEVEN_C_GCC_TRY_FLAGS([-Wbad-function-cast], seven_cv_c_gcc_w_bad_function_cast)
1164 SEVEN_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], seven_cv_c_gcc_w_unused)
1165 SEVEN_C_GCC_TRY_FLAGS([-Wredundant-decls], seven_cv_c_gcc_w_redundant_decls)
1166 SEVEN_C_GCC_TRY_FLAGS([-Wfloat-equal], seven_cv_c_gcc_w_float_equal)
1167 SEVEN_C_GCC_TRY_FLAGS([-Wformat=2], seven_cv_c_gcc_w_format)
1168 SEVEN_C_GCC_TRY_FLAGS([-pedantic], seven_cv_c_gcc_pedantic)
1170 IRC_CFLAGS="$CFLAGS"
1171 ],[])
1173 if test "$shared_modules" = no; then
1174         DYNLINK_C=""
1175         MOD_TARGET="libmodules.a"
1176         MODULES_LIBS="../modules/libmodules.a"
1177         SEDOBJ=""
1178         AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1179         AC_MSG_WARN([shared module support has been disabled!])
1182 dnl Stage 5 - underscores in front of symbol names.
1183 if test "$shared_modules" = yes; then
1185         AC_CHECK_FUNC(nlist,,
1186                 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1187                         AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1188                 )
1189         )
1191         dnl We need to find out whether underscores are appended to symbol
1192         dnl names in executable files.  First, though, we need to see
1193         dnl where nlist.h is hiding.
1194         AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1195         AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1196         AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1197         if test x"$nlist_h" = "x"; then
1198                 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1199         else
1200                 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1201                 AC_CACHE_VAL(symbol_underscores,
1202                 [
1203 cat << EOF > conftest.c
1204 #include <$nlist_h>
1205 #include <stdio.h>
1206 #include <stdlib.h>
1207 void _modinit(void);
1208 int main(int argc, char *argv[[]]) {
1209         int i;
1210         struct nlist nl[[5]];
1212         /* fill the names in this way, so it'll work almost everywhere */
1213         nl[[0]].n_name = "_modinit";
1214         nl[[1]].n_name = "__modinit";
1215         nl[[2]].n_name = "___modinit";
1216         nl[[3]].n_name = "____modinit";
1217         nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1219         if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1220         for(i = 0; i < 4; i++) {
1221                 if(nl[[i]].n_value != NULL)
1222                 {
1223                         int j;
1224                         for(j = 0; j < i; j++)
1225                                 printf("_");
1226                         exit(i);
1227                 }
1228         }
1229         exit(-1);
1231 void _modinit(void) { return; }
1233                 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1234                 symbol_underscores=`./conftest conftest`
1235                 AC_MSG_RESULT($symbol_underscores)
1236                 $RM -f conftest conftest.c
1237                 ])
1238                 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1239         fi
1242 AC_SUBST(MODULES_LIBS)
1243 AC_SUBST(MOD_TARGET)
1245 AC_SUBST(SSL_SRCS_ENABLE)
1246 AC_SUBST(SSL_INCLUDES)
1247 AC_SUBST(SSL_LIBS)
1249 AC_SUBST(LDFLAGS)
1250 AC_SUBST(PICFLAGS)
1251 AC_SUBST(IRC_CFLAGS)
1252 AC_SUBST(SEDOBJ)
1255 if test "$prefix" = "NONE"; then 
1256         AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1258 else
1260 dnl Don't get bitten by Cygwin's stupidity if the user specified
1261 dnl a custom prefix with a trailing slash
1263         prefix=`echo $prefix | sed 's/\/$//'`
1264         AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1265         
1268 AC_CONFIG_FILES(                        \
1269         Makefile                        \
1270         libseven/Makefile               \
1271         servlink/Makefile               \
1272         extensions/Makefile             \
1273         unsupported/Makefile            \
1274         src/Makefile                    \
1275         modules/Makefile                \
1276         tools/Makefile                  \
1277         doc/Makefile                    \
1278         help/Makefile                   \
1281 AC_OUTPUT
1283 if test "$cf_openssl_version_ok" = yes; then
1284         openssl="yes"
1285 else
1286         openssl="no"
1289 if test "$shared_modules" = yes; then
1290         modules=shared
1291 else
1292         modules=static
1295 echo "
1296 Configuration:
1297         Install directory  : $prefix
1299         Ziplinks           : $zlib
1300         OpenSSL            : $openssl
1301         Modules            : $modules
1302         IPv6 support       : $have_v6
1303         Socket Engine      : $SELECT_TYPE
1304         Small network      : $small_net
1305         Block allocator    : $balloc
1306         ASM hashing code   : $ricer_hashing
1308         Nickname length    : $NICKLEN
1309         Topic length       : $TOPICLEN
1311 Use make to compile ircd-seven, then make install to install it.