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