]> jfr.im git - solanum.git/blame - configure.ac
ircd: remove internal resolver, no longer used
[solanum.git] / configure.ac
CommitLineData
212380e3
AC
1dnl TODO: clean up all the OpenSSL and shared module checking stuff;
2dnl the most major changes have already been made and it looks like
3dnl said functions need to be just about as complex as they already are.
4
eec2776c 5AC_PREREQ(2.60)
212380e3 6
f2621986 7AC_INIT([charybdis], [3.6.0-dev])
212380e3 8
eec2776c
AJ
9AC_LANG(C)
10AC_PROG_CC_C99
11AC_USE_SYSTEM_EXTENSIONS
12AC_GNU_SOURCE
13
c52df125 14AC_PREFIX_DEFAULT($HOME/ircd)
a5471f24 15AC_CONFIG_MACRO_DIR([m4])
212380e3 16AC_CONFIG_HEADER(include/setup.h)
eec2776c 17AC_CONFIG_SUBDIRS([libratbox])
c52df125
AC
18AC_CONFIG_AUX_DIR([libltdl/config])
19AC_CONFIG_MACRO_DIR([libltdl/m4])
eec2776c
AJ
20
21AM_INIT_AUTOMAKE([subdir-objects])
c52df125
AC
22AM_SILENT_RULES([yes])
23AM_PROG_AR
24
25LT_INIT([dlopen disable-static])
c52df125
AC
26LT_CONFIG_LTDL_DIR([extra/libltdl])
27LTDL_INIT
28
29build_ltdl=$with_included_ltdl
eec2776c 30if test x"$build_ltdl" = x"yes"; then
eec2776c
AJ
31 AC_CONFIG_SUBDIRS([libltdl])
32fi
d8c4154d 33AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"])
db137867 34
7585af0f 35if test "$ac_cv_c_compiler_gnu" = yes; then
eec2776c 36 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
212380e3
AC
37fi
38
39dnl If we support -g, use it!
40if test "$ac_cv_prog_cc_g" = yes; then
2a19fc3f 41 IRC_CFLAGS="$IRC_CFLAGS -g"
212380e3
AC
42fi
43
212380e3
AC
44dnl check for /dev/null so we can use it to hold evil fd's
45AC_MSG_CHECKING([for /dev/null])
46if test -c /dev/null ; then
47 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
48 AC_MSG_RESULT(yes)
49else
50 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
51 AC_MSG_RESULT(no - using devnull.log)
52fi
53
54dnl jdc -- If CFLAGS is defined, best use it everywhere...
55dnl NOTE: jv says it must be added to the *END*, because things like
56dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
57if test ! -z "$CFLAGS"; then
58 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
59fi
60
61AC_ISC_POSIX
62AC_C_INLINE
212380e3
AC
63AC_PROG_MAKE_SET
64AC_PROG_INSTALL
65AC_PATH_PROG(RM, rm)
66AC_PATH_PROG(CP, cp)
67AC_PATH_PROG(MV, mv)
68AC_PATH_PROG(LN, ln)
69AC_PATH_PROG(SED, sed)
70AC_PATH_PROG(AR, ar)
71AC_PATH_PROG(LD, ld)
72AC_PATH_PROG(RANLIB, ranlib)
73AC_PATH_PROG(TOUCH, touch)
74
75AC_PROG_YACC
76
77dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
78if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
79 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
80fi
81
82AC_PROG_LEX
83
84if test "$LEX" = ":"; then
85 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
86fi
87
c74836dc 88AC_ARG_ENABLE([fhs-paths],
6929cd01 89 [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
c74836dc
NPB
90 [],
91 [dnl detect if the user appears to want --enable-fhs-paths
92 AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
93 test "$localstatedir" = '${prefix}/var' && \
94 test "$libdir" = '${exec_prefix}/lib'],
95 [enable_fhs_paths=no],
96 [enable_fhs_paths=yes])
97 ])
212380e3 98dnl use directory structure of cached as default (hack)
c74836dc
NPB
99AS_IF([test "x$enable_fhs_paths" = "xyes"],
100 [dnl Avoid name collisions.
101 pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
102 rundir=${rundir-'${prefix}/run'}
103 pkgrundir='${rundir}/${PACKAGE_TARNAME}'
104 pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'],
105 [libexecdir='${bindir}'
106 pkglibexecdir='${libexecdir}'
107 rundir='${sysconfdir}'
108 pkgrundir='${rundir}'
212380e3 109 localstatedir='${prefix}'
c74836dc
NPB
110 pkglocalstatedir='${sysconfdir}'])
111pkglibdir='${libdir}/${PACKAGE_TARNAME}'
112AC_SUBST([pkglibdir])
113AC_SUBST([rundir])
114AC_SUBST([pkgrundir])
115AC_SUBST([pkglocalstatedir])
1870e06a 116AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]])
c74836dc
NPB
117AC_SUBST([pkglibexecdir])
118AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
212380e3
AC
119
120dnl Checks for header files.
121AC_HEADER_STDC
122
123AC_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])
124
125dnl Stuff that the memory manager (imalloc) depends on
126dnl ==================================================
127
128AC_C_CONST
129if test "$ac_cv_header_machine_endian_h" = "no" ; then
130 AC_C_BIGENDIAN
131fi
132AC_TYPE_PID_T
133AC_TYPE_SIZE_T
134AC_CHECK_SIZEOF(short)
135AC_CHECK_SIZEOF(int)
136AC_CHECK_SIZEOF(long)
137AC_CHECK_SIZEOF(long long)
138
212380e3
AC
139dnl Networking Functions
140dnl ====================
141
142AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])])
143
144dnl SunOS/Solaris required libnsl for inet_ntoa()
145if test x"$SUN" = xyes; then
146 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
147fi
148
212380e3
AC
149AC_CHECK_TYPE(socklen_t, ,
150[AC_DEFINE([socklen_t], [unsigned int],
151[If we don't have a real socklen_t, unsigned int is good enough.])],
152[#include <sys/types.h>
153#include <sys/socket.h>])
154
155AC_ARG_ENABLE(ipv6,
156AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no])
157
212380e3
AC
158AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
159
160CRYPT_LIB=$ac_cv_search_crypt
161
162if test "$CRYPT_LIB" = "none required"; then
163 unset CRYPT_LIB
164elif test "$CRYPT_LIB" = no; then
165 unset CRYPT_LIB
166fi
167
168AC_SUBST(CRYPT_LIB)
169
170if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then
171 VICONF=viconf
172 dnl We need one of the above to build viconf. Just a sanity check,
173 dnl we don't want to stop people from building the rest of ircd
174 dnl just because they can't build viconf.
175else
176 VICONF=""
177fi
178
179AC_SUBST(VICONF)
180
212380e3
AC
181AC_C_BIGENDIAN
182
183dnl Check for stdarg.h - if we can't find it, halt configure
ec86417c 184AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - charybdis will not compile without it **])])
212380e3
AC
185AC_CHECK_FUNCS([strlcat strlcpy])
186
212380e3
AC
187AC_CHECK_TYPE([u_int32_t], [],
188[
189 AC_CHECK_TYPE([uint32_t],
190 [
191 AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.])
192 ],
193 [
194 AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int])
195 AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.])
196 ])
197])
198
199AC_CHECK_TYPE([u_int16_t], [],
200[
201 AC_CHECK_TYPE([uint16_t],
202 [
203 AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute])
204 ],
205 [
206 AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int])
207 AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.])
208 ])
209])
210
211AC_CHECK_TYPE([in_port_t], [],
212[AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])],
213[[#include <sys/types.h>
214#include <netinet/in.h>]])
215
216AC_CHECK_TYPE([sa_family_t], [],
217[AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])],
218[[#include <sys/types.h>
219#include <sys/socket.h>]])
220
221AC_CHECK_TYPES([uintptr_t])
222
223dnl check for various functions...
224AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ])
225
226AC_FUNC_ALLOCA
227
228dnl Specialized functions checks
229dnl ============================
230
231dnl check for nanosleep
232AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep,
233 LIBS="${LIBS} -lrt",
234 [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4"
235 )])])
236if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno
237then
238 AC_MSG_RESULT("nanosleep not found..using select for delay")
239else
240 AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists])
241fi
242
243dnl OpenSSL support
244AC_MSG_CHECKING(for OpenSSL)
245AC_ARG_ENABLE(openssl,
246[AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
247AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
248[cf_enable_openssl=$enableval],
249[cf_enable_openssl="auto"])
250
251if test "$cf_enable_openssl" != "no" ; then
252 cf_openssl_basedir=""
253 if test "$cf_enable_openssl" != "auto" &&
254 test "$cf_enable_openssl" != "yes" ; then
255 dnl Support for --enable-openssl=/some/place
256 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
257 else
258 dnl Do the auto-probe here. Check some common directory paths.
259 for dirs in /usr/local/ssl /usr/pkg /usr/local \
260 /usr/local/openssl ; do
261 if test -f "${dirs}/include/openssl/opensslv.h" ; then
262 cf_openssl_basedir="${dirs}"
263 break
264 fi
265 done
266 unset dirs
267 fi
268 dnl Now check cf_openssl_found to see if we found anything.
269 if test ! -z "$cf_openssl_basedir"; then
270 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
271 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
272 SSL_LIBS="-L${cf_openssl_basedir}/lib"
273 else
274 dnl OpenSSL wasn't found in the directory specified. Naughty
275 dnl administrator...
276 cf_openssl_basedir=""
277 fi
278 else
279 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
280 dnl are in /usr/include and /usr/lib. In this case, we don't want to
281 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
282 dnl We can't do this check above, because some people want two versions
283 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
284 dnl and they want /usr/local/ssl to have preference.
285 if test -f "/usr/include/openssl/opensslv.h" ; then
286 cf_openssl_basedir="/usr"
287 fi
288 fi
289
290 dnl If we have a basedir defined, then everything is okay. Otherwise,
291 dnl we have a problem.
292 if test ! -z "$cf_openssl_basedir"; then
293 AC_MSG_RESULT($cf_openssl_basedir)
294 cf_enable_openssl="yes"
295 else
296 AC_MSG_RESULT([not found. Specify a correct path?])
297 cf_enable_openssl="no"
298 fi
299 unset cf_openssl_basedir
300else
301 dnl If --disable-openssl was specified
302 AC_MSG_RESULT(disabled)
303fi
304
305save_CPPFLAGS="$CPPFLAGS"
306CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
307save_LIBS="$LIBS"
308LIBS="$LIBS $SSL_LIBS"
309if test "$cf_enable_openssl" != no; then
310 dnl Check OpenSSL version (must be 0.9.6 or above!)
311 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
312 AC_RUN_IFELSE(
313 AC_LANG_PROGRAM(
314 [#include <openssl/opensslv.h>
315 #include <stdlib.h>],
316 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
317 exit(0); else exit(1);]]),
318 cf_openssl_version_ok=yes,
319 cf_openssl_version_ok=no,
320 cf_openssl_version_ok=no)
321
322 if test "$cf_openssl_version_ok" = yes; then
323 AC_MSG_RESULT(found)
324
325 dnl Work around pmake/gmake conditional incompatibilities
326 AC_SUBST(ENCSPEED, encspeed)
327
328 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
329 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
330 AC_CHECK_LIB(crypto, RSA_free)
331 SSL_LIBS="$SSL_LIBS -lcrypto"
332 SSL_SRCS_ENABLE='$(SSL_SRCS)'
333 else
334 AC_MSG_RESULT(no - OpenSSL support disabled)
335 fi
336fi
337
338CPPFLAGS="$save_CPPFLAGS"
339LIBS="$save_LIBS"
340
341dnl End OpenSSL detection
342
343
344dnl Specialized functions and libraries
345dnl ===================================
346
347AC_ARG_WITH(zlib-path,
348AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]),
349[LIBS="$LIBS -L$withval"],)
350
351AC_ARG_ENABLE(zlib,
352AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]),
353[zlib=$enableval],[zlib=yes])
354
355if test "$zlib" = yes; then
356
357AC_CHECK_HEADER(zlib.h, [
358 AC_CHECK_LIB(z, zlibVersion,
359 [
360 AC_SUBST(ZLIB_LD, -lz)
361 AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.])
362 ], zlib=no)
363], zlib=no)
364
365fi
366
cf1001a7
LS
367dnl Check for shared sqlite
368dnl ======================
a6ef3156
LS
369AC_ARG_WITH(shared-sqlite,
370AC_HELP_STRING([--with-shared-sqlite],[Use shared sqlite]),
371[shared_sqlite=$withval],[shared_sqlite=no])
497e30a0
LS
372
373if test "$shared_sqlite" = yes; then
a5471f24
LS
374 PKG_CHECK_MODULES(SQLITE, [sqlite3],
375 [
376 shared_sqlite=yes
cf1001a7 377 ], shared_sqlite=no)
497e30a0
LS
378fi
379
74ab6be0 380if test "$shared_sqlite" = no; then
c52df125 381 SQLITE_OBJ='sqlite3.$(OBJEXT)'
74ab6be0
LS
382fi
383
a5471f24
LS
384AC_SUBST(SQLITE_LD, "$SQLITE_LIBS")
385AC_SUBST(SQLITE_INCLUDES, "$SQLITE_CFLAGS")
c52df125 386AC_SUBST(SQLITE_OBJ)
cf1001a7 387
212380e3 388dnl **********************************************************************
634d4aad 389dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
212380e3
AC
390dnl **********************************************************************
391
634d4aad
NPB
392AC_ARG_WITH([confdir],
393 [AC_HELP_STRING([--with-confdir=DIR],
394 [Directory to install config files [deprecated, use --sysconfdir instead].])],
395 [ sysconfdir=`echo $withval | sed 's/\/$//'` ],
396 [ confdir='${sysconfdir}' ])
397AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
212380e3
AC
398
399dnl **********************************************************************
400dnl Check for --with-logdir
401dnl **********************************************************************
402
403AC_MSG_CHECKING([whether to modify logdir])
404AC_ARG_WITH(logdir,
405AC_HELP_STRING([--with-logdir=DIR],
406 [Directory where to write logfiles.]),
407 [ logdir=`echo $withval | sed 's/\/$//'`
c74836dc
NPB
408 AC_MSG_RESULT(yes)],
409 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
410 [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
411 [logdir='${prefix}/logs'])
412 AC_MSG_RESULT(no)])
413AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
414AC_SUBST_DIR([logdir])
212380e3
AC
415
416dnl **********************************************************************
417dnl Check for --with-helpdir
418dnl **********************************************************************
419
420AC_MSG_CHECKING([whether to modify helpdir])
421AC_ARG_WITH(helpdir,
422AC_HELP_STRING([--with-helpdir=DIR],
423 [Directory to install help files.]),
424 [ helpdir=`echo $withval | sed 's/\/$//'`
c74836dc
NPB
425 AC_MSG_RESULT(yes) ],
426 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
427 [helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
428 [helpdir='${prefix}/help'])
429 AC_MSG_RESULT(no) ])
430AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
431AC_SUBST_DIR([helpdir])
212380e3
AC
432
433dnl **********************************************************************
434dnl Check for --with-moduledir
435dnl **********************************************************************
436
437AC_MSG_CHECKING([whether to modify moduledir])
438AC_ARG_WITH(moduledir,
c74836dc
NPB
439 [AC_HELP_STRING([--with-moduledir=DIR],
440 [Directory to install modules.])],
212380e3 441 [ moduledir=`echo $withval | sed 's/\/$//'`
c74836dc
NPB
442 AC_MSG_RESULT(yes)],
443 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
444 [moduledir='${pkglibdir}/modules'],
445 [moduledir='${prefix}/modules'])
212380e3 446 AC_MSG_RESULT(no)
c74836dc
NPB
447 ])
448AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
449AC_SUBST_DIR([moduledir])
450
451dnl Check for --with-rundir
452
453AC_MSG_CHECKING([whether or modify rundir])
454AC_ARG_WITH([rundir],
455 [AC_HELP_STRING([--with-rundir=DIR],
456 [Directory in which to store pidfile.])],
457 [AC_MSG_RESULT([yes])
458 rundir=`echo $withval | sed 's/\/$//'`],
459 [AC_MSG_RESULT([no])
460 AS_IF([test "x$enable_fhs_paths" = "xyes"],
461 [rundir='${prefix}/run'],
462 [rundir='${sysconfdir}'])])
463AC_SUBST([rundir])
464AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
465
466dnl Installed utility program prefixes (does not affect binaries
467dnl installed into pkglibexecdir)
468AC_MSG_CHECKING([for program prefix])
469AC_ARG_WITH([program-prefix],
470 [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
471 [test "x$with_program_prefix" = "xno" && with_program_prefix=],
472 [with_program_prefix=])
473AC_MSG_RESULT(["$with_program_prefix"])
474PROGRAM_PREFIX="$with_program_prefix"
475AC_SUBST([PROGRAM_PREFIX])
476AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
212380e3 477
b6d0720c
AC
478dnl **********************************************************************
479dnl Branding
480dnl **********************************************************************
481
482AC_MSG_CHECKING([whether custom branding is requested])
483AC_ARG_WITH(custom-branding,
484AC_HELP_STRING([--with-custom-branding=NAME],
485 [Custom branding name.]),
486 [BRANDING_NAME=$withval
487 AC_MSG_RESULT([yes])],
488 [BRANDING_NAME=$PACKAGE_NAME
489 AC_MSG_RESULT([no])]
490)
491
492AC_MSG_CHECKING([whether a custom version is requested])
493AC_ARG_WITH(custom-version,
494AC_HELP_STRING([--with-custom-version=NAME],
495 [Custom version branding.]),
496 [BRANDING_VERSION=$withval
497 AC_MSG_RESULT([yes])],
498 [BRANDING_VERSION=$PACKAGE_VERSION
499 AC_MSG_RESULT([no])]
500)
501
502AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$BRANDING_NAME"], [Custom branding name.])
503AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$BRANDING_VERSION"], [Custom branding name.])
504
f5493691
AC
505if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then
506 AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.])
507fi
508
212380e3
AC
509dnl Debug-related options
510dnl =====================
511
512AC_ARG_ENABLE(assert,
513AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
514[assert=$enableval], [assert=no])
515
516if test "$assert" = no; then
517 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
518elif test "$assert" = soft; then
519 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
520 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
521elif test "$assert" = yes; then
522 assert = "hard";
523fi
524
525AC_MSG_CHECKING(if you want IO Debugging hooks)
526AC_ARG_ENABLE(iodebug,
527AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]),
528[iodebug=$enableval], [iodebug=no])
529
530if test "$iodebug" = yes; then
531 AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.])
532 AC_MSG_RESULT(yes)
533else
534 AC_MSG_RESULT(no)
535fi
536
537
538AC_MSG_CHECKING(if you want to do a profile build)
539AC_ARG_ENABLE(profile,
540AC_HELP_STRING([--enable-profile],[Enable profiling]),
541[profile=$enableval], [profile=no])
542
543if test "$profile" = yes; then
544 if test "$ac_cv_c_compiler_gnu" = yes; then
545 IRC_CFLAGS="$IRC_CFLAGS -pg"
546 AC_MSG_RESULT([yes, adding -pg])
547 AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.])
548 else
549 AC_MSG_RESULT([no, profile builds only work with gcc])
550 fi
551else
552 AC_MSG_RESULT(no)
553fi
554
555AC_ARG_ENABLE(balloc,
556AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]),
557[balloc=$enableval], [balloc=yes])
558
559if test "$balloc" = no; then
560 AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.])
561fi
562
212380e3
AC
563AC_ARG_ENABLE(small-net,
564AC_HELP_STRING([--enable-small-net],[Enable small network support.]),
565[small_net=$enableval], [small_net=no])
566
567if test "$small_net" = yes; then
568dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.])
569 AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.])
570 AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.])
571 AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.])
572 AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.])
573 AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.])
574 AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.])
575 AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.])
576 AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.])
577 AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.])
578 AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.])
579 AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.])
580 AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.])
581 AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.])
582 AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.])
ce923338 583 AC_DEFINE([FD_HEAP_SIZE], 128, [Size of fd heap.])
bc5f6d5b 584 AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.])
212380e3
AC
585else
586dnl These settings are for a large network like efnet..they will use lots of memory
587dnl so enable small net unless you really need this much support
588 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
589 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
590 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
591 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
592 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
593 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
594 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
595 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
596 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
597 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
598 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
599 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
600 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
601 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
ce923338 602 AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
bc5f6d5b 603 AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
212380e3
AC
604fi
605
606AC_ARG_WITH(nicklen,
b225bf93 607AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]),
212380e3 608[
f173c7d8
JT
609 if ! expr "$withval" + 0 >/dev/null 2>&1; then
610 AC_ERROR([NICKLEN must be a numeric value])
611 fi
ca8ff483 612 if test $withval -gt 50; then
212380e3
AC
613 NICKLEN=50
614 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
ca8ff483
JT
615 elif test $withval -lt 9; then
616 NICKLEN=9
617 AC_MSG_WARN([NICKLEN has a lower limit of 9. Setting NICKLEN=9])
212380e3
AC
618 else
619 NICKLEN="$withval"
620 fi
b225bf93 621], [NICKLEN=31])
212380e3
AC
622
623AC_ARG_WITH(topiclen,
624AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
625[
626 if test $withval -ge 390; then
627 TOPICLEN=390
628 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
629 else
630 TOPICLEN=$withval
631 fi
632], [TOPICLEN=390])
633
212380e3
AC
634AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
635AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
212380e3 636
794816af
JT
637# rpath, for finding libratbox.so at run time
638hold_ldflags=$LDFLAGS
639AC_MSG_CHECKING(for the ld -rpath flag)
640LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}"
641AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no)
642LDFLAGS=$hold_ldflags
643AC_MSG_RESULT($found)
644if test "$found" = yes; then
645 LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}"
646fi
647
212380e3
AC
648# This must be down here, or it will mess up checks like the ones
649# for -Wl,-export-dynamic
650# -- jilles
97199fb3 651CWARNS=""
212380e3
AC
652AC_ARG_ENABLE(warnings,
653AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
654[
655IRC_CFLAGS="$IRC_CFLAGS -O0"
656CFLAGS="$IRC_CFLAGS"
657
658CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all)
659CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith)
660CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit)
661CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align)
662CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual)
c0e90a8e
JT
663CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings)
664CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration)
212380e3
AC
665CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes)
666CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis)
667CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w)
668CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra)
669CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow)
670CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn)
671CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef)
672CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed)
673CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs)
212380e3
AC
674CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused)
675CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls)
676CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal)
f9a9ffac 677CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], charybdis_cv_c_gcc_w_format)
212380e3
AC
678
679IRC_CFLAGS="$CFLAGS"
680],[])
681
97199fb3
JT
682IRC_CFLAGS="$IRC_CFLAGS $CWARNS"
683
212380e3
AC
684AC_SUBST(MODULES_LIBS)
685AC_SUBST(MOD_TARGET)
686
687AC_SUBST(SSL_SRCS_ENABLE)
688AC_SUBST(SSL_INCLUDES)
689AC_SUBST(SSL_LIBS)
690
691AC_SUBST(LDFLAGS)
692AC_SUBST(PICFLAGS)
693AC_SUBST(IRC_CFLAGS)
694AC_SUBST(SEDOBJ)
695
696
697if test "$prefix" = "NONE"; then
698 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
699
700else
701
702dnl Don't get bitten by Cygwin's stupidity if the user specified
703dnl a custom prefix with a trailing slash
704
705 prefix=`echo $prefix | sed 's/\/$//'`
706 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
707
708fi
709
710AC_CONFIG_FILES( \
711 Makefile \
0d73e7db 712 authd/Makefile \
734ce253 713 bandb/Makefile \
d261b578 714 ssld/Makefile \
212380e3 715 extensions/Makefile \
46fded53 716 ircd/Makefile \
212380e3
AC
717 modules/Makefile \
718 tools/Makefile \
14048b96 719 tools/genssl \
212380e3
AC
720 doc/Makefile \
721 help/Makefile \
722)
14048b96 723AC_CONFIG_COMMANDS([tools/genssl_chmod], [chmod 755 tools/genssl])
212380e3
AC
724
725AC_OUTPUT
726
727if test "$cf_openssl_version_ok" = yes; then
728 openssl="yes"
729else
730 openssl="no"
731fi
732
212380e3 733echo "
b6d0720c 734Configuration of ${BRANDING_NAME}-${BRANDING_VERSION}:
212380e3
AC
735 Install directory : $prefix
736
737 Ziplinks : $zlib
738 OpenSSL : $openssl
212380e3
AC
739 Small network : $small_net
740 Block allocator : $balloc
212380e3
AC
741
742 Nickname length : $NICKLEN
743 Topic length : $TOPICLEN
744
b6d0720c 745Use (g)make to compile $BRANDING_NAME, then (g)make install to install it.
212380e3 746"