]> jfr.im git - solanum.git/blame - configure.ac
Change default --with-nicklen to 31, like atheme-services.
[solanum.git] / configure.ac
CommitLineData
88cb7f99 1dnl $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $
212380e3
AC
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
bf98590a 13AC_INIT([charybdis],[3.3.0])
212380e3
AC
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
db137867
AC
29AC_CONFIG_SUBDIRS(libratbox)
30
212380e3
AC
31dnl Check for various compilers. -jmallett
32dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk
33
34if test "$ac_cv_c_compiler_gnu" != yes; then
35
36SGS=no
37AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro)
38case `$CC -version 2>&1` in
39*TenDRA*)
40 AC_MSG_RESULT([yes, TenDRA])
41 IRC_CFLAGS=""
42 CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include"
43 SGS=yes
44 TenDRA=yes
45;;
46*MIPSpro*)
47 AC_MSG_RESULT([yes, MIPSpro])
48 MIPSpro=yes
49 SGS=yes
50;;
51*)
52 AC_MSG_RESULT(no)
53 TenDRA=no
54 MIPSpro=no
55;;
56esac
57
58AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc])
59case `$CC -V 2>&1` in
60*Sun*WorkShop* | *Forte*Developer*)
61 AC_MSG_RESULT(Sun Workshop/Forte)
62 IRC_CFLAGS="-fast -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString"
63 SunWorkShop=yes
64 SGS=yes
65;;
66*Tru64*)
67 AC_MSG_RESULT(Tru64 cc)
68 IRC_CFLAGS="-O2"
69 CPPFLAGS="-I/usr/local/include"
70 Tru=yes
71;;
72*HP*ANSI*)
73 AC_MSG_RESULT(HPUX cc)
74 HPUX=yes
75 IRC_CFLAGS="+e"
76;;
77*)
78 AC_MSG_RESULT(no)
79;;
80esac
81
82fi
83
d3faa80a 84AC_MSG_CHECKING([uname -s for Solaris, AIX or HPUX])
212380e3
AC
85OSNAME=`uname -s`
86case "$OSNAME" in
87 HP-UX*)
88 dnl only do this if we haven't already detected the newer one
89 dnl and we're not already using gcc
90
91 if test "$HPUX" != yes -a "$ac_cv_c_compiler_gnu" = no; then
92 AC_MSG_RESULT(assuming old HPUX with its own cc)
93 IRC_CFLAGS="$IRC_CFLAGS +e"
94 HPUX=yes
95 else
96 AC_MSG_RESULT(already using newer HPUX)
97 fi
98 ;;
212380e3
AC
99 SunOS*)
100 AC_MSG_RESULT(SunOS or Solaris)
101 AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.])
102 SUN=yes
103 ;;
104 AIX*)
105 AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are)
106 IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G"
107 ;;
108 *)
109 AC_MSG_RESULT(no)
110 ;;
111esac
112
113if test "$ac_cv_c_compiler_gnu" = yes; then
114 AC_MSG_CHECKING(if $CC is Apple GCC)
115
116 case `$CC -v 2>&1 | tail -n 1` in
117 *Apple*)
118 AC_MSG_RESULT(yes)
119 AppleGCC=yes
120 ;;
121 *)
122 AC_MSG_RESULT(no)
123 AppleGCC=no
124 ;;
125 esac
126
97199fb3 127 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -std=gnu99"
212380e3
AC
128fi
129
130dnl If we support -g, use it!
131if test "$ac_cv_prog_cc_g" = yes; then
132 dnl Tru64 needs -g3 for -O2
133 if test "$Tru" = yes; then
134 IRC_CFLAGS="$IRC_CFLAGS -g3"
135 else
136 IRC_CFLAGS="$IRC_CFLAGS -g"
137 fi
138fi
139
140dnl SVR4 SGS based on what we know about the compiler -jmallett
141AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces)
142if test "$SGS" = "yes"; then
143 AC_MSG_RESULT(yes)
144else
145 AC_MSG_RESULT(no)
146fi
147
148dnl We prefer gcc -MM because it's a lot less bloated
149AC_PATH_PROG(MKDEP, mkdep)
150AC_PATH_PROG(MAKEDEPEND, makedepend)
151
152AC_MSG_CHECKING(how to generate dependency info)
153
154STDOUT="> .depend"
155
156if test "$ac_cv_c_compiler_gnu" = yes; then
157 AC_MSG_RESULT(gcc -MM)
158 MKDEP="$CC -MM"
159elif test ! -z "$MKDEP"; then
160 AC_MSG_RESULT(mkdep)
161
162 dnl Tru64's mkdep is very loud
163 if test -z "$Tru"; then
164 STDOUT=""
165 else
166 STDOUT=" 2> /dev/null"
167 fi
168elif test "$SunWorkShop" = yes; then
169 AC_MSG_RESULT($CC -xM)
170 MKDEP="$CC -xM"
171 STDOUT="> .depend 2> /dev/null"
172elif test ! -z "$MAKEDEPEND"; then
173 AC_MSG_RESULT(makedepend)
174 MKDEP="$MAKEDEPEND -f-"
175else
176 AC_MSG_RESULT([nothing suitable.. forget it!])
177 MKDEP=":"
178fi
179
180AC_SUBST(MKDEP)
181AC_SUBST(STDOUT)
182
183dnl check for /dev/null so we can use it to hold evil fd's
184AC_MSG_CHECKING([for /dev/null])
185if test -c /dev/null ; then
186 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
187 AC_MSG_RESULT(yes)
188else
189 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
190 AC_MSG_RESULT(no - using devnull.log)
191fi
192
193dnl jdc -- If CFLAGS is defined, best use it everywhere...
194dnl NOTE: jv says it must be added to the *END*, because things like
195dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
196if test ! -z "$CFLAGS"; then
197 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
198fi
199
200AC_ISC_POSIX
201AC_C_INLINE
202AC_PROG_GCC_TRADITIONAL
203AC_PROG_MAKE_SET
204AC_PROG_INSTALL
205AC_PATH_PROG(RM, rm)
206AC_PATH_PROG(CP, cp)
207AC_PATH_PROG(MV, mv)
208AC_PATH_PROG(LN, ln)
209AC_PATH_PROG(SED, sed)
210AC_PATH_PROG(AR, ar)
211AC_PATH_PROG(LD, ld)
212AC_PATH_PROG(RANLIB, ranlib)
213AC_PATH_PROG(TOUCH, touch)
214
215AC_PROG_YACC
216
217dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
218if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
219 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
220fi
221
222AC_PROG_LEX
223
224if test "$LEX" = ":"; then
225 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
226fi
227
228dnl use directory structure of cached as default (hack)
229if test "$libexecdir" = '${exec_prefix}/libexec' &&
230 test "$localstatedir" = '${prefix}/var'; then
231 libexecdir='${bindir}'
232 localstatedir='${prefix}'
233fi
234
235dnl Checks for header files.
236AC_HEADER_STDC
237
238AC_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])
239
240dnl Stuff that the memory manager (imalloc) depends on
241dnl ==================================================
242
243AC_C_CONST
244if test "$ac_cv_header_machine_endian_h" = "no" ; then
245 AC_C_BIGENDIAN
246fi
247AC_TYPE_PID_T
248AC_TYPE_SIZE_T
249AC_CHECK_SIZEOF(short)
250AC_CHECK_SIZEOF(int)
251AC_CHECK_SIZEOF(long)
252AC_CHECK_SIZEOF(long long)
253
212380e3
AC
254dnl Networking Functions
255dnl ====================
256
257AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
258
259dnl SunOS/Solaris required libnsl for inet_ntoa()
260if test x"$SUN" = xyes; then
261 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
262fi
263
212380e3
AC
264AC_CHECK_TYPE(socklen_t, ,
265[AC_DEFINE([socklen_t], [unsigned int],
266[If we don't have a real socklen_t, unsigned int is good enough.])],
267[#include <sys/types.h>
268#include <sys/socket.h>])
269
270AC_ARG_ENABLE(ipv6,
271AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
272
212380e3
AC
273AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
274
275CRYPT_LIB=$ac_cv_search_crypt
276
277if test "$CRYPT_LIB" = "none required"; then
278 unset CRYPT_LIB
279elif test "$CRYPT_LIB" = no; then
280 unset CRYPT_LIB
281fi
282
283AC_SUBST(CRYPT_LIB)
284
285if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
286 VICONF=viconf
287 dnl We need one of the above to build viconf. Just a sanity check,
288 dnl we don't want to stop people from building the rest of ircd
289 dnl just because they can't build viconf.
290else
291 VICONF=""
292fi
293
294AC_SUBST(VICONF)
295
296dnl See whether we can include both string.h and strings.h.
297AC_CACHE_CHECK([whether string.h and strings.h may both be included],
298gcc_cv_header_string,
299[
300 AC_COMPILE_IFELSE(
301 [#include <string.h>
302 #include <strings.h>],
303 [gcc_cv_header_string=yes],
304 [gcc_cv_header_string=no])
305])
306
307if test "$gcc_cv_header_string" = "yes"; then
308 AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h])
309fi
310
311AC_C_BIGENDIAN
312
313dnl Check for stdarg.h - if we can't find it, halt configure
ec86417c 314AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
212380e3
AC
315
316dnl Checks for the existence of strlcat, strlcpy, basename...
317dnl This more reliable test only works with gcc though.
318
319if test "$ac_cv_c_compiler_gnu" = yes; then
320
321AC_MSG_CHECKING(for strlcpy)
322save_CFLAGS=$CFLAGS
323CFLAGS="$CFLAGS -Wimplicit -Werror"
324
325AC_LINK_IFELSE(
326 [AC_LANG_PROGRAM(
327 [[#include <string.h>
328 #include <stdlib.h>]],
329 [[char *a = malloc(6);
330 strlcpy(a, "hello", 6);]]
331 )],
332 [AC_MSG_RESULT(yes)
333 AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])],
334 [AC_MSG_RESULT(no)]
335)
336
337AC_MSG_CHECKING(for strlcat)
338AC_LINK_IFELSE(
339 [AC_LANG_PROGRAM(
340 [[#include <string.h>
341 #include <stdlib.h>]],
342 [[char *a = malloc(6);
343 a[0] = '\0';
344 strlcat(a, "hello", 6);]]
345 )],
346 [AC_MSG_RESULT(yes)
347 AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])],
348 [AC_MSG_RESULT(no)]
349)
350
351CFLAGS=$save_CFLAGS
352
353else
354
355dnl Better than nothing. The more complicated test above probably fixes powerpc,
356dnl so who cares.
357
358AC_CHECK_FUNCS([strlcat strlcpy])
359
360fi
361
362AC_CHECK_TYPE([u_int32_t], [],
363[
364 AC_CHECK_TYPE([uint32_t],
365 [
366 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
367 ],
368 [
369 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
370 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
371 ])
372])
373
374AC_CHECK_TYPE([u_int16_t], [],
375[
376 AC_CHECK_TYPE([uint16_t],
377 [
378 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
379 ],
380 [
381 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
382 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
383 ])
384])
385
386AC_CHECK_TYPE([in_port_t], [],
387[AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
388[[#include <sys/types.h>
389#include <netinet/in.h>]])
390
391AC_CHECK_TYPE([sa_family_t], [],
392[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
393[[#include <sys/types.h>
394#include <sys/socket.h>]])
395
396AC_CHECK_TYPES([uintptr_t])
397
398dnl check for various functions...
399AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
400
401AC_FUNC_ALLOCA
402
403dnl Specialized functions checks
404dnl ============================
405
406dnl check for nanosleep
407AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
408 LIBS="${LIBS} -lrt",
409 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
410 )])])
411if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
412then
413 AC_MSG_RESULT("nanosleep not found..using select for delay")
414else
415 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
416fi
417
418dnl OpenSSL support
419AC_MSG_CHECKING(for OpenSSL)
420AC_ARG_ENABLE(openssl,
421[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
422AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
423[cf_enable_openssl=$enableval],
424[cf_enable_openssl="auto"])
425
426if test "$cf_enable_openssl" != "no" ; then
427 cf_openssl_basedir=""
428 if test "$cf_enable_openssl" != "auto" &&
429 test "$cf_enable_openssl" != "yes" ; then
430 dnl Support for --enable-openssl=/some/place
431 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
432 else
433 dnl Do the auto-probe here. Check some common directory paths.
434 for dirs in /usr/local/ssl /usr/pkg /usr/local \
435 /usr/local/openssl ; do
436 if test -f "${dirs}/include/openssl/opensslv.h" ; then
437 cf_openssl_basedir="${dirs}"
438 break
439 fi
440 done
441 unset dirs
442 fi
443 dnl Now check cf_openssl_found to see if we found anything.
444 if test ! -z "$cf_openssl_basedir"; then
445 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
446 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
447 SSL_LIBS="-L${cf_openssl_basedir}/lib"
448 else
449 dnl OpenSSL wasn't found in the directory specified. Naughty
450 dnl administrator...
451 cf_openssl_basedir=""
452 fi
453 else
454 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
455 dnl are in /usr/include and /usr/lib. In this case, we don't want to
456 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
457 dnl We can't do this check above, because some people want two versions
458 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
459 dnl and they want /usr/local/ssl to have preference.
460 if test -f "/usr/include/openssl/opensslv.h" ; then
461 cf_openssl_basedir="/usr"
462 fi
463 fi
464
465 dnl If we have a basedir defined, then everything is okay. Otherwise,
466 dnl we have a problem.
467 if test ! -z "$cf_openssl_basedir"; then
468 AC_MSG_RESULT($cf_openssl_basedir)
469 cf_enable_openssl="yes"
470 else
471 AC_MSG_RESULT([not found. Specify a correct path?])
472 cf_enable_openssl="no"
473 fi
474 unset cf_openssl_basedir
475else
476 dnl If --disable-openssl was specified
477 AC_MSG_RESULT(disabled)
478fi
479
480save_CPPFLAGS="$CPPFLAGS"
481CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
482save_LIBS="$LIBS"
483LIBS="$LIBS $SSL_LIBS"
484if test "$cf_enable_openssl" != no; then
485 dnl Check OpenSSL version (must be 0.9.6 or above!)
486 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
487 AC_RUN_IFELSE(
488 AC_LANG_PROGRAM(
489 [#include <openssl/opensslv.h>
490 #include <stdlib.h>],
491 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
492 exit(0); else exit(1);]]),
493 cf_openssl_version_ok=yes,
494 cf_openssl_version_ok=no,
495 cf_openssl_version_ok=no)
496
497 if test "$cf_openssl_version_ok" = yes; then
498 AC_MSG_RESULT(found)
499
500 dnl Work around pmake/gmake conditional incompatibilities
501 AC_SUBST(ENCSPEED, encspeed)
502
503 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
504 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
505 AC_CHECK_LIB(crypto, RSA_free)
506 SSL_LIBS="$SSL_LIBS -lcrypto"
507 SSL_SRCS_ENABLE='$(SSL_SRCS)'
508 else
509 AC_MSG_RESULT(no - OpenSSL support disabled)
510 fi
511fi
512
513CPPFLAGS="$save_CPPFLAGS"
514LIBS="$save_LIBS"
515
516dnl End OpenSSL detection
517
518
519dnl Specialized functions and libraries
520dnl ===================================
521
522AC_ARG_WITH(zlib-path,
523AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
524[LIBS="$LIBS -L$withval"],)
525
526AC_ARG_ENABLE(zlib,
527AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
528[zlib=$enableval],[zlib=yes])
529
530if test "$zlib" = yes; then
531
532AC_CHECK_HEADER(zlib.h, [
533 AC_CHECK_LIB(z, zlibVersion,
534 [
535 AC_SUBST(ZLIB_LD, -lz)
536 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
537 ], zlib=no)
538], zlib=no)
539
540fi
541
542dnl IO Loop Selection
543dnl =================
544
1b4cfad8
AC
545AC_ARG_ENABLE(ports, AC_HELP_STRING([--enable-ports],[Force solaris I/O ports subsystem usage.]),
546[ if test $enableval = yes; then
547 SELECT_TYPE_EXPLICIT="ports"
548 else
549 use_ports=no
550 fi
551],)
552
212380e3
AC
553AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]),
554[ if test $enableval = yes; then
555 SELECT_TYPE_EXPLICIT="poll"
556 else
557 use_poll=no
558 fi
559],)
560
561AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]),
562[ if test $enableval = yes; then
563 SELECT_TYPE_EXPLICIT="select"
564 else
565 use_select=no
566 fi
567],)
568
569AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]),
570[ if test $enableval = yes; then
571 SELECT_TYPE_EXPLICIT="kqueue"
572 else
573 use_kqueue=no
574 fi
575],)
576
212380e3
AC
577AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]),
578[ if test $enableval = yes; then
579 SELECT_TYPE_EXPLICIT="epoll"
a34ec229 580 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
212380e3
AC
581 else
582 use_epoll=no
583 fi
584],)
585
586dnl **********************************************************************
587dnl Check for --with-confdir
588dnl **********************************************************************
589
590AC_MSG_CHECKING([whether to modify confdir])
591AC_ARG_WITH(confdir,
592AC_HELP_STRING([--with-confdir=DIR],
593 [Directory to install config files.]),
594 [ confdir=`echo $withval | sed 's/\/$//'`
595 AC_MSG_RESULT(yes)
596 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
597 AC_SUBST_DIR([confdir]) ],
598 [ confdir='${prefix}/etc'
599 AC_MSG_RESULT(no)
600 AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.])
601 AC_SUBST_DIR([confdir])]
602)
603
604dnl **********************************************************************
605dnl Check for --with-logdir
606dnl **********************************************************************
607
608AC_MSG_CHECKING([whether to modify logdir])
609AC_ARG_WITH(logdir,
610AC_HELP_STRING([--with-logdir=DIR],
611 [Directory where to write logfiles.]),
612 [ logdir=`echo $withval | sed 's/\/$//'`
613 AC_MSG_RESULT(yes)
614 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
615 AC_SUBST_DIR([logdir]) ],
616 [ logdir='${prefix}/logs'
617 AC_MSG_RESULT(no)
618 AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.])
619 AC_SUBST_DIR([logdir])]
620)
621
622dnl **********************************************************************
623dnl Check for --with-helpdir
624dnl **********************************************************************
625
626AC_MSG_CHECKING([whether to modify helpdir])
627AC_ARG_WITH(helpdir,
628AC_HELP_STRING([--with-helpdir=DIR],
629 [Directory to install help files.]),
630 [ helpdir=`echo $withval | sed 's/\/$//'`
631 AC_MSG_RESULT(yes)
632 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.])
633 AC_SUBST_DIR([helpdir]) ],
634 [ helpdir='${prefix}/help'
635 AC_MSG_RESULT(no)
636 AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.])
637 AC_SUBST_DIR([helpdir])]
638)
639
640dnl **********************************************************************
641dnl Check for --with-moduledir
642dnl **********************************************************************
643
644AC_MSG_CHECKING([whether to modify moduledir])
645AC_ARG_WITH(moduledir,
646AC_HELP_STRING([--with-moduledir=DIR],
647 [Directory to install modules.]),
648 [ moduledir=`echo $withval | sed 's/\/$//'`
649 AC_MSG_RESULT(yes)
650 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
651 AC_SUBST_DIR([moduledir]) ],
652 [ moduledir='${prefix}/modules'
653 AC_MSG_RESULT(no)
654 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
655 AC_SUBST_DIR([moduledir])]
656)
657
b6d0720c
AC
658dnl **********************************************************************
659dnl Branding
660dnl **********************************************************************
661
662AC_MSG_CHECKING([whether custom branding is requested])
663AC_ARG_WITH(custom-branding,
664AC_HELP_STRING([--with-custom-branding=NAME],
665 [Custom branding name.]),
666 [BRANDING_NAME=$withval
667 AC_MSG_RESULT([yes])],
668 [BRANDING_NAME=$PACKAGE_NAME
669 AC_MSG_RESULT([no])]
670)
671
672AC_MSG_CHECKING([whether a custom version is requested])
673AC_ARG_WITH(custom-version,
674AC_HELP_STRING([--with-custom-version=NAME],
675 [Custom version branding.]),
676 [BRANDING_VERSION=$withval
677 AC_MSG_RESULT([yes])],
678 [BRANDING_VERSION=$PACKAGE_VERSION
679 AC_MSG_RESULT([no])]
680)
681
682AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$BRANDING_NAME"], [Custom branding name.])
683AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$BRANDING_VERSION"], [Custom branding name.])
684
f5493691
AC
685if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then
686 AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.])
687fi
688
212380e3
AC
689if test ! -z "$SELECT_TYPE_EXPLICIT"; then
690 SELECT_TYPE="$SELECT_TYPE_EXPLICIT";
691 echo "Forcing $SELECT_TYPE to be enabled"
692else
693
1b4cfad8
AC
694if test ! "x$use_ports" = "xno"; then
695 AC_CHECK_FUNCS(port_getn, [haveports=yes], [haveports=no])
696 if test "x$haveports" = "xyes" ; then
697 SELECT_TYPE="ports"
698 fi
699fi
700
212380e3
AC
701if test ! "x$use_select" = "xno"; then
702 AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no])
703 if test "x$haveselect" = "xyes" ; then
704 SELECT_TYPE="select"
705 fi
706fi
707
708if test ! "x$use_poll" = "xno"; then
709 AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no])
710 if test "x$havepoll" = "xyes" ; then
711 SELECT_TYPE="poll"
712 fi
713fi
714
212380e3
AC
715if test ! "x$use_kqueue" = "xno"; then
716 AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no])
717 if test "x$havekqueue" = "xyes" ; then
718 SELECT_TYPE="kqueue"
719 fi
720fi
721
722if test ! "x$use_epoll" = "xno"; then
723 AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no])
724 if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
725 if test "x$haveepoll" = "xyes" ; then
726 AC_MSG_CHECKING(for epoll support in kernel)
727 AC_TRY_RUN(
728#include <stdint.h>
729#include <sys/param.h>
730#include <sys/types.h>
731#include <sys/epoll.h>
732#include <sys/syscall.h>
733#include <unistd.h>
734
735int
736main(int argc, char **argv)
737{
738 int epfd;
739
740 epfd = epoll_create(256);
33b310b3 741 return (epfd == -1 ? 1 : 0);
212380e3
AC
742}, [AC_MSG_RESULT(yes)
743 AC_DEFINE(HAVE_EPOLL, 1,
744 [Define if your system supports the epoll system calls])
745 SELECT_TYPE="epoll"],
746 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
747 fi
748 fi
749
750haveepollsyscall=no
751
752if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
753 if test "x$haveepoll" = "xno" ; then
754 AC_MSG_CHECKING(for epoll system call)
755 AC_TRY_RUN(
756#include <stdint.h>
757#include <sys/param.h>
758#include <sys/types.h>
759#include <sys/epoll.h>
760#include <sys/syscall.h>
761#include <unistd.h>
762
763int
764epoll_create(int size)
765{
766 return (syscall(__NR_epoll_create, size));
767}
768
769int
770main(int argc, char **argv)
771{
772 int epfd;
773
774 epfd = epoll_create(256);
775 exit (epfd == -1 ? 1 : 0);
776}, [AC_MSG_RESULT(yes)
777 AC_DEFINE(HAVE_EPOLL, 1,
778 [Define if your system supports the epoll system calls])
779 SELECT_TYPE="epoll"],
780 AC_MSG_RESULT(no), AC_MSG_RESULT(no))
781 fi
782fi
783
784fi
785
786fi
787
788if test -z "$SELECT_TYPE"; then
789 AC_MSG_ERROR([Unable to find a usable IO interface],)
790fi
791
792echo "Using $SELECT_TYPE for select loop."
793
794AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using])
795AC_SUBST(SELECT_TYPE)
796
797
798dnl Debug-related options
799dnl =====================
800
801AC_ARG_ENABLE(assert,
802AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
803[assert=$enableval], [assert=no])
804
805if test "$assert" = no; then
806 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
807elif test "$assert" = soft; then
808 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
809 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
810elif test "$assert" = yes; then
811 assert = "hard";
812fi
813
814AC_MSG_CHECKING(if you want IO Debugging hooks)
815AC_ARG_ENABLE(iodebug,
816AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
817[iodebug=$enableval], [iodebug=no])
818
819if test "$iodebug" = yes; then
820 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
821 AC_MSG_RESULT(yes)
822else
823 AC_MSG_RESULT(no)
824fi
825
826
827AC_MSG_CHECKING(if you want to do a profile build)
828AC_ARG_ENABLE(profile,
829AC_HELP_STRING([--enable-profile],[Enable profiling]),
830[profile=$enableval], [profile=no])
831
832if test "$profile" = yes; then
833 if test "$ac_cv_c_compiler_gnu" = yes; then
834 IRC_CFLAGS="$IRC_CFLAGS -pg"
835 AC_MSG_RESULT([yes, adding -pg])
836 AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
837 else
838 AC_MSG_RESULT([no, profile builds only work with gcc])
839 fi
840else
841 AC_MSG_RESULT(no)
842fi
843
844AC_ARG_ENABLE(balloc,
845AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
846[balloc=$enableval], [balloc=yes])
847
848if test "$balloc" = no; then
849 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
850fi
851
212380e3
AC
852AC_ARG_ENABLE(small-net,
853AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
854[small_net=$enableval], [small_net=no])
855
856if test "$small_net" = yes; then
857dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
858 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
859 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
860 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
861 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
862 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
863 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
864 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
865 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
866 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
867 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
868 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
869 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
870 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
871 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
ce923338 872 AC_DEFINE([FD_HEAP_SIZE], 128, [Size of fd heap.])
bc5f6d5b 873 AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.])
212380e3
AC
874else
875dnl These settings are for a large network like efnet..they will use lots of memory
876dnl so enable small net unless you really need this much support
877 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
878 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
879 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
880 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
881 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
882 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
883 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
884 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
885 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
886 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
887 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
888 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
889 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
890 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
ce923338 891 AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
bc5f6d5b 892 AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
212380e3
AC
893fi
894
895AC_ARG_WITH(nicklen,
b225bf93 896AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]),
212380e3 897[
f173c7d8
JT
898 if ! expr "$withval" + 0 >/dev/null 2>&1; then
899 AC_ERROR([NICKLEN must be a numeric value])
900 fi
212380e3
AC
901 if test $withval -ge 50; then
902 NICKLEN=50
903 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
904 else
905 NICKLEN="$withval"
906 fi
b225bf93 907], [NICKLEN=31])
212380e3
AC
908
909AC_ARG_WITH(topiclen,
910AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
911[
912 if test $withval -ge 390; then
913 TOPICLEN=390
914 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
915 else
916 TOPICLEN=$withval
917 fi
918], [TOPICLEN=390])
919
212380e3
AC
920AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
921AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
212380e3 922
f13494df 923shared_modules="yes"
212380e3
AC
924dnl Some first-stage sanity checks.
925if test "$shared_modules" = yes; then
212380e3
AC
926 dnl TenDRA's cc is called tcc too.
927 if test "$CC" = tcc -a "$TenDRA" = "no"; then
928 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
929 shared_modules="no"
930 fi
931fi
932
933dnl Second stage: check for functions and headers.
934if test "$shared_modules" = yes; then
935 DYNLINK_C=dynlink.c
936 AC_CHECK_HEADERS(dlfcn.h)
937 AC_SEARCH_LIBS(shl_load, dld,
938 [
939 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
940 SUFFIX=".sl"
941 MOD_TARGET=hpux_shared
942 SEDOBJ="s/\.o/.sl/g"
943 ],
944 dnl !shl_load:
945 [
946 dnl standard dlopen
947 AC_SEARCH_LIBS(dlopen, [dl c_r],
948 [
949 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
950 SUFFIX=".so"
951 MOD_TARGET=shared_modules
952 SEDOBJ="s/\.o/.so/g"
953 if test "$AppleGCC" = yes; then
954 AC_CHECK_HEADERS([mach-o/dyld.h])
955 fi
956 AC_CHECK_FUNC(dlsym, ,
957 [
958 AC_MSG_WARN([dlsym is not available, shared modules disabled])
959 shared_modules=no
960 ])
961 AC_CHECK_FUNCS(dlfunc)
962 ],
963 [
964 shared_modules=no
965 ])
966 ])
967fi
968
969AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
970
971dnl Third stage - wrangling the linker.
972if test "$shared_modules" = yes; then
973 # The GNU linker requires the -export-dynamic option to make
974 # all symbols visible in the dynamic symbol table.
975 hold_ldflags=$LDFLAGS
976 AC_MSG_CHECKING(for the ld -export-dynamic flag)
977 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
978 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
979 LDFLAGS=$hold_ldflags
980
981 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
982 found="no, IRIX ld uses -B,dynamic"
983 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
984 fi
985
986 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
987 found="no, AIX ld uses -G -brtl"
988 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
989 fi
990
991 AC_MSG_RESULT($found)
992
993 if test "$found" = yes; then
994 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
995 fi
996
997 AC_MSG_CHECKING(for compiler option to produce PIC)
998 dnl The order should be here to check for groups of compilers,
999 dnl then for odd compilers, then if no PICFLAGS were set up,
1000 dnl check for GCC and set defaults, or else error. -jmallett
1001 if test "$SGS" = "yes"; then
1002 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1003 PICFLAGS="-KPIC -DPIC -G"
1004 fi
1005
1006 if test "$AppleGCC" = "yes"; then
1007 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1008 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1009 fi
1010 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1011 dnl while compiling modules, the compiler does not allow you to give arguments
1012 dnl to the linker. (I did not design this)
1013 dnl So we need -c in the first stage of module compilation.
1014 dnl In the second stage, we link the modules via ld -b.
1015 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1016 dnl -TimeMr14C
1017 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1018 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1019 PICFLAGS="+z -r -q -n -c"
1020 AC_MSG_CHECKING([if +ESfic is required on this platform])
1021
1022 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1023 AC_MSG_RESULT(no)
1024 else
1025 AC_MSG_RESULT(yes)
1026 PICFLAGS="$PICFLAGS +ESfic"
1027 fi
1028
1029 LDFLAGS="${LDFLAGS} -Wl,-E"
1030 fi
1031 if test "$Tru" = yes -a "$CC" != gcc; then
1032 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1033 PICFLAGS="-shared -expect_unresolved '*' "
1034 LDFLAGS="-call_shared"
1035 fi
1036 if test -z "$PICFLAGS"; then
1037 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1038 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1039 PICFLAGS="-fPIC -DPIC -shared"
1040 else
1041 AC_MSG_RESULT(no)
1042 shared_modules=no
1043 fi
1044 fi
1045fi
1046
794816af
JT
1047# rpath, for finding libratbox.so at run time
1048hold_ldflags=$LDFLAGS
1049AC_MSG_CHECKING(for the ld -rpath flag)
1050LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}"
1051AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1052LDFLAGS=$hold_ldflags
1053AC_MSG_RESULT($found)
1054if test "$found" = yes; then
1055 LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}"
1056fi
1057
212380e3
AC
1058# This must be down here, or it will mess up checks like the ones
1059# for -Wl,-export-dynamic
1060# -- jilles
97199fb3 1061CWARNS=""
212380e3
AC
1062AC_ARG_ENABLE(warnings,
1063AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1064[
1065IRC_CFLAGS="$IRC_CFLAGS -O0"
1066CFLAGS="$IRC_CFLAGS"
1067
1068CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
1069CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
1070CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
1071CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
1072CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
c0e90a8e
JT
1073CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings)
1074CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration)
212380e3
AC
1075CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
1076CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
1077CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
1078CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
1079CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
1080CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
1081CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
1082CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
1083CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
212380e3
AC
1084CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
1085CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
1086CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
f9a9ffac 1087CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format)
212380e3
AC
1088
1089IRC_CFLAGS="$CFLAGS"
1090],[])
1091
1092if test "$shared_modules" = no; then
1093 DYNLINK_C=""
1094 MOD_TARGET="libmodules.a"
1095 MODULES_LIBS="../modules/libmodules.a"
1096 SEDOBJ=""
1097 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1098 AC_MSG_WARN([shared module support has been disabled!])
1099fi
1100
1101dnl Stage 5 - underscores in front of symbol names.
1102if test "$shared_modules" = yes; then
1103
1104 AC_CHECK_FUNC(nlist,,
1105 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1106 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1107 )
1108 )
1109
1110 dnl We need to find out whether underscores are appended to symbol
1111 dnl names in executable files. First, though, we need to see
1112 dnl where nlist.h is hiding.
1113 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1114 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1115 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1116 if test x"$nlist_h" = "x"; then
1117 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1118 else
1119 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1120 AC_CACHE_VAL(symbol_underscores,
1121 [
1122cat << EOF > conftest.c
1123#include <$nlist_h>
1124#include <stdio.h>
1125#include <stdlib.h>
1126void _modinit(void);
1127int main(int argc, char *argv[[]]) {
1128 int i;
1129 struct nlist nl[[5]];
1130
1131 /* fill the names in this way, so it'll work almost everywhere */
1132 nl[[0]].n_name = "_modinit";
1133 nl[[1]].n_name = "__modinit";
1134 nl[[2]].n_name = "___modinit";
1135 nl[[3]].n_name = "____modinit";
1136 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1137
1138 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1139 for(i = 0; i < 4; i++) {
1140 if(nl[[i]].n_value != NULL)
1141 {
1142 int j;
1143 for(j = 0; j < i; j++)
1144 printf("_");
1145 exit(i);
1146 }
1147 }
1148 exit(-1);
1149}
1150void _modinit(void) { return; }
1151EOF
1152 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1153 symbol_underscores=`./conftest conftest`
1154 AC_MSG_RESULT($symbol_underscores)
1155 $RM -f conftest conftest.c
1156 ])
1157 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1158 fi
1159fi
1160
97199fb3
JT
1161IRC_CFLAGS="$IRC_CFLAGS $CWARNS"
1162
212380e3
AC
1163AC_SUBST(MODULES_LIBS)
1164AC_SUBST(MOD_TARGET)
1165
1166AC_SUBST(SSL_SRCS_ENABLE)
1167AC_SUBST(SSL_INCLUDES)
1168AC_SUBST(SSL_LIBS)
1169
1170AC_SUBST(LDFLAGS)
1171AC_SUBST(PICFLAGS)
1172AC_SUBST(IRC_CFLAGS)
1173AC_SUBST(SEDOBJ)
1174
1175
1176if test "$prefix" = "NONE"; then
1177 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1178
1179else
1180
1181dnl Don't get bitten by Cygwin's stupidity if the user specified
1182dnl a custom prefix with a trailing slash
1183
1184 prefix=`echo $prefix | sed 's/\/$//'`
1185 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1186
1187fi
1188
1189AC_CONFIG_FILES( \
1190 Makefile \
734ce253 1191 bandb/Makefile \
d261b578 1192 ssld/Makefile \
212380e3 1193 extensions/Makefile \
212380e3
AC
1194 src/Makefile \
1195 modules/Makefile \
1196 tools/Makefile \
1197 doc/Makefile \
1198 help/Makefile \
1199)
1200
1201AC_OUTPUT
1202
1203if test "$cf_openssl_version_ok" = yes; then
1204 openssl="yes"
1205else
1206 openssl="no"
1207fi
1208
1209if test "$shared_modules" = yes; then
1210 modules=shared
1211else
1212 modules=static
1213fi
1214
1215echo "
b6d0720c 1216Configuration of ${BRANDING_NAME}-${BRANDING_VERSION}:
212380e3
AC
1217 Install directory : $prefix
1218
1219 Ziplinks : $zlib
1220 OpenSSL : $openssl
212380e3
AC
1221 Socket Engine : $SELECT_TYPE
1222 Small network : $small_net
1223 Block allocator : $balloc
212380e3
AC
1224
1225 Nickname length : $NICKLEN
1226 Topic length : $TOPICLEN
1227
b6d0720c 1228Use (g)make to compile $BRANDING_NAME, then (g)make install to install it.
212380e3 1229"