]> jfr.im git - solanum.git/blob - configure.ac
Correct order of chunking and encoding steps.
[solanum.git] / configure.ac
1 dnl TODO: clean up all the OpenSSL and shared module checking stuff;
2 dnl the most major changes have already been made and it looks like
3 dnl said functions need to be just about as complex as they already are.
4
5 AC_PREREQ(2.60)
6
7 AC_INIT([solanum], [1.0-dev])
8
9 AC_LANG(C)
10 AC_USE_SYSTEM_EXTENSIONS
11 AC_GNU_SOURCE
12
13 AC_PROG_CC_C99
14
15 if test x"$ac_cv_prog_cc_c99" = "xno"; then
16 AC_ERROR([solanum requires a C99 capable compiler])
17 fi
18
19 AC_PREFIX_DEFAULT($HOME/ircd)
20 AC_CONFIG_MACRO_DIR([m4])
21 AC_CONFIG_HEADER(include/setup.h)
22
23 AC_CONFIG_SUBDIRS([librb])
24 AC_CONFIG_AUX_DIR([libltdl/config])
25
26 AM_INIT_AUTOMAKE([subdir-objects])
27 AM_SILENT_RULES([yes])
28 AM_PROG_AR
29
30 LT_INIT([dlopen disable-static])
31 LT_CONFIG_LTDL_DIR([libltdl])
32 LTDL_INIT
33
34 build_ltdl=$with_included_ltdl
35 AM_CONDITIONAL([BUILD_LTDL], [test x"$build_ltdl" = x"yes"])
36
37 if test "$ac_cv_c_compiler_gnu" = yes; then
38 IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall"
39 fi
40
41 dnl If we support -g, use it!
42 if test "$ac_cv_prog_cc_g" = yes; then
43 IRC_CFLAGS="$IRC_CFLAGS -g"
44 fi
45
46 dnl check for /dev/null so we can use it to hold evil fd's
47 AC_MSG_CHECKING([for /dev/null])
48 if test -c /dev/null ; then
49 AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null])
50 AC_MSG_RESULT(yes)
51 else
52 AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null])
53 AC_MSG_RESULT(no - using devnull.log)
54 fi
55
56 dnl jdc -- If CFLAGS is defined, best use it everywhere...
57 dnl NOTE: jv says it must be added to the *END*, because things like
58 dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid.
59 if test ! -z "$CFLAGS"; then
60 IRC_CFLAGS="$IRC_CFLAGS $CFLAGS"
61 fi
62
63 AC_ISC_POSIX
64 AC_C_INLINE
65 AC_PROG_MAKE_SET
66 AC_PROG_INSTALL
67 AC_PATH_PROG(RM, rm)
68 AC_PATH_PROG(CP, cp)
69 AC_PATH_PROG(MV, mv)
70 AC_PATH_PROG(LN, ln)
71 AC_PATH_PROG(SED, sed)
72 AC_PATH_PROG(AR, ar)
73 AC_PATH_PROG(LD, ld)
74 AC_PATH_PROG(RANLIB, ranlib)
75 AC_PATH_PROG(TOUCH, touch)
76
77 AC_PROG_YACC
78
79 dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found
80 if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then
81 AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc])
82 fi
83
84 AC_PROG_LEX
85
86 if test "$LEX" = ":"; then
87 AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.])
88 fi
89
90 AC_ARG_ENABLE([fhs-paths],
91 [AS_HELP_STRING([--enable-fhs-paths], [Use more FHS-like pathnames (for packagers).])],
92 [],
93 [dnl detect if the user appears to want --enable-fhs-paths
94 AS_IF([test "$libexecdir" = '${exec_prefix}/libexec' && \
95 test "$localstatedir" = '${prefix}/var' && \
96 test "$libdir" = '${exec_prefix}/lib'],
97 [enable_fhs_paths=no],
98 [enable_fhs_paths=yes])
99 ])
100 dnl use directory structure of cached as default (hack)
101 AS_IF([test "x$enable_fhs_paths" = "xyes"],
102 [dnl Avoid name collisions.
103 pkglibexecdir='${libexecdir}/${PACKAGE_TARNAME}'
104 rundir=${rundir-'${prefix}/run'}
105 pkgrundir='${rundir}/${PACKAGE_TARNAME}'
106 pkglocalstatedir='${localstatedir}/${PACKAGE_TARNAME}'
107 AC_DEFINE([ENABLE_FHS_PATHS], [1], [Uncomment if FHS pathnames are enabled])],
108 [libexecdir='${bindir}'
109 pkglibexecdir='${libexecdir}'
110 rundir='${sysconfdir}'
111 pkgrundir='${rundir}'
112 localstatedir='${prefix}'
113 pkglocalstatedir='${sysconfdir}'])
114 pkglibdir='${libdir}/${PACKAGE_TARNAME}'
115 AC_SUBST([pkglibdir])
116 AC_SUBST([rundir])
117 AC_SUBST([pkgrundir])
118 AC_SUBST([pkglocalstatedir])
119 AC_DEFINE_DIR([PKGLOCALSTATEDIR], [pkglocalstatedir], [[Directory in which to store state, such as ban database]])
120 AC_SUBST([pkglibexecdir])
121 AC_DEFINE_DIR([PKGLIBEXECDIR], [pkglibexecdir], [Directory where binaries the IRCd itself spawns live])
122
123 dnl Checks for header files.
124 AC_HEADER_STDC
125 AC_HEADER_STDBOOL
126
127 AC_CHECK_HEADERS([crypt.h sys/param.h sys/syslog.h sys/epoll.h machine/endian.h])
128
129 dnl Stuff that the memory manager (imalloc) depends on
130 dnl ==================================================
131
132 AC_C_CONST
133 if test "$ac_cv_header_machine_endian_h" = "no" ; then
134 AC_C_BIGENDIAN
135 fi
136 AC_TYPE_PID_T
137 AC_TYPE_SIZE_T
138 AC_CHECK_SIZEOF(short)
139 AC_CHECK_SIZEOF(int)
140 AC_CHECK_SIZEOF(long)
141 AC_CHECK_SIZEOF(long long)
142
143 dnl Networking Functions
144 dnl ====================
145
146 AC_SEARCH_LIBS(socket, socket,, [AC_MSG_ERROR([You have no socket()! Aborting.])])
147
148 dnl SunOS/Solaris required libnsl for inet_ntoa()
149 if test x"$SUN" = xyes; then
150 AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])])
151 fi
152
153 AC_SEARCH_LIBS(crypt, [crypt descrypt],,)
154
155 CRYPT_LIB=$ac_cv_search_crypt
156
157 if test "$CRYPT_LIB" = "none required"; then
158 unset CRYPT_LIB
159 elif test "$CRYPT_LIB" = no; then
160 unset CRYPT_LIB
161 fi
162
163 AC_SUBST(CRYPT_LIB)
164
165 AC_C_BIGENDIAN
166
167 dnl Check for stdarg.h - if we can't find it, halt configure
168 AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - solanum will not compile without it **])])
169 AC_CHECK_FUNCS([strlcat strlcpy])
170
171 AC_TYPE_INT16_T
172 AC_TYPE_INT32_T
173
174 AC_CHECK_TYPES([uintptr_t])
175
176 dnl check for various functions...
177
178 AC_FUNC_ALLOCA
179
180 dnl OpenSSL support
181 AC_MSG_CHECKING(for OpenSSL)
182 AC_ARG_ENABLE(openssl,
183 [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).])
184 AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])],
185 [cf_enable_openssl=$enableval],
186 [cf_enable_openssl="auto"])
187
188 if test "$cf_enable_openssl" != "no" ; then
189 cf_openssl_basedir=""
190 if test "$cf_enable_openssl" != "auto" &&
191 test "$cf_enable_openssl" != "yes" ; then
192 dnl Support for --enable-openssl=/some/place
193 cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`"
194 else
195 dnl Do the auto-probe here. Check some common directory paths.
196 for dirs in /usr/local/ssl /usr/pkg /usr/local \
197 /usr/local/openssl ; do
198 if test -f "${dirs}/include/openssl/opensslv.h" ; then
199 cf_openssl_basedir="${dirs}"
200 break
201 fi
202 done
203 unset dirs
204 fi
205 dnl Now check cf_openssl_found to see if we found anything.
206 if test ! -z "$cf_openssl_basedir"; then
207 if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then
208 SSL_INCLUDES="-I${cf_openssl_basedir}/include"
209 SSL_LIBS="-L${cf_openssl_basedir}/lib"
210 else
211 dnl OpenSSL wasn't found in the directory specified. Naughty
212 dnl administrator...
213 cf_openssl_basedir=""
214 fi
215 else
216 dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
217 dnl are in /usr/include and /usr/lib. In this case, we don't want to
218 dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
219 dnl We can't do this check above, because some people want two versions
220 dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
221 dnl and they want /usr/local/ssl to have preference.
222 if test -f "/usr/include/openssl/opensslv.h" ; then
223 cf_openssl_basedir="/usr"
224 fi
225 fi
226
227 dnl If we have a basedir defined, then everything is okay. Otherwise,
228 dnl we have a problem.
229 if test ! -z "$cf_openssl_basedir"; then
230 AC_MSG_RESULT($cf_openssl_basedir)
231 cf_enable_openssl="yes"
232 else
233 AC_MSG_RESULT([not found. Specify a correct path?])
234 cf_enable_openssl="no"
235 fi
236 unset cf_openssl_basedir
237 else
238 dnl If --disable-openssl was specified
239 AC_MSG_RESULT(disabled)
240 fi
241
242 save_CPPFLAGS="$CPPFLAGS"
243 CPPFLAGS="$CPPFLAGS $SSL_INCLUDES"
244 save_LIBS="$LIBS"
245 LIBS="$LIBS $SSL_LIBS"
246 if test "$cf_enable_openssl" != no; then
247 dnl Check OpenSSL version (must be 0.9.6 or above!)
248 AC_MSG_CHECKING(for OpenSSL 0.9.6 or above)
249 AC_RUN_IFELSE(
250 [AC_LANG_PROGRAM(
251 [#include <openssl/opensslv.h>
252 #include <stdlib.h>],
253 [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000)
254 exit(0); else exit(1);]])],
255 cf_openssl_version_ok=yes,
256 cf_openssl_version_ok=no,
257 cf_openssl_version_ok=no)
258
259 if test "$cf_openssl_version_ok" = yes; then
260 AC_MSG_RESULT(found)
261
262 dnl Work around pmake/gmake conditional incompatibilities
263 AC_SUBST(ENCSPEED, encspeed)
264
265 dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers
266 CPPFLAGS="$CPPFLAGS $SSL_LIBS"
267 AC_CHECK_LIB(crypto, RSA_free)
268 SSL_LIBS="$SSL_LIBS -lcrypto"
269 SSL_SRCS_ENABLE='$(SSL_SRCS)'
270 else
271 AC_MSG_RESULT(no - OpenSSL support disabled)
272 fi
273 fi
274
275 CPPFLAGS="$save_CPPFLAGS"
276 LIBS="$save_LIBS"
277
278 dnl End OpenSSL detection
279
280
281 dnl Specialized functions and libraries
282 dnl ===================================
283
284 AC_ARG_ENABLE(hyperscan,
285 AC_HELP_STRING([--disable-hyperscan],[Disable hyperscan support]),
286 [hyperscan=$enableval],[hyperscan=yes])
287
288 AS_IF([test "$hyperscan" = yes], [
289 save_CPPFLAGS="$CPPFLAGS"
290 save_LIBS="$LIBS"
291 PKG_CHECK_MODULES([HS], [libhs >= 4], [], [hyperscan=no])
292 CPPFLAGS="$CPPFLAGS $HS_CFLAGS"
293 LIBS="$LIBS $HS_LIBS"
294 AC_CHECK_HEADER([hs_common.h], [], [hyperscan=no])
295 AC_CHECK_FUNC([hs_scan], [], [hyperscan=no])
296 ])
297
298 AS_IF([test "$hyperscan" = no], [
299 CPPFLAGS="$save_CPPFLAGS"
300 LIBS="$save_LIBS"
301 ])
302
303 AM_CONDITIONAL([HAVE_HYPERSCAN], [test "$hyperscan" = "yes"])
304
305
306 AC_ARG_WITH(sctp-path,
307 AC_HELP_STRING([--with-sctp-path=DIR],[Path to libsctp.so for SCTP support.]),
308 [LIBS="$LIBS -L$withval"],)
309
310 AC_ARG_ENABLE(sctp,
311 AC_HELP_STRING([--disable-sctp],[Disable SCTP support]),
312 [sctp=$enableval],[sctp=yes])
313
314 if test "$sctp" = yes; then
315
316 AC_CHECK_HEADER(netinet/sctp.h, [
317 AC_SEARCH_LIBS(sctp_bindx, sctp,
318 [
319 AC_DEFINE(HAVE_LIBSCTP, 1, [Define to 1 if libsctp (-lsctp) is available.])
320 ], sctp=no)
321 ], sctp=no)
322
323 fi
324
325 dnl Check for shared sqlite
326 dnl ======================
327 PKG_CHECK_MODULES(SQLITE, [sqlite3], [], AC_ERROR([sqlite3 is required]))
328
329 AC_SUBST(SQLITE_LD, "$SQLITE_LIBS")
330 AC_SUBST(SQLITE_INCLUDES, "$SQLITE_CFLAGS")
331
332 dnl **********************************************************************
333 dnl Check for --with-confdir [deprecated, use --sysconfdir instead]
334 dnl **********************************************************************
335
336 AC_ARG_WITH([confdir],
337 [AC_HELP_STRING([--with-confdir=DIR],
338 [Directory to install config files [deprecated, use --sysconfdir instead].])],
339 [ sysconfdir=`echo $withval | sed 's/\/$//'` ],
340 [ confdir='${sysconfdir}' ])
341 AC_DEFINE_DIR([ETC_DIR], [sysconfdir], [Prefix where config files are installed.])
342
343 dnl **********************************************************************
344 dnl Check for --with-logdir
345 dnl **********************************************************************
346
347 AC_MSG_CHECKING([whether to modify logdir])
348 AC_ARG_WITH(logdir,
349 AC_HELP_STRING([--with-logdir=DIR],
350 [Directory where to write logfiles.]),
351 [ logdir=`echo $withval | sed 's/\/$//'`
352 AC_MSG_RESULT(yes)],
353 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
354 [logdir='${localstatedir}/log/${PACKAGE_TARNAME}'],
355 [logdir='${prefix}/logs'])
356 AC_MSG_RESULT(no)])
357 AC_DEFINE_DIR([LOG_DIR], [logdir], [Prefix where to write logfiles.])
358 AC_SUBST_DIR([logdir])
359
360 dnl **********************************************************************
361 dnl Check for --with-helpdir
362 dnl **********************************************************************
363
364 AC_MSG_CHECKING([whether to modify helpdir])
365 AC_ARG_WITH(helpdir,
366 AC_HELP_STRING([--with-helpdir=DIR],
367 [Directory to install help files.]),
368 [ helpdir=`echo $withval | sed 's/\/$//'`
369 AC_MSG_RESULT(yes) ],
370 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
371 [helpdir='${datadir}/${PACKAGE_TARNAME}/help'],
372 [helpdir='${prefix}/help'])
373 AC_MSG_RESULT(no) ])
374 AC_DEFINE_DIR([HELP_DIR], [helpdir], [Prefix where help files are installed.])
375 AC_SUBST_DIR([helpdir])
376
377 dnl **********************************************************************
378 dnl Check for --with-moduledir
379 dnl **********************************************************************
380
381 AC_MSG_CHECKING([whether to modify moduledir])
382 AC_ARG_WITH(moduledir,
383 [AC_HELP_STRING([--with-moduledir=DIR],
384 [Directory to install modules.])],
385 [ moduledir=`echo $withval | sed 's/\/$//'`
386 AC_MSG_RESULT(yes)],
387 [ AS_IF([test "x$enable_fhs_paths" = "xyes"],
388 [moduledir='${pkglibdir}/modules'],
389 [moduledir='${prefix}/modules'])
390 AC_MSG_RESULT(no)
391 ])
392 AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.])
393 AC_SUBST_DIR([moduledir])
394
395 dnl Check for --with-rundir
396
397 AC_MSG_CHECKING([whether or modify rundir])
398 AC_ARG_WITH([rundir],
399 [AC_HELP_STRING([--with-rundir=DIR],
400 [Directory in which to store pidfile.])],
401 [AC_MSG_RESULT([yes])
402 rundir=`echo $withval | sed 's/\/$//'`],
403 [AC_MSG_RESULT([no])
404 AS_IF([test "x$enable_fhs_paths" = "xyes"],
405 [rundir='${prefix}/run'],
406 [rundir='${sysconfdir}'])])
407 AC_SUBST([rundir])
408 AC_DEFINE_DIR([PKGRUNDIR], [pkgrundir], [Directory to store pidfile in.])
409
410 dnl Installed utility program prefixes (does not affect binaries
411 dnl installed into pkglibexecdir)
412 AC_MSG_CHECKING([for program prefix])
413 AC_ARG_WITH([program-prefix],
414 [AS_HELP_STRING([--with-program-prefix=], [If set, programs installed into PATH will be installed with names prefixed by this prefix.])],
415 [test "x$with_program_prefix" = "xno" && with_program_prefix=],
416 [with_program_prefix=])
417 AC_MSG_RESULT(["$with_program_prefix"])
418 PROGRAM_PREFIX="$with_program_prefix"
419 AC_SUBST([PROGRAM_PREFIX])
420 AC_DEFINE_UNQUOTED([PROGRAM_PREFIX], ["$with_program_prefix"], [String with which all programs intended to be in PATH are prefixed.])
421
422 dnl **********************************************************************
423 dnl Branding
424 dnl **********************************************************************
425
426 AC_MSG_CHECKING([whether custom branding is requested])
427 AC_ARG_WITH(custom-branding,
428 AC_HELP_STRING([--with-custom-branding=NAME],
429 [Custom branding name.]),
430 [BRANDING_NAME=$withval
431 AC_MSG_RESULT([yes])],
432 [BRANDING_NAME=$PACKAGE_NAME
433 AC_MSG_RESULT([no])]
434 )
435
436 AC_MSG_CHECKING([whether a custom version is requested])
437 AC_ARG_WITH(custom-version,
438 AC_HELP_STRING([--with-custom-version=NAME],
439 [Custom version branding.]),
440 [BRANDING_VERSION=$withval
441 AC_MSG_RESULT([yes])],
442 [BRANDING_VERSION=$PACKAGE_VERSION
443 AC_MSG_RESULT([no])]
444 )
445
446 AC_DEFINE_UNQUOTED(BRANDING_NAME, ["$BRANDING_NAME"], [Custom branding name.])
447 AC_DEFINE_UNQUOTED(BRANDING_VERSION, ["$BRANDING_VERSION"], [Custom branding name.])
448
449 if test "x$BRANDING_NAME" != "x$PACKAGE_NAME"; then
450 AC_DEFINE(CUSTOM_BRANDING, 1, [Define if custom branding is enabled.])
451 fi
452
453 dnl **********************************************************************
454 dnl Enable oper chghost
455 dnl **********************************************************************
456
457 AC_ARG_ENABLE(oper-chghost,
458 AC_HELP_STRING([--enable-oper-chghost],[Enable opers to use the CHGHOST command]),
459 [operchghost=$enableval],[operchghost=no])
460
461 if test "$operchghost" = yes; then
462 AC_DEFINE(ENABLE_OPER_CHGHOST, 1, [Define this to enable opers to use the CHGHOST command.])
463 fi
464
465 dnl Debug-related options
466 dnl =====================
467
468 AC_ARG_ENABLE(assert,
469 AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]),
470 [assert=$enableval], [assert=no])
471
472 if test "$assert" = no; then
473 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
474 elif test "$assert" = soft; then
475 AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.])
476 AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.])
477 elif test "$assert" = yes; then
478 assert="hard"
479 fi
480
481 AC_MSG_CHECKING(if you want to do a profile build)
482 AC_ARG_ENABLE(profile,
483 AC_HELP_STRING([--enable-profile],[Enable profiling]),
484 [profile=$enableval], [profile=no])
485
486 if test "$profile" = yes; then
487 if test "$ac_cv_c_compiler_gnu" = yes; then
488 IRC_CFLAGS="$IRC_CFLAGS -pg"
489 AC_MSG_RESULT([yes, adding -pg])
490 AC_DEFINE(SOLANUM_PROFILE, 1, [Define this if you are profiling.])
491 else
492 AC_MSG_RESULT([no, profile builds only work with gcc])
493 fi
494 else
495 AC_MSG_RESULT(no)
496 fi
497
498 AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.])
499 AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.])
500 AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.])
501 AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.])
502 AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.])
503 AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.])
504 AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.])
505 AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.])
506 AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.])
507 AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.])
508 AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.])
509 AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.])
510 AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.])
511 AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.])
512 AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.])
513 AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.])
514
515 AC_ARG_WITH(nicklen,
516 AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGTH (default 31, max 50)]),
517 [
518 if ! expr "$withval" + 0 >/dev/null 2>&1; then
519 AC_ERROR([NICKLEN must be a numeric value])
520 fi
521 if test $withval -gt 50; then
522 NICKLEN=50
523 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50])
524 elif test $withval -lt 9; then
525 NICKLEN=9
526 AC_MSG_WARN([NICKLEN has a lower limit of 9. Setting NICKLEN=9])
527 else
528 NICKLEN="$withval"
529 fi
530 ], [NICKLEN=31])
531
532 AC_ARG_WITH(topiclen,
533 AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]),
534 [
535 if test $withval -gt 390; then
536 TOPICLEN=390
537 AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390])
538 else
539 TOPICLEN=$withval
540 fi
541 ], [TOPICLEN=390])
542
543 AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)])
544 AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length])
545
546
547 AC_ARG_WITH(asan,
548 AC_HELP_STRING([--with-asan],[Build with Address Sanitizer]),
549 [
550 CFLAGS="$CFLAGS -fsanitize=address"
551 LDFLAGS="$LDFLAGS -fsanitize=address"
552 ])
553
554 # rpath, for finding librb.so at run time
555 hold_ldflags=$LDFLAGS
556 AC_MSG_CHECKING(for the ld -rpath flag)
557 LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}"
558 AC_LINK_IFELSE([AC_LANG_PROGRAM([],[int i;])], found=yes, found=no)
559 LDFLAGS=$hold_ldflags
560 AC_MSG_RESULT($found)
561 if test "$found" = yes; then
562 LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}"
563 fi
564
565 # This must be down here, or it will mess up checks like the ones
566 # for -Wl,-export-dynamic
567 # -- jilles
568 CWARNS=""
569 AC_ARG_ENABLE(warnings,
570 AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]),
571 [
572 IRC_CFLAGS="$IRC_CFLAGS -O0"
573 CFLAGS="$IRC_CFLAGS"
574
575 SOLANUM_C_GCC_TRY_FLAGS([-Wall], solanum_cv_c_gcc_w_all)
576 SOLANUM_C_GCC_TRY_FLAGS([-Wpointer-arith], solanum_cv_c_gcc_w_pointer_arith)
577 SOLANUM_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], solanum_cv_c_gcc_w_implicit)
578 SOLANUM_C_GCC_TRY_FLAGS([-Wcast-align], solanum_cv_c_gcc_w_cast_align)
579 SOLANUM_C_GCC_TRY_FLAGS([-Wcast-qual], solanum_cv_c_gcc_w_cast_qual)
580 SOLANUM_C_GCC_TRY_FLAGS([-Wwrite-strings], solanum_cv_c_gcc_w_write_strings)
581 SOLANUM_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], solanum_cv_c_gcc_w_error_implicit_function_declaration)
582 SOLANUM_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], solanum_cv_c_gcc_prototypes)
583 SOLANUM_C_GCC_TRY_FLAGS([-Wparentheses], solanum_cv_c_gcc_parentheses)
584 SOLANUM_C_GCC_TRY_FLAGS([-W -Wno-unused], solanum_cv_c_gcc_w)
585 SOLANUM_C_GCC_TRY_FLAGS([-Wextra], solanum_cv_c_gcc_w_extra)
586 SOLANUM_C_GCC_TRY_FLAGS([-Wshadow], solanum_cv_c_gcc_w_shadow)
587 SOLANUM_C_GCC_TRY_FLAGS([-Wmissing-noreturn], solanum_cv_c_gcc_w_missing_noreturn)
588 SOLANUM_C_GCC_TRY_FLAGS([-Wundef], solanum_cv_c_gcc_w_undef)
589 SOLANUM_C_GCC_TRY_FLAGS([-Wpacked], solanum_cv_c_gcc_w_packed)
590 SOLANUM_C_GCC_TRY_FLAGS([-Wnested-externs], solanum_cv_c_gcc_w_nested_externs)
591 SOLANUM_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], solanum_cv_c_gcc_w_unused)
592 SOLANUM_C_GCC_TRY_FLAGS([-Wredundant-decls], solanum_cv_c_gcc_w_redundant_decls)
593 SOLANUM_C_GCC_TRY_FLAGS([-Wfloat-equal], solanum_cv_c_gcc_w_float_equal)
594 SOLANUM_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wno-format-security], solanum_cv_c_gcc_w_format)
595
596 IRC_CFLAGS="$CFLAGS"
597 ],[])
598
599 IRC_CFLAGS="$IRC_CFLAGS $CWARNS"
600
601 AC_SUBST(MODULES_LIBS)
602 AC_SUBST(MOD_TARGET)
603
604 AC_SUBST(SSL_SRCS_ENABLE)
605 AC_SUBST(SSL_INCLUDES)
606 AC_SUBST(SSL_LIBS)
607
608 AC_SUBST(LDFLAGS)
609 AC_SUBST(PICFLAGS)
610 AC_SUBST(IRC_CFLAGS)
611 AC_SUBST(SEDOBJ)
612
613
614 if test "$prefix" = "NONE"; then
615 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.])
616 else
617 dnl Strip trailing slashes to prevent a path of '//'
618 prefix=`echo $prefix | sed 's/\/$//'`
619 AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.])
620 fi
621
622 AC_CONFIG_FILES( \
623 Makefile \
624 authd/Makefile \
625 bandb/Makefile \
626 ssld/Makefile \
627 wsockd/Makefile \
628 extensions/Makefile \
629 ircd/Makefile \
630 modules/Makefile \
631 tests/Makefile \
632 tools/Makefile \
633 tools/genssl \
634 doc/Makefile \
635 help/Makefile \
636 )
637 AC_CONFIG_COMMANDS([tools/genssl_chmod], [chmod 755 tools/genssl])
638
639 AC_OUTPUT
640
641 if test "$cf_openssl_version_ok" = yes; then
642 openssl="yes"
643 else
644 openssl="no"
645 fi
646
647 echo "
648 Configuration of ${BRANDING_NAME}-${BRANDING_VERSION}:
649 Install directory : $prefix
650
651 OpenSSL : $openssl
652 SCTP : $sctp
653
654 Nickname length : $NICKLEN
655 Topic length : $TOPICLEN
656
657 Use (g)make to compile $BRANDING_NAME, then (g)make install to install it.
658 "