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