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