]> jfr.im git - irc/rqf/shadowircd.git/blame - configure.ac
It compiles, ship it.
[irc/rqf/shadowircd.git] / configure.ac
CommitLineData
88cb7f99 1dnl $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $
212380e3 2dnl Process this file with autoconf to produce a configure script.
3
4dnl TODO: clean up all the OpenSSL and shared module checking stuff;
5dnl the most major changes have already been made and it looks like
6dnl said functions need to be just about as complex as they already are.
7
8AC_PREREQ(2.57)
9
10dnl Sneaky way to get an Id tag into the configure script
88cb7f99 11AC_COPYRIGHT([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $])
212380e3 12
88cb7f99 13AC_INIT([charybdis],[2.3])
212380e3 14
15AC_CONFIG_HEADER(include/setup.h)
16
17AC_PREFIX_DEFAULT($HOME/ircd)
18
19AC_GNU_SOURCE
20
21OLD_CFLAGS="$CFLAGS"
22dnl Checks for programs.
23AC_PROG_CC
24AC_LANG(C)
25
26dnl Make sure autoconf doesn't interfere with cflags -jmallett
27CFLAGS="$OLD_CFLAGS"
28
29dnl Check for various compilers. -jmallett
30dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk
31
32if test "$ac_cv_c_compiler_gnu" != yes; then
33
34SGS=no
35AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
36case `$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
43;;
44*MIPSpro*)
45 AC_MSG_RESULT([yes, MIPSpro])
46 MIPSpro=yes
47 SGS=yes
48;;
49*)
50 AC_MSG_RESULT(no)
51 TenDRA=no
52 MIPSpro=no
53;;
54esac
55
56AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
57case `$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
63;;
64*Tru64*)
65 AC_MSG_RESULT(Tru64 cc)
66 IRC_CFLAGS="-O2"
67 CPPFLAGS="-I/usr/local/include"
68 Tru=yes
69;;
70*HP*ANSI*)
71 AC_MSG_RESULT(HPUX cc)
72 HPUX=yes
73 IRC_CFLAGS="+e"
74;;
75*)
76 AC_MSG_RESULT(no)
77;;
78esac
79
80fi
81
82AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX])
83OSNAME=`uname -s`
84case "$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 ;;
113esac
114
115if test "$ac_cv_c_compiler_gnu" = yes; then
116 AC_MSG_CHECKING(if $CC is Apple GCC)
117
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
128
129 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
130fi
131
132dnl If we support -g, use it!
133if 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
140fi
141
142dnl SVR4 SGS based on what we know about the compiler -jmallett
143AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces)
144if test "$SGS" = "yes"; then
145 AC_MSG_RESULT(yes)
146else
147 AC_MSG_RESULT(no)
148fi
149
150dnl We prefer gcc -MM because it's a lot less bloated
151AC_PATH_PROG(MKDEP, mkdep)
152AC_PATH_PROG(MAKEDEPEND, makedepend)
153
154AC_MSG_CHECKING(how to generate dependency info)
155
156STDOUT="> .depend"
157
158if test "$ac_cv_c_compiler_gnu" = yes; then
159 AC_MSG_RESULT(gcc -MM)
160 MKDEP="$CC -MM"
161elif test ! -z "$MKDEP"; then
162 AC_MSG_RESULT(mkdep)
163
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
170elif test "$SunWorkShop" = yes; then
171 AC_MSG_RESULT($CC -xM)
172 MKDEP="$CC -xM"
173 STDOUT="> .depend 2> /dev/null"
174elif test ! -z "$MAKEDEPEND"; then
175 AC_MSG_RESULT(makedepend)
176 MKDEP="$MAKEDEPEND -f-"
177else
178 AC_MSG_RESULT([nothing suitable.. forget it!])
179 MKDEP=":"
180fi
181
182AC_SUBST(MKDEP)
183AC_SUBST(STDOUT)
184
185dnl check for /dev/null so we can use it to hold evil fd's
186AC_MSG_CHECKING([for /dev/null])
187if test -c /dev/null ; then
188 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
189 AC_MSG_RESULT(yes)
190else
191 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
192 AC_MSG_RESULT(no - using devnull.log)
193fi
194
195dnl jdc -- If CFLAGS is defined, best use it everywhere...
196dnl NOTE: jv says it must be added to the *END*, because things like
197dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
198if test ! -z "$CFLAGS"; then
199 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
200fi
201
202AC_ISC_POSIX
203AC_C_INLINE
204AC_PROG_GCC_TRADITIONAL
205AC_PROG_MAKE_SET
206AC_PROG_INSTALL
207AC_PATH_PROG(RM, rm)
208AC_PATH_PROG(CP, cp)
209AC_PATH_PROG(MV, mv)
210AC_PATH_PROG(LN, ln)
211AC_PATH_PROG(SED, sed)
212AC_PATH_PROG(AR, ar)
213AC_PATH_PROG(LD, ld)
214AC_PATH_PROG(RANLIB, ranlib)
215AC_PATH_PROG(TOUCH, touch)
216
217AC_PROG_YACC
218
219dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
220if 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])
222fi
223
224AC_PROG_LEX
225
226if test "$LEX" = ":"; then
227 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
228fi
229
230dnl use directory structure of cached as default (hack)
231if test "$libexecdir" = '${exec_prefix}/libexec' &&
232 test "$localstatedir" = '${prefix}/var'; then
233 libexecdir='${bindir}'
234 localstatedir='${prefix}'
235fi
236
237dnl Checks for header files.
238AC_HEADER_STDC
239
240AC_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])
241
242dnl Stuff that the memory manager (imalloc) depends on
243dnl ==================================================
244
245AC_C_CONST
246if test "$ac_cv_header_machine_endian_h" = "no" ; then
247 AC_C_BIGENDIAN
248fi
249AC_TYPE_PID_T
250AC_TYPE_SIZE_T
251AC_CHECK_SIZEOF(short)
252AC_CHECK_SIZEOF(int)
253AC_CHECK_SIZEOF(long)
254AC_CHECK_SIZEOF(long long)
255
256dnl Memory manager
257dnl ==============
258
259AC_MSG_CHECKING([the system's memory page size])
260pagesize="no"
261AC_TRY_RUN([
262#include <stdio.h>
263#if HAVE_UNISTD_H
264# include <unistd.h>
265#endif
266
267int main(void) {
268 FILE *fp = fopen("conftest.malloc", "w");
269
270 if (fp != NULL) {
271 fprintf(fp, "%d\n", getpagesize());
272 fclose(fp);
273 } else
274 exit(1);
275 exit(0);
276}],[
277if test -f "conftest.malloc" ; then
278 pagesize=`cat conftest.malloc`
279fi
280])
281if test "$pagesize" != "no" ; then
282 AC_MSG_RESULT($pagesize)
283else
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)])
290fi
291AC_DEFINE_UNQUOTED(MALLOC_PAGESIZE, $pagesize,
292 [the system's memory page size])
293
294dnl Networking Functions
295dnl ====================
296
297AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
298
299dnl SunOS/Solaris required libnsl for inet_ntoa()
300if test x"$SUN" = xyes; then
301 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
302fi
303
304AC_CHECK_MEMBER([struct sockaddr.sa_len], [AC_DEFINE(SOCKADDR_IN_HAS_LEN, 1, [Define to 1 if sockaddr has a 'sa_len'
305member.])],,[[#include <sys/types.h>
306#include <sys/socket.h>
307]])
308
309AC_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>])
314
315AC_ARG_ENABLE(ipv6,
316AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
317
318if test $ipv6 != yes; then
319 have_v6="no"
320else
321AC_MSG_CHECKING([for core IPv6 support])
322
323AC_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 )],
332[
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
357],
358[AC_MSG_RESULT(no)
359have_v6="no"])
360fi
361
362AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
363
364CRYPT_LIB=$ac_cv_search_crypt
365
366if test "$CRYPT_LIB" = "none required"; then
367 unset CRYPT_LIB
368elif test "$CRYPT_LIB" = no; then
369 unset CRYPT_LIB
370fi
371
372AC_SUBST(CRYPT_LIB)
373
374if 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.
379else
380 VICONF=""
381fi
382
383AC_SUBST(VICONF)
384
385dnl See whether we can include both string.h and strings.h.
386AC_CACHE_CHECK([whether string.h and strings.h may both be included],
387gcc_cv_header_string,
388[
389 AC_COMPILE_IFELSE(
390 [#include <string.h>
391 #include <strings.h>],
392 [gcc_cv_header_string=yes],
393 [gcc_cv_header_string=no])
394])
395
396if 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])
398fi
399
400AC_C_BIGENDIAN
401
402dnl Check for stdarg.h - if we can't find it, halt configure
403AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])])
404
405dnl Checks for the existence of strlcat, strlcpy, basename...
406dnl This more reliable test only works with gcc though.
407
408if test "$ac_cv_c_compiler_gnu" = yes; then
409
410AC_MSG_CHECKING(for strlcpy)
411save_CFLAGS=$CFLAGS
412CFLAGS="$CFLAGS -Wimplicit -Werror"
413
414AC_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)]
424)
425
426AC_MSG_CHECKING(for strlcat)
427AC_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)]
438)
439
440CFLAGS=$save_CFLAGS
441
442else
443
444dnl Better than nothing. The more complicated test above probably fixes powerpc,
445dnl so who cares.
446
447AC_CHECK_FUNCS([strlcat strlcpy])
448
449fi
450
451AC_CHECK_TYPE([u_int32_t], [],
452[
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 ])
461])
462
463AC_CHECK_TYPE([u_int16_t], [],
464[
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 ])
473])
474
475AC_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>]])
479
480AC_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>]])
484
485AC_CHECK_TYPES([uintptr_t])
486
487dnl check for various functions...
488AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
489
490AC_FUNC_ALLOCA
491
492dnl Specialized functions checks
493dnl ============================
494
495dnl check for nanosleep
496AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
497 LIBS="${LIBS} -lrt",
498 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
499 )])])
500if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
501then
502 AC_MSG_RESULT("nanosleep not found..using select for delay")
503else
504 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
505fi
506
507dnl OpenSSL support
508AC_MSG_CHECKING(for OpenSSL)
509AC_ARG_ENABLE(openssl,
510[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
511AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
512[cf_enable_openssl=$enableval],
513[cf_enable_openssl="auto"])
514
515if 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
553
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
564else
565 dnl If --disable-openssl was specified
566 AC_MSG_RESULT(disabled)
567fi
568
569save_CPPFLAGS="$CPPFLAGS"
570CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
571save_LIBS="$LIBS"
572LIBS="$LIBS $SSL_LIBS"
573if 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)
585
586 if test "$cf_openssl_version_ok" = yes; then
587 AC_MSG_RESULT(found)
588
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
600fi
601
602CPPFLAGS="$save_CPPFLAGS"
603LIBS="$save_LIBS"
604
605dnl End OpenSSL detection
606
607
608dnl Specialized functions and libraries
609dnl ===================================
610
611AC_ARG_WITH(zlib-path,
612AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
613[LIBS="$LIBS -L$withval"],)
614
615AC_ARG_ENABLE(zlib,
616AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
617[zlib=$enableval],[zlib=yes])
618
619if test "$zlib" = yes; then
620
621AC_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)
628
629fi
630
631dnl IO Loop Selection
632dnl =================
633
1b4cfad8 634AC_ARG_ENABLE(ports, AC_HELP_STRING([--enable-ports],[Force solaris I/O ports subsystem usage.]),
635[ if test $enableval = yes; then
636 SELECT_TYPE_EXPLICIT="ports"
637 else
638 use_ports=no
639 fi
640],)
641
212380e3 642AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
643[ if test $enableval = yes; then
644 SELECT_TYPE_EXPLICIT="poll"
645 else
646 use_poll=no
647 fi
648],)
649
650AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
651[ if test $enableval = yes; then
652 SELECT_TYPE_EXPLICIT="select"
653 else
654 use_select=no
655 fi
656],)
657
658AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
659[ if test $enableval = yes; then
660 SELECT_TYPE_EXPLICIT="kqueue"
661 else
662 use_kqueue=no
663 fi
664],)
665
212380e3 666AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
667[ if test $enableval = yes; then
668 SELECT_TYPE_EXPLICIT="epoll"
a34ec229 669 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
212380e3 670 else
671 use_epoll=no
672 fi
673],)
674
675dnl **********************************************************************
676dnl Check for --with-confdir
677dnl **********************************************************************
678
679AC_MSG_CHECKING([whether to modify confdir])
680AC_ARG_WITH(confdir,
681AC_HELP_STRING([--with-confdir=DIR],
682 [Directory to install config files.]),
683 [ confdir=`echo $withval | sed 's/\/$//'`
684 AC_MSG_RESULT(yes)
685 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
686 AC_SUBST_DIR([confdir]) ],
687 [ confdir='${prefix}/etc'
688 AC_MSG_RESULT(no)
689 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
690 AC_SUBST_DIR([confdir])]
691)
692
693dnl **********************************************************************
694dnl Check for --with-logdir
695dnl **********************************************************************
696
697AC_MSG_CHECKING([whether to modify logdir])
698AC_ARG_WITH(logdir,
699AC_HELP_STRING([--with-logdir=DIR],
700 [Directory where to write logfiles.]),
701 [ logdir=`echo $withval | sed 's/\/$//'`
702 AC_MSG_RESULT(yes)
703 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
704 AC_SUBST_DIR([logdir]) ],
705 [ logdir='${prefix}/logs'
706 AC_MSG_RESULT(no)
707 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
708 AC_SUBST_DIR([logdir])]
709)
710
711dnl **********************************************************************
712dnl Check for --with-helpdir
713dnl **********************************************************************
714
715AC_MSG_CHECKING([whether to modify helpdir])
716AC_ARG_WITH(helpdir,
717AC_HELP_STRING([--with-helpdir=DIR],
718 [Directory to install help files.]),
719 [ helpdir=`echo $withval | sed 's/\/$//'`
720 AC_MSG_RESULT(yes)
721 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
722 AC_SUBST_DIR([helpdir]) ],
723 [ helpdir='${prefix}/help'
724 AC_MSG_RESULT(no)
725 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
726 AC_SUBST_DIR([helpdir])]
727)
728
729dnl **********************************************************************
730dnl Check for --with-moduledir
731dnl **********************************************************************
732
733AC_MSG_CHECKING([whether to modify moduledir])
734AC_ARG_WITH(moduledir,
735AC_HELP_STRING([--with-moduledir=DIR],
736 [Directory to install modules.]),
737 [ moduledir=`echo $withval | sed 's/\/$//'`
738 AC_MSG_RESULT(yes)
739 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
740 AC_SUBST_DIR([moduledir]) ],
741 [ moduledir='${prefix}/modules'
742 AC_MSG_RESULT(no)
743 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
744 AC_SUBST_DIR([moduledir])]
745)
746
747if test ! -z "$SELECT_TYPE_EXPLICIT"; then
748 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
749 echo "Forcing $SELECT_TYPE to be enabled"
750else
751
1b4cfad8 752if test ! "x$use_ports" = "xno"; then
753 AC_CHECK_FUNCS(port_getn, [haveports=yes], [haveports=no])
754 if test "x$haveports" = "xyes" ; then
755 SELECT_TYPE="ports"
756 fi
757fi
758
212380e3 759if test ! "x$use_select" = "xno"; then
760 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
761 if test "x$haveselect" = "xyes" ; then
762 SELECT_TYPE="select"
763 fi
764fi
765
766if test ! "x$use_poll" = "xno"; then
767 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
768 if test "x$havepoll" = "xyes" ; then
769 SELECT_TYPE="poll"
770 fi
771fi
772
212380e3 773if test ! "x$use_kqueue" = "xno"; then
774 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
775 if test "x$havekqueue" = "xyes" ; then
776 SELECT_TYPE="kqueue"
777 fi
778fi
779
780if test ! "x$use_epoll" = "xno"; then
781 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
782 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
783 if test "x$haveepoll" = "xyes" ; then
784 AC_MSG_CHECKING(for epoll support in kernel)
785 AC_TRY_RUN(
786#include <stdint.h>
787#include <sys/param.h>
788#include <sys/types.h>
789#include <sys/epoll.h>
790#include <sys/syscall.h>
791#include <unistd.h>
792
793int
794main(int argc, char **argv)
795{
796 int epfd;
797
798 epfd = epoll_create(256);
799 exit (epfd == -1 ? 1 : 0);
800}, [AC_MSG_RESULT(yes)
801 AC_DEFINE(HAVE_EPOLL, 1,
802 [Define if your system supports the epoll system calls])
803 SELECT_TYPE="epoll"],
804 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
805 fi
806 fi
807
808haveepollsyscall=no
809
810if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
811 if test "x$haveepoll" = "xno" ; then
812 AC_MSG_CHECKING(for epoll system call)
813 AC_TRY_RUN(
814#include <stdint.h>
815#include <sys/param.h>
816#include <sys/types.h>
817#include <sys/epoll.h>
818#include <sys/syscall.h>
819#include <unistd.h>
820
821int
822epoll_create(int size)
823{
824 return (syscall(__NR_epoll_create, size));
825}
826
827int
828main(int argc, char **argv)
829{
830 int epfd;
831
832 epfd = epoll_create(256);
833 exit (epfd == -1 ? 1 : 0);
834}, [AC_MSG_RESULT(yes)
835 AC_DEFINE(HAVE_EPOLL, 1,
836 [Define if your system supports the epoll system calls])
837 SELECT_TYPE="epoll"],
838 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
839 fi
840fi
841
842fi
843
844fi
845
846if test -z "$SELECT_TYPE"; then
847 AC_MSG_ERROR([Unable to find a usable IO interface],)
848fi
849
850echo "Using $SELECT_TYPE for select loop."
851
852AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
853AC_SUBST(SELECT_TYPE)
854
855
856dnl Debug-related options
857dnl =====================
858
859AC_ARG_ENABLE(assert,
860AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
861[assert=$enableval], [assert=no])
862
863if test "$assert" = no; then
864 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
865elif test "$assert" = soft; then
866 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
867 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
868elif test "$assert" = yes; then
869 assert = "hard";
870fi
871
872AC_MSG_CHECKING(if you want IO Debugging hooks)
873AC_ARG_ENABLE(iodebug,
874AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
875[iodebug=$enableval], [iodebug=no])
876
877if test "$iodebug" = yes; then
878 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
879 AC_MSG_RESULT(yes)
880else
881 AC_MSG_RESULT(no)
882fi
883
884
885AC_MSG_CHECKING(if you want to do a profile build)
886AC_ARG_ENABLE(profile,
887AC_HELP_STRING([--enable-profile],[Enable profiling]),
888[profile=$enableval], [profile=no])
889
890if test "$profile" = yes; then
891 if test "$ac_cv_c_compiler_gnu" = yes; then
892 IRC_CFLAGS="$IRC_CFLAGS -pg"
893 AC_MSG_RESULT([yes, adding -pg])
894 AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
895 else
896 AC_MSG_RESULT([no, profile builds only work with gcc])
897 fi
898else
899 AC_MSG_RESULT(no)
900fi
901
902AC_ARG_ENABLE(balloc,
903AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
904[balloc=$enableval], [balloc=yes])
905
906if test "$balloc" = no; then
907 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
908fi
909
212380e3 910AC_ARG_ENABLE(small-net,
911AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
912[small_net=$enableval], [small_net=no])
913
914if test "$small_net" = yes; then
915dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
916 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
917 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
918 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
919 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
920 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
921 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
922 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
923 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
924 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
925 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
926 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
927 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
928 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
929 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
930else
931dnl These settings are for a large network like efnet..they will use lots of memory
932dnl so enable small net unless you really need this much support
933 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
934 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
935 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
936 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
937 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
938 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
939 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
940 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
941 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
942 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
943 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
944 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
945 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
946 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
947fi
948
949AC_ARG_WITH(nicklen,
950AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
951[
952 if test $withval -ge 50; then
953 NICKLEN=50
954 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
955 else
956 NICKLEN="$withval"
957 fi
958], [NICKLEN=15])
959
960AC_ARG_WITH(topiclen,
961AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
962[
963 if test $withval -ge 390; then
964 TOPICLEN=390
965 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
966 else
967 TOPICLEN=$withval
968 fi
969], [TOPICLEN=390])
970
212380e3 971AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
972AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
212380e3 973
974AC_ARG_ENABLE(shared-modules,
975AC_HELP_STRING([--disable-shared-modules],[ Disable shared modules.]),
976[shared_modules=$enableval], [shared_modules="yes"])
977
978dnl Some first-stage sanity checks.
979if test "$shared_modules" = yes; then
980
981 if test "$CYGWIN" = yes; then
982 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
983 shared_modules="no"
984 fi
985
986 dnl TenDRA's cc is called tcc too.
987 if test "$CC" = tcc -a "$TenDRA" = "no"; then
988 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
989 shared_modules="no"
990 fi
991fi
992
993dnl Second stage: check for functions and headers.
994if test "$shared_modules" = yes; then
995 DYNLINK_C=dynlink.c
996 AC_CHECK_HEADERS(dlfcn.h)
997 AC_SEARCH_LIBS(shl_load, dld,
998 [
999 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
1000 SUFFIX=".sl"
1001 MOD_TARGET=hpux_shared
1002 SEDOBJ="s/\.o/.sl/g"
1003 ],
1004 dnl !shl_load:
1005 [
1006 dnl standard dlopen
1007 AC_SEARCH_LIBS(dlopen, [dl c_r],
1008 [
1009 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1010 SUFFIX=".so"
1011 MOD_TARGET=shared_modules
1012 SEDOBJ="s/\.o/.so/g"
1013 if test "$AppleGCC" = yes; then
1014 AC_CHECK_HEADERS([mach-o/dyld.h])
1015 fi
1016 AC_CHECK_FUNC(dlsym, ,
1017 [
1018 AC_MSG_WARN([dlsym is not available, shared modules disabled])
1019 shared_modules=no
1020 ])
1021 AC_CHECK_FUNCS(dlfunc)
1022 ],
1023 [
1024 shared_modules=no
1025 ])
1026 ])
1027fi
1028
1029AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1030
1031dnl Third stage - wrangling the linker.
1032if test "$shared_modules" = yes; then
1033 # The GNU linker requires the -export-dynamic option to make
1034 # all symbols visible in the dynamic symbol table.
1035 hold_ldflags=$LDFLAGS
1036 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1037 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1038 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1039 LDFLAGS=$hold_ldflags
1040
1041 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1042 found="no, IRIX ld uses -B,dynamic"
1043 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1044 fi
1045
1046 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1047 found="no, AIX ld uses -G -brtl"
1048 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1049 fi
1050
1051 AC_MSG_RESULT($found)
1052
1053 if test "$found" = yes; then
1054 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1055 fi
1056
1057 AC_MSG_CHECKING(for compiler option to produce PIC)
1058 dnl The order should be here to check for groups of compilers,
1059 dnl then for odd compilers, then if no PICFLAGS were set up,
1060 dnl check for GCC and set defaults, or else error. -jmallett
1061 if test "$SGS" = "yes"; then
1062 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1063 PICFLAGS="-KPIC -DPIC -G"
1064 fi
1065
1066 if test "$AppleGCC" = "yes"; then
1067 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1068 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1069 fi
1070 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1071 dnl while compiling modules, the compiler does not allow you to give arguments
1072 dnl to the linker. (I did not design this)
1073 dnl So we need -c in the first stage of module compilation.
1074 dnl In the second stage, we link the modules via ld -b.
1075 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1076 dnl -TimeMr14C
1077 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1078 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1079 PICFLAGS="+z -r -q -n -c"
1080 AC_MSG_CHECKING([if +ESfic is required on this platform])
1081
1082 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1083 AC_MSG_RESULT(no)
1084 else
1085 AC_MSG_RESULT(yes)
1086 PICFLAGS="$PICFLAGS +ESfic"
1087 fi
1088
1089 LDFLAGS="${LDFLAGS} -Wl,-E"
1090 fi
1091 if test "$Tru" = yes -a "$CC" != gcc; then
1092 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1093 PICFLAGS="-shared -expect_unresolved '*' "
1094 LDFLAGS="-call_shared"
1095 fi
1096 if test -z "$PICFLAGS"; then
1097 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1098 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1099 PICFLAGS="-fPIC -DPIC -shared"
1100 else
1101 AC_MSG_RESULT(no)
1102 shared_modules=no
1103 fi
1104 fi
1105fi
1106
1107# This must be down here, or it will mess up checks like the ones
1108# for -Wl,-export-dynamic
1109# -- jilles
1110AC_ARG_ENABLE(warnings,
1111AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1112[
1113IRC_CFLAGS="$IRC_CFLAGS -O0"
1114CFLAGS="$IRC_CFLAGS"
1115
1116CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
1117CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
1118CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
1119CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
1120CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
1121CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
1122CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
1123CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
1124CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
1125CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
1126CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
1127CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
1128CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
1129CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
1130CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast)
1131CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
1132CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
1133CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
1134CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat=2], charybdis_cv_c_gcc_w_format)
1135CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic)
1136
1137IRC_CFLAGS="$CFLAGS"
1138],[])
1139
1140if test "$shared_modules" = no; then
1141 DYNLINK_C=""
1142 MOD_TARGET="libmodules.a"
1143 MODULES_LIBS="../modules/libmodules.a"
1144 SEDOBJ=""
1145 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1146 AC_MSG_WARN([shared module support has been disabled!])
1147fi
1148
1149dnl Stage 5 - underscores in front of symbol names.
1150if test "$shared_modules" = yes; then
1151
1152 AC_CHECK_FUNC(nlist,,
1153 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1154 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1155 )
1156 )
1157
1158 dnl We need to find out whether underscores are appended to symbol
1159 dnl names in executable files. First, though, we need to see
1160 dnl where nlist.h is hiding.
1161 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1162 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1163 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1164 if test x"$nlist_h" = "x"; then
1165 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1166 else
1167 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1168 AC_CACHE_VAL(symbol_underscores,
1169 [
1170cat << EOF > conftest.c
1171#include <$nlist_h>
1172#include <stdio.h>
1173#include <stdlib.h>
1174void _modinit(void);
1175int main(int argc, char *argv[[]]) {
1176 int i;
1177 struct nlist nl[[5]];
1178
1179 /* fill the names in this way, so it'll work almost everywhere */
1180 nl[[0]].n_name = "_modinit";
1181 nl[[1]].n_name = "__modinit";
1182 nl[[2]].n_name = "___modinit";
1183 nl[[3]].n_name = "____modinit";
1184 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1185
1186 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1187 for(i = 0; i < 4; i++) {
1188 if(nl[[i]].n_value != NULL)
1189 {
1190 int j;
1191 for(j = 0; j < i; j++)
1192 printf("_");
1193 exit(i);
1194 }
1195 }
1196 exit(-1);
1197}
1198void _modinit(void) { return; }
1199EOF
1200 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1201 symbol_underscores=`./conftest conftest`
1202 AC_MSG_RESULT($symbol_underscores)
1203 $RM -f conftest conftest.c
1204 ])
1205 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1206 fi
1207fi
1208
1209AC_SUBST(MODULES_LIBS)
1210AC_SUBST(MOD_TARGET)
1211
1212AC_SUBST(SSL_SRCS_ENABLE)
1213AC_SUBST(SSL_INCLUDES)
1214AC_SUBST(SSL_LIBS)
1215
1216AC_SUBST(LDFLAGS)
1217AC_SUBST(PICFLAGS)
1218AC_SUBST(IRC_CFLAGS)
1219AC_SUBST(SEDOBJ)
1220
1221
1222if test "$prefix" = "NONE"; then
1223 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1224
1225else
1226
1227dnl Don't get bitten by Cygwin's stupidity if the user specified
1228dnl a custom prefix with a trailing slash
1229
1230 prefix=`echo $prefix | sed 's/\/$//'`
1231 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1232
1233fi
1234
1235AC_CONFIG_FILES( \
1236 Makefile \
1237 libcharybdis/Makefile \
1238 servlink/Makefile \
1239 extensions/Makefile \
1240 unsupported/Makefile \
1241 src/Makefile \
1242 modules/Makefile \
1243 tools/Makefile \
1244 doc/Makefile \
1245 help/Makefile \
1246)
1247
1248AC_OUTPUT
1249
1250if test "$cf_openssl_version_ok" = yes; then
1251 openssl="yes"
1252else
1253 openssl="no"
1254fi
1255
1256if test "$shared_modules" = yes; then
1257 modules=shared
1258else
1259 modules=static
1260fi
1261
1262echo "
1263Configuration:
1264 Install directory : $prefix
1265
1266 Ziplinks : $zlib
1267 OpenSSL : $openssl
1268 Modules : $modules
1269 IPv6 support : $have_v6
1270 Socket Engine : $SELECT_TYPE
1271 Small network : $small_net
1272 Block allocator : $balloc
212380e3 1273
1274 Nickname length : $NICKLEN
1275 Topic length : $TOPICLEN
1276
1277Use make to compile Charybdis, then make install to install it.
1278"