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