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