Drop unused variable m_bn.
[seven-1.x.git] / configure.ac
blob3772d3f31b06ebcbdf8df2c8a15d388e1dc5a7eb
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)
9 AC_INIT([ircd-seven],[0.9.0])
10 AC_CONFIG_HEADER(include/setup.h)
11 AC_PREFIX_DEFAULT($HOME/ircd)
13 AC_GNU_SOURCE
15 OLD_CFLAGS="$CFLAGS"
16 dnl Checks for programs.
17 AC_PROG_CC
18 AC_LANG(C)
20 dnl Make sure autoconf doesn't interfere with cflags -jmallett
21 CFLAGS="$OLD_CFLAGS"
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
28 SGS=no
29 AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
30 case `$CC -version 2>&1` in
31 *TenDRA*)
32         AC_MSG_RESULT([yes, TenDRA])
33         IRC_CFLAGS=""
34         CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
35         SGS=yes
36         TenDRA=yes
38 *MIPSpro*)
39         AC_MSG_RESULT([yes, MIPSpro])
40         MIPSpro=yes
41         SGS=yes
44         AC_MSG_RESULT(no)
45         TenDRA=no
46         MIPSpro=no
48 esac
50 AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
51 case `$CC -V 2>&1` in
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"
55         SunWorkShop=yes
56         SGS=yes
58 *Tru64*)
59         AC_MSG_RESULT(Tru64 cc)
60         IRC_CFLAGS="-O2"
61         CPPFLAGS="-I/usr/local/include"
62         Tru=yes
64 *HP*ANSI*)
65         AC_MSG_RESULT(HPUX cc)
66         HPUX=yes
67         IRC_CFLAGS="+e"
70         AC_MSG_RESULT(no)
72 esac
76 AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
77 OSNAME=`uname -s`
78 case "$OSNAME" in
79         HP-UX*)
80         dnl only do this if we haven't already detected the newer one
81         dnl and we're not already using gcc
82         
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"
86                         HPUX=yes
87                 else
88                         AC_MSG_RESULT(already using newer HPUX)
89                 fi
90         ;;
91         CYGWIN*)
92                 AC_MSG_RESULT(Cygwin)
93                 CYGWIN=yes
94         ;;
95         SunOS*)
96                 AC_MSG_RESULT(SunOS or Solaris)
97                 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
98                 SUN=yes
99         ;;
100         AIX*)
101                 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
102                 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
103         ;;
104         *)
105                 AC_MSG_RESULT(no)
106         ;;
107 esac
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
113         *Apple*)
114                 AC_MSG_RESULT(yes)
115                 AppleGCC=yes
116         ;;
117         *)
118                 AC_MSG_RESULT(no)
119                 AppleGCC=no
120         ;;
121         esac
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"
131         else
132                 IRC_CFLAGS="$IRC_CFLAGS -g"
133         fi
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
139         AC_MSG_RESULT(yes)
140 else
141         AC_MSG_RESULT(no)
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)
150 STDOUT="> .depend"
152 if test "$ac_cv_c_compiler_gnu" = yes; then
153         AC_MSG_RESULT(gcc -MM)
154         MKDEP="$CC -MM"
155 elif test ! -z "$MKDEP"; then
156         AC_MSG_RESULT(mkdep)
158         dnl Tru64's mkdep is very loud
159         if test -z "$Tru"; then
160                 STDOUT=""
161         else
162                 STDOUT=" 2> /dev/null"
163         fi
164 elif test "$SunWorkShop" = yes; then
165         AC_MSG_RESULT($CC -xM)
166         MKDEP="$CC -xM"
167         STDOUT="> .depend 2> /dev/null"
168 elif test ! -z "$MAKEDEPEND"; then
169         AC_MSG_RESULT(makedepend)
170         MKDEP="$MAKEDEPEND -f-"
171 else
172         AC_MSG_RESULT([nothing suitable.. forget it!])
173         MKDEP=":"
176 AC_SUBST(MKDEP)
177 AC_SUBST(STDOUT)
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])
183         AC_MSG_RESULT(yes)
184 else
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"
196 AC_ISC_POSIX
197 AC_C_INLINE
198 AC_PROG_GCC_TRADITIONAL
199 AC_PROG_MAKE_SET
200 AC_PROG_INSTALL
201 AC_PATH_PROG(RM, rm)
202 AC_PATH_PROG(CP, cp)
203 AC_PATH_PROG(MV, mv)
204 AC_PATH_PROG(LN, ln)
205 AC_PATH_PROG(SED, sed)
206 AC_PATH_PROG(AR, ar)
207 AC_PATH_PROG(LD, ld)
208 AC_PATH_PROG(RANLIB, ranlib)
209 AC_PATH_PROG(TOUCH, touch)
211 AC_PROG_YACC
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])
218 AC_PROG_LEX
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.
232 AC_HEADER_STDC
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 ==================================================
239 AC_C_CONST
240 if test "$ac_cv_header_machine_endian_h" = "no" ; then
241     AC_C_BIGENDIAN
243 AC_TYPE_PID_T
244 AC_TYPE_SIZE_T
245 AC_CHECK_SIZEOF(short)
246 AC_CHECK_SIZEOF(int)
247 AC_CHECK_SIZEOF(long)
248 AC_CHECK_SIZEOF(long long)
250 dnl Memory manager
251 dnl ==============
253 AC_MSG_CHECKING([the system's memory page size])
254 pagesize="no"
255 AC_TRY_RUN([
256 #include <stdio.h>
257 #if HAVE_UNISTD_H
258 # include <unistd.h>
259 #endif
261 int main(void) {
262     FILE *fp = fopen("conftest.malloc", "w");
264     if (fp != NULL) {
265         fprintf(fp, "%d\n", getpagesize());
266         fclose(fp);
267     } else
268         exit(1);
269     exit(0);
270 }],[
271 if test -f "conftest.malloc" ; then
272     pagesize=`cat conftest.malloc`
275 if test "$pagesize" != "no" ; then
276     AC_MSG_RESULT($pagesize)
277 else
278     if test "$ac_cv_sizeof_int" = "4" ; then
279         pagesize=4096
280     else
281         pagesize=8192
282     fi
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>])
309 AC_ARG_ENABLE(ipv6,
310 AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
312 if test $ipv6 != yes; then
313         have_v6="no"
314 else
315 AC_MSG_CHECKING([for core IPv6 support])
317 AC_COMPILE_IFELSE(
318 [AC_LANG_PROGRAM(
319         [[#define IN_AUTOCONF
320         #include <sys/types.h>
321         #include <sys/socket.h>
322         #include <netinet/in.h>]],
323         [[struct sockaddr_in6 s; 
324           s.sin6_family = 0;]]
325         )],
327         if test "$CYGWIN" = "yes"; then
328                 AC_MSG_RESULT([no, Cygwin's IPv6 is incomplete])
329                 have_v6=no
330         else
331                 have_v6=yes
332                 AC_DEFINE(IPV6, 1, [Define if IPv6 support is present and available.])
333                 AC_MSG_RESULT(yes)
334                 AC_MSG_CHECKING([for struct in6addr_any])
335                 AC_COMPILE_IFELSE(
336                         [AC_LANG_PROGRAM(
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;]]
342                         )],
343                         [AC_MSG_RESULT(yes)],
344                         [
345                                 AC_MSG_RESULT(no)
346                                 AC_DEFINE(NO_IN6ADDR_ANY, 1, [Define to 1 if your system has no in6addr_any.])
347                                 inet_misc=1
348                         ]
349                 )
350         fi
352 [AC_MSG_RESULT(no)
353 have_v6="no"])
356 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
358 CRYPT_LIB=$ac_cv_search_crypt
360 if test "$CRYPT_LIB" = "none required"; then
361         unset CRYPT_LIB
362 elif test "$CRYPT_LIB" = no; then
363         unset CRYPT_LIB
366 AC_SUBST(CRYPT_LIB)
368 if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
369         VICONF=viconf
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.
373 else
374         VICONF=""
377 AC_SUBST(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,
383         AC_COMPILE_IFELSE(
384         [#include <string.h>
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])
394 AC_C_BIGENDIAN
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)
405 save_CFLAGS=$CFLAGS
406 CFLAGS="$CFLAGS -Wimplicit -Werror"
408 AC_LINK_IFELSE(
409         [AC_LANG_PROGRAM(
410                 [[#include <string.h>
411                 #include <stdlib.h>]],
412                 [[char *a = malloc(6);
413                 strlcpy(a, "hello", 6);]]
414         )],
415         [AC_MSG_RESULT(yes)
416         AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
417         [AC_MSG_RESULT(no)]
420 AC_MSG_CHECKING(for strlcat)
421 AC_LINK_IFELSE(
422         [AC_LANG_PROGRAM(
423                 [[#include <string.h>
424                 #include <stdlib.h>]],
425                 [[char *a = malloc(6);
426                 a[0] = '\0';
427                 strlcat(a, "hello", 6);]]
428         )],
429         [AC_MSG_RESULT(yes)
430         AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
431         [AC_MSG_RESULT(no)]
434 CFLAGS=$save_CFLAGS
436 else
438 dnl Better than nothing. The more complicated test above probably fixes powerpc,
439 dnl so who cares.
441 AC_CHECK_FUNCS([strlcat strlcpy])
445 AC_CHECK_TYPE([u_int32_t], [],
447         AC_CHECK_TYPE([uint32_t],
448         [
449                 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
450         ],
451         [
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.])
454         ])
457 AC_CHECK_TYPE([u_int16_t], [],
459         AC_CHECK_TYPE([uint16_t],
460         [
461                 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
462         ],
463         [
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.])
466         ])
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 ])
484 AC_FUNC_ALLOCA
486 dnl Specialized functions checks
487 dnl ============================
489 dnl check for nanosleep          
490 AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
491                  LIBS="${LIBS} -lrt",
492                  [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
493                  )])])
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
495 then     
496          AC_MSG_RESULT("nanosleep not found..using select for delay")
497 else     
498          AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
501 dnl OpenSSL support
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/\/$//'`"
515         else
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}"
521                         break
522                         fi
523                 done
524                 unset dirs
525         fi
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"
531                 else
532                 dnl OpenSSL wasn't found in the directory specified.  Naughty
533                 dnl administrator...
534                 cf_openssl_basedir=""
535                 fi
536         else
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"
545                 fi
546         fi
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"
553         else
554                 AC_MSG_RESULT([not found. Specify a correct path?])
555                 cf_enable_openssl="no"
556         fi
557         unset cf_openssl_basedir
558 else
559         dnl If --disable-openssl was specified
560         AC_MSG_RESULT(disabled)
563 save_CPPFLAGS="$CPPFLAGS"
564 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
565 save_LIBS="$LIBS"
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)
570         AC_RUN_IFELSE(
571                 AC_LANG_PROGRAM(
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
581                 AC_MSG_RESULT(found)
583                 dnl Work around pmake/gmake conditional incompatibilities
584                 AC_SUBST(ENCSPEED, encspeed)
585                 
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)'
591         else
592                 AC_MSG_RESULT(no - OpenSSL support disabled)
593         fi
596 CPPFLAGS="$save_CPPFLAGS"
597 LIBS="$save_LIBS"
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"],)
609 AC_ARG_ENABLE(zlib,
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,
617         [
618                 AC_SUBST(ZLIB_LD, -lz)
619                 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
620         ], zlib=no)
621 ], zlib=no)
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"
631   else
632         use_poll=no
633   fi
636 AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
637 [ if test $enableval = yes; then 
638         SELECT_TYPE_EXPLICIT="select" 
639   else
640         use_select=no
641   fi
644 AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
645 [ if test $enableval = yes; then 
646         SELECT_TYPE_EXPLICIT="kqueue"
647   else
648         use_kqueue=no
649   fi
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])
657   else
658         use_devpoll=no;
659   fi
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"
665   else
666         use_epoll=no
667   fi
670 dnl **********************************************************************
671 dnl Check for --with-confdir
672 dnl **********************************************************************
674 AC_MSG_CHECKING([whether to modify confdir])
675 AC_ARG_WITH(confdir, 
676 AC_HELP_STRING([--with-confdir=DIR],
677                [Directory to install config files.]),
678                [ confdir=`echo $withval | sed 's/\/$//'`
679                  AC_MSG_RESULT(yes)
680                  AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
681                  AC_SUBST_DIR([confdir]) ],
682                [ confdir='${prefix}/etc'
683                  AC_MSG_RESULT(no)
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])
693 AC_ARG_WITH(logdir, 
694 AC_HELP_STRING([--with-logdir=DIR],
695                [Directory where to write logfiles.]),
696                [ logdir=`echo $withval | sed 's/\/$//'`
697                  AC_MSG_RESULT(yes)
698                  AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
699                  AC_SUBST_DIR([logdir]) ],
700                [ logdir='${prefix}/logs'
701                  AC_MSG_RESULT(no)
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])
711 AC_ARG_WITH(helpdir, 
712 AC_HELP_STRING([--with-helpdir=DIR],
713                [Directory to install help files.]),
714                [ helpdir=`echo $withval | sed 's/\/$//'`
715                  AC_MSG_RESULT(yes)
716                  AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
717                  AC_SUBST_DIR([helpdir]) ],
718                [ helpdir='${prefix}/help'
719                  AC_MSG_RESULT(no)
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/\/$//'`
733                  AC_MSG_RESULT(yes)
734                  AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
735                  AC_SUBST_DIR([moduledir]) ],
736                [ moduledir='${prefix}/modules'
737                  AC_MSG_RESULT(no)
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"
745 else
747 if test ! "x$use_select" = "xno"; then
748         AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
749         if test "x$haveselect" = "xyes" ; then
750                 SELECT_TYPE="select"
751         fi
754 if test ! "x$use_poll" = "xno"; then
755         AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
756         if test "x$havepoll" = "xyes" ; then
757                 SELECT_TYPE="poll"
758         fi
761 if test ! "x$use_devpoll" = "xno"; then
762         AC_MSG_CHECKING(for /dev/poll)
763         if test -c "/dev/poll"; then
764                 AC_MSG_RESULT(yes)
765                 AC_CHECK_HEADERS([devpoll.h sys/devpoll.h])
766                 SELECT_TYPE="devpoll"
767         else
768                 AC_MSG_RESULT(no)       
769         fi
772 if test ! "x$use_kqueue" = "xno"; then
773         AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
774         if test "x$havekqueue" = "xyes" ; then
775                 SELECT_TYPE="kqueue"
776         fi
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)
784                         AC_TRY_RUN(
785 #include <stdint.h>
786 #include <sys/param.h>
787 #include <sys/types.h>
788 #include <sys/epoll.h>
789 #include <sys/syscall.h>
790 #include <unistd.h>     
793 main(int argc, char **argv)
795         int epfd;
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))
804                 fi
805         fi
807 haveepollsyscall=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)
812                 AC_TRY_RUN(
813 #include <stdint.h>
814 #include <sys/param.h>
815 #include <sys/types.h>
816 #include <sys/epoll.h>
817 #include <sys/syscall.h>
818 #include <unistd.h>     
821 epoll_create(int size)
823         return (syscall(__NR_epoll_create, size));
827 main(int argc, char **argv)
829         int epfd;
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))
838         fi
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
868         assert = "hard";
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.])
878         AC_MSG_RESULT(yes)
879 else
880         AC_MSG_RESULT(no)
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.])
894         else
895                 AC_MSG_RESULT([no, profile builds only work with gcc])
896         fi
897 else
898         AC_MSG_RESULT(no)
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.])
929 else
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.])
948 AC_ARG_WITH(nicklen,
949 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
951   if test $withval -ge 50; then
952         NICKLEN=50
953         AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
954   else
955         NICKLEN="$withval"
956   fi
957 ], [NICKLEN=15])
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
963         TOPICLEN=390
964         AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
965  else
966         TOPICLEN=$withval
967  fi
968 ], [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
976         MAX_CLIENTS=3000
979 if test $MAX_CLIENTS -gt 65536; then
980         MAX_CLIENTS=65536
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
994         
995         if test "$CYGWIN" = yes; then
996                 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
997                 shared_modules="no"
998         fi
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])
1003                 shared_modules="no"
1004         fi
1007 dnl Second stage: check for functions and headers.
1008 if test "$shared_modules" = yes; then
1009         DYNLINK_C=dynlink.c
1010         AC_CHECK_HEADERS(dlfcn.h)
1011         AC_SEARCH_LIBS(shl_load, dld, 
1012         [
1013           AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1014           SUFFIX=".sl"
1015           MOD_TARGET=hpux_shared
1016           SEDOBJ="s/\.o/.sl/g"  
1017         ],
1018         dnl !shl_load:
1019         [
1020           dnl standard dlopen
1021           AC_SEARCH_LIBS(dlopen, [dl c_r],
1022           [
1023             AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1024             SUFFIX=".so"
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])
1029             fi
1030             AC_CHECK_FUNC(dlsym, ,
1031             [
1032               AC_MSG_WARN([dlsym is not available, shared modules disabled])
1033               shared_modules=no
1034             ])
1035             AC_CHECK_FUNCS(dlfunc)
1036           ],
1037           [
1038             shared_modules=no
1039           ])
1040         ])
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"
1058         fi
1059         
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"
1063         fi
1065         AC_MSG_RESULT($found)
1067         if test "$found" = yes; then
1068                 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1069         fi
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"
1078         fi
1079         
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"
1083         fi
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.
1090         dnl -TimeMr14C
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])
1095                 
1096                 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then 
1097                         AC_MSG_RESULT(no)
1098                 else
1099                         AC_MSG_RESULT(yes)
1100                         PICFLAGS="$PICFLAGS +ESfic"
1101                 fi
1103                 LDFLAGS="${LDFLAGS} -Wl,-E"
1104         fi
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"
1109         fi
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"
1114                 else
1115                         AC_MSG_RESULT(no)
1116                         shared_modules=no
1117                 fi
1118         fi
1121 # This must be down here, or it will mess up checks like the ones
1122 # for -Wl,-export-dynamic
1123 # -- jilles
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"
1152 ],[])
1154 if test "$shared_modules" = no; then
1155         DYNLINK_C=""
1156         MOD_TARGET="libmodules.a"
1157         MODULES_LIBS="../modules/libmodules.a"
1158         SEDOBJ=""
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",)
1169                 )
1170         )
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.])
1180         else
1181                 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1182                 AC_CACHE_VAL(symbol_underscores,
1183                 [
1184 cat << EOF > conftest.c
1185 #include <$nlist_h>
1186 #include <stdio.h>
1187 #include <stdlib.h>
1188 void _modinit(void);
1189 int main(int argc, char *argv[[]]) {
1190         int i;
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)
1203                 {
1204                         int j;
1205                         for(j = 0; j < i; j++)
1206                                 printf("_");
1207                         exit(i);
1208                 }
1209         }
1210         exit(-1);
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
1218                 ])
1219                 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1220         fi
1223 AC_SUBST(MODULES_LIBS)
1224 AC_SUBST(MOD_TARGET)
1226 AC_SUBST(SSL_SRCS_ENABLE)
1227 AC_SUBST(SSL_INCLUDES)
1228 AC_SUBST(SSL_LIBS)
1230 AC_SUBST(LDFLAGS)
1231 AC_SUBST(PICFLAGS)
1232 AC_SUBST(IRC_CFLAGS)
1233 AC_SUBST(SEDOBJ)
1236 if test "$prefix" = "NONE"; then 
1237         AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1239 else
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.])
1246         
1249 AC_CONFIG_FILES(                        \
1250         Makefile                        \
1251         libseven/Makefile               \
1252         servlink/Makefile               \
1253         extensions/Makefile             \
1254         src/Makefile                    \
1255         modules/Makefile                \
1256         tools/Makefile                  \
1257         doc/Makefile                    \
1258         help/Makefile                   \
1261 AC_OUTPUT
1263 if test "$cf_openssl_version_ok" = yes; then
1264         openssl="yes"
1265 else
1266         openssl="no"
1269 if test "$shared_modules" = yes; then
1270         modules=shared
1271 else
1272         modules=static
1275 echo "
1276 Configuration:
1277         Install directory  : $prefix
1279         Ziplinks           : $zlib
1280         OpenSSL            : $openssl
1281         Modules            : $modules
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.