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