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