]> jfr.im git - irc/rqf/shadowircd.git/blame - configure.ac
libcharybdis includes gone.
[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.])
932else
933dnl These settings are for a large network like efnet..they will use lots of memory
934dnl so enable small net unless you really need this much support
935 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
936 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
937 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
938 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
939 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
940 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
941 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
942 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
943 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
944 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
945 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
946 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
947 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
948 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
949fi
950
951AC_ARG_WITH(nicklen,
952AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]),
953[
954 if test $withval -ge 50; then
955 NICKLEN=50
956 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
957 else
958 NICKLEN="$withval"
959 fi
960], [NICKLEN=15])
961
962AC_ARG_WITH(topiclen,
963AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
964[
965 if test $withval -ge 390; then
966 TOPICLEN=390
967 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
968 else
969 TOPICLEN=$withval
970 fi
971], [TOPICLEN=390])
972
212380e3 973AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
974AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
212380e3 975
f13494df 976shared_modules="yes"
212380e3 977dnl Some first-stage sanity checks.
978if test "$shared_modules" = yes; then
979
980 if test "$CYGWIN" = yes; then
981 AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.])
982 shared_modules="no"
983 fi
984
985 dnl TenDRA's cc is called tcc too.
986 if test "$CC" = tcc -a "$TenDRA" = "no"; then
987 AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC])
988 shared_modules="no"
989 fi
990fi
991
992dnl Second stage: check for functions and headers.
993if test "$shared_modules" = yes; then
994 DYNLINK_C=dynlink.c
995 AC_CHECK_HEADERS(dlfcn.h)
996 AC_SEARCH_LIBS(shl_load, dld,
997 [
998 AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.])
999 SUFFIX=".sl"
1000 MOD_TARGET=hpux_shared
1001 SEDOBJ="s/\.o/.sl/g"
1002 ],
1003 dnl !shl_load:
1004 [
1005 dnl standard dlopen
1006 AC_SEARCH_LIBS(dlopen, [dl c_r],
1007 [
1008 AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.])
1009 SUFFIX=".so"
1010 MOD_TARGET=shared_modules
1011 SEDOBJ="s/\.o/.so/g"
1012 if test "$AppleGCC" = yes; then
1013 AC_CHECK_HEADERS([mach-o/dyld.h])
1014 fi
1015 AC_CHECK_FUNC(dlsym, ,
1016 [
1017 AC_MSG_WARN([dlsym is not available, shared modules disabled])
1018 shared_modules=no
1019 ])
1020 AC_CHECK_FUNCS(dlfunc)
1021 ],
1022 [
1023 shared_modules=no
1024 ])
1025 ])
1026fi
1027
1028AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.])
1029
1030dnl Third stage - wrangling the linker.
1031if test "$shared_modules" = yes; then
1032 # The GNU linker requires the -export-dynamic option to make
1033 # all symbols visible in the dynamic symbol table.
1034 hold_ldflags=$LDFLAGS
1035 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1036 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror"
1037 AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
1038 LDFLAGS=$hold_ldflags
1039
1040 if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then
1041 found="no, IRIX ld uses -B,dynamic"
1042 LDFLAGS="${LDFLAGS} -Wl,-B,dynamic"
1043 fi
1044
1045 if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then
1046 found="no, AIX ld uses -G -brtl"
1047 LDFLAGS="${LDFLAGS} -Wl,-G,-brtl"
1048 fi
1049
1050 AC_MSG_RESULT($found)
1051
1052 if test "$found" = yes; then
1053 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1054 fi
1055
1056 AC_MSG_CHECKING(for compiler option to produce PIC)
1057 dnl The order should be here to check for groups of compilers,
1058 dnl then for odd compilers, then if no PICFLAGS were set up,
1059 dnl check for GCC and set defaults, or else error. -jmallett
1060 if test "$SGS" = "yes"; then
1061 AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G])
1062 PICFLAGS="-KPIC -DPIC -G"
1063 fi
1064
1065 if test "$AppleGCC" = "yes"; then
1066 AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress])
1067 PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress"
1068 fi
1069 dnl Please note, that on HPUX two different stages of module compilation occurs, since
1070 dnl while compiling modules, the compiler does not allow you to give arguments
1071 dnl to the linker. (I did not design this)
1072 dnl So we need -c in the first stage of module compilation.
1073 dnl In the second stage, we link the modules via ld -b.
1074 dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead.
1075 dnl -TimeMr14C
1076 if test "$HPUX" = "yes" -a "$CC" != gcc; then
1077 AC_MSG_RESULT(HP-UX cc: +z -r -q -n)
1078 PICFLAGS="+z -r -q -n -c"
1079 AC_MSG_CHECKING([if +ESfic is required on this platform])
1080
1081 if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then
1082 AC_MSG_RESULT(no)
1083 else
1084 AC_MSG_RESULT(yes)
1085 PICFLAGS="$PICFLAGS +ESfic"
1086 fi
1087
1088 LDFLAGS="${LDFLAGS} -Wl,-E"
1089 fi
1090 if test "$Tru" = yes -a "$CC" != gcc; then
1091 AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*'])
1092 PICFLAGS="-shared -expect_unresolved '*' "
1093 LDFLAGS="-call_shared"
1094 fi
1095 if test -z "$PICFLAGS"; then
1096 if test "$ac_cv_c_compiler_gnu" = "yes"; then
1097 AC_MSG_RESULT(gcc: -fPIC -DPIC -shared)
1098 PICFLAGS="-fPIC -DPIC -shared"
1099 else
1100 AC_MSG_RESULT(no)
1101 shared_modules=no
1102 fi
1103 fi
1104fi
1105
1106# This must be down here, or it will mess up checks like the ones
1107# for -Wl,-export-dynamic
1108# -- jilles
1109AC_ARG_ENABLE(warnings,
1110AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
1111[
1112IRC_CFLAGS="$IRC_CFLAGS -O0"
1113CFLAGS="$IRC_CFLAGS"
1114
1115CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
1116CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
1117CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
1118CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
1119CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
1120CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
1121CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
1122CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
1123CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
1124CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
1125CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
1126CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
1127CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
1128CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
1129CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast)
1130CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
1131CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
1132CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
1133CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat=2], charybdis_cv_c_gcc_w_format)
1134CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic)
1135
1136IRC_CFLAGS="$CFLAGS"
1137],[])
1138
1139if test "$shared_modules" = no; then
1140 DYNLINK_C=""
1141 MOD_TARGET="libmodules.a"
1142 MODULES_LIBS="../modules/libmodules.a"
1143 SEDOBJ=""
1144 AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.])
1145 AC_MSG_WARN([shared module support has been disabled!])
1146fi
1147
1148dnl Stage 5 - underscores in front of symbol names.
1149if test "$shared_modules" = yes; then
1150
1151 AC_CHECK_FUNC(nlist,,
1152 AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl",
1153 AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",)
1154 )
1155 )
1156
1157 dnl We need to find out whether underscores are appended to symbol
1158 dnl names in executable files. First, though, we need to see
1159 dnl where nlist.h is hiding.
1160 AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], )
1161 AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], )
1162 AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], )
1163 if test x"$nlist_h" = "x"; then
1164 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.])
1165 else
1166 AC_MSG_CHECKING(for extra underscores prepended to symbol names)
1167 AC_CACHE_VAL(symbol_underscores,
1168 [
1169cat << EOF > conftest.c
1170#include <$nlist_h>
1171#include <stdio.h>
1172#include <stdlib.h>
1173void _modinit(void);
1174int main(int argc, char *argv[[]]) {
1175 int i;
1176 struct nlist nl[[5]];
1177
1178 /* fill the names in this way, so it'll work almost everywhere */
1179 nl[[0]].n_name = "_modinit";
1180 nl[[1]].n_name = "__modinit";
1181 nl[[2]].n_name = "___modinit";
1182 nl[[3]].n_name = "____modinit";
1183 nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL;
1184
1185 if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1);
1186 for(i = 0; i < 4; i++) {
1187 if(nl[[i]].n_value != NULL)
1188 {
1189 int j;
1190 for(j = 0; j < i; j++)
1191 printf("_");
1192 exit(i);
1193 }
1194 }
1195 exit(-1);
1196}
1197void _modinit(void) { return; }
1198EOF
1199 $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1
1200 symbol_underscores=`./conftest conftest`
1201 AC_MSG_RESULT($symbol_underscores)
1202 $RM -f conftest conftest.c
1203 ])
1204 AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.])
1205 fi
1206fi
1207
1208AC_SUBST(MODULES_LIBS)
1209AC_SUBST(MOD_TARGET)
1210
1211AC_SUBST(SSL_SRCS_ENABLE)
1212AC_SUBST(SSL_INCLUDES)
1213AC_SUBST(SSL_LIBS)
1214
1215AC_SUBST(LDFLAGS)
1216AC_SUBST(PICFLAGS)
1217AC_SUBST(IRC_CFLAGS)
1218AC_SUBST(SEDOBJ)
1219
1220
1221if test "$prefix" = "NONE"; then
1222 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
1223
1224else
1225
1226dnl Don't get bitten by Cygwin's stupidity if the user specified
1227dnl a custom prefix with a trailing slash
1228
1229 prefix=`echo $prefix | sed 's/\/$//'`
1230 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
1231
1232fi
1233
1234AC_CONFIG_FILES( \
1235 Makefile \
212380e3 1236 servlink/Makefile \
1237 extensions/Makefile \
1238 unsupported/Makefile \
1239 src/Makefile \
1240 modules/Makefile \
1241 tools/Makefile \
1242 doc/Makefile \
1243 help/Makefile \
1244)
1245
1246AC_OUTPUT
1247
1248if test "$cf_openssl_version_ok" = yes; then
1249 openssl="yes"
1250else
1251 openssl="no"
1252fi
1253
1254if test "$shared_modules" = yes; then
1255 modules=shared
1256else
1257 modules=static
1258fi
1259
1260echo "
1261Configuration:
1262 Install directory : $prefix
1263
1264 Ziplinks : $zlib
1265 OpenSSL : $openssl
212380e3 1266 IPv6 support : $have_v6
1267 Socket Engine : $SELECT_TYPE
1268 Small network : $small_net
1269 Block allocator : $balloc
212380e3 1270
1271 Nickname length : $NICKLEN
1272 Topic length : $TOPICLEN
1273
cc200171 1274Use make to compile Charybdis, then make install to install it.
212380e3 1275"