1 dnl Prefered emacs editing mode: -*- shell-script -*-
3 dnl Process this file with autoconf to produce a configure script.
5 dnl Copyright (c) 1997, by Carlo Wood <carlo@runaway.xs4all.nl>
6 dnl Copyright (C) 2001 Kevin L. Mitchell <klmitch@mit.edu>
8 dnl This program is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU General Public License as published by
10 dnl the Free Software Foundation; either version 1, or (at your option)
11 dnl any later version.
13 dnl This program is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 dnl GNU General Public License for more details.
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this program; if not, write to the Free Software
20 dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 dnl Make sure we are in the correct directory (someone could have run
25 dnl 'configure' with a wrong '--srcdir').
28 dnl Set the default prefix
29 AC_PREFIX_DEFAULT([$HOME])
30 AC_MSG_CHECKING([for installation prefix])
31 AC_CACHE_VAL(unet_cv_prefix, [unet_cv_prefix=$HOME])
32 if test x"$prefix" != xNONE; then
33 unet_cv_prefix=$prefix
35 AC_MSG_RESULT([$unet_cv_prefix])
36 dnl HACK WARNING: We are referencing an autoconf internal variable. This is
37 dnl the only way to force the prefix to be retrieved from the config.cache
39 ac_default_prefix=$unet_cv_prefix
41 dnl Define the input and output configuration header file.
42 AC_CONFIG_HEADER([config.h])
44 dnl Demand at least version 2.59 of autoconf (for AS_HELP_STRING)
47 dnl Find out what type of system we are
50 dnl This should be done early.
53 dnl ANSIfy the C compiler whenever possible.
56 dnl Checks for libraries.
58 dnl Locate the library containing crypt
59 AC_SEARCH_LIBS(crypt, descrypt crypt, ,
60 [AC_MSG_ERROR([Unable to find library containing crypt()])])
62 dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
65 dnl Checks for header files.
67 AC_CHECK_HEADERS(crypt.h poll.h inttypes.h stdint.h sys/devpoll.h sys/epoll.h sys/event.h sys/param.h sys/resource.h sys/socket.h)
69 dnl Checks for typedefs, structures, and compiler characteristics
77 AC_CHECK_TYPE(struct sockaddr_in6, [unet_have_sockaddr_in6="yes"], [unet_have_sockaddr_in6="no"], [#include <sys/types.h>
78 #include <netinet/in.h>])
80 dnl Check for socklen_t. In traditional BSD this is an int, but some
81 dnl OSes use a different type. Test until we find something that will
82 dnl work properly. Test borrowed from a patch submitted for Python.
83 AC_CHECK_TYPE([socklen_t], ,[
84 AC_MSG_CHECKING([for socklen_t equivalent])
85 AC_CACHE_VAL([curl_cv_socklen_t_equiv],
87 dnl Systems have either "struct sockaddr*" or "void*" as second
88 dnl arg to getpeername.
89 curl_cv_socklen_t_equiv=
90 for arg2 in "struct sockaddr" void ; do
91 for t in int size_t unsigned long "unsigned long" ; do
92 AC_TRY_COMPILE([#include <sys/types.h>
93 #include <sys/socket.h>
94 int getpeername (int $arg2 *, $t *);],[$t len;
95 getpeername(0, 0, &len);], [curl_cv_socklen_t_equiv="$t"
100 AC_MSG_RESULT($curl_cv_socklen_t_equiv)
101 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
102 [type to use in place of socklen_t if not defined])],
103 [#include <sys/types.h>
104 #include<sys/socket.h>])
106 dnl Checks for library functions.
107 AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
109 dnl Do we have restarting syscalls ?
110 AC_SYS_RESTARTABLE_SYSCALLS
112 dnl Check for required features for admins?
113 AC_MSG_CHECKING([for donuts])
116 dnl Test for programs
121 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
122 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
124 dnl (F)LEX - needed for the new conf file parser
126 dnl The autoconf docs say $LEX defaults to 'lex'. They lie.
127 if test "$LEX" = ":" ; then
128 AC_MSG_ERROR([Cannot find flex.])
129 elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
132 AC_MSG_ERROR([Cannot use $LEX as flex.])
137 dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
138 dnl but judging from AC_PROG_LEX, it may not stay true.
139 if test "$YACC" = ":" ; then
140 AC_MSG_ERROR([Cannot find yacc.])
141 elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
144 dnl byacc does not seem to have any way to test for workingness, so only warn.
145 AC_MSG_WARN([$YACC may not work as yacc.])
151 dnl Check OS for os_dep files.
152 AC_MSG_CHECKING(for OS-dependent information)
155 AC_MSG_RESULT([Linux ($host) found.])
156 unet_poll_syscall=yes
160 AC_MSG_RESULT([Solaris ($host) found.])
161 if test x"$ac_cv_header_poll_h" = xyes; then
162 unet_poll_syscall=yes
166 AC_DEFINE([IRCU_SOLARIS], 1, [Define if building on Solaris])
170 AC_MSG_RESULT([Solaris ($host) found.])
175 AC_MSG_RESULT([OpenBSD ($host) found.])
176 if test x"$ac_cv_header_poll_h" = xyes; then
177 unet_poll_syscall=yes
184 AC_MSG_RESULT([Generic BSD ($host) found.])
185 if test x"$ac_cv_header_poll_h" = xyes; then
186 unet_poll_syscall=yes
193 AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
198 AC_MSG_RESULT([Unknown system type $host found.])
199 AC_MSG_WARN([Unknown OS type; using generic routines.])
204 dnl Check user configuration options
205 dnl Start with --enable-poll
206 AC_MSG_CHECKING([whether to enable use of poll()])
207 AC_ARG_ENABLE([poll],
208 [ --enable-poll Force poll to be used regardless of whether or not
209 it is a system call],
210 [unet_cv_enable_poll=$enable_poll],
211 [AC_CACHE_VAL(unet_cv_enable_poll,
212 [unet_cv_enable_poll=$unet_poll_syscall])])
214 # Force poll to be disabled if there is no poll.h
215 if test x"$ac_cv_header_poll_h" != xyes; then
216 unet_cv_enable_poll=no
219 AC_MSG_RESULT([$unet_cv_enable_poll])
221 if test x"$unet_cv_enable_poll" = xyes; then
222 AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
223 ENGINE_C=engine_poll.c
225 ENGINE_C=engine_select.c
229 dnl Now look for --enable-debug
230 AC_MSG_CHECKING([whether to enable debug mode])
231 AC_ARG_ENABLE([debug],
232 [ --enable-debug Turn on debugging mode],
233 [unet_cv_enable_debug=$enable_debug],
234 [AC_CACHE_VAL(unet_cv_enable_debug,
235 [unet_cv_enable_debug=no])])
236 AC_MSG_RESULT([$unet_cv_enable_debug])
238 if test x"$unet_cv_enable_debug" = xyes; then
239 AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
242 dnl Now look for --enable-leak-detect
243 AC_MSG_CHECKING([whether to enable leak detection])
244 AC_ARG_WITH([leak-detect],
245 [ --with-leak-detect Turn on the leak detector(requires patched boehm)],
246 [unet_cv_with_leak_detect=$with_leak_detect],
247 [AC_CACHE_VAL(unet_cv_with_leak_detect,
248 [unet_cv_with_leak_detect=no])])
249 AC_MSG_RESULT([$unet_cv_enable_leak_detect])
251 if test x"$unet_cv_with_leak_detect" != xno; then
253 CFLAGS="-DMDEBUG $CFLAGS"
254 if test x"$unet_cv_with_leak_detect" != xyes; then
255 LIBS="-L$unet_cv_with_leak_detect $LIBS"
260 AS_HELP_STRING([--without-ipv6], [disable IPv6 support (default is autodetect)]),
261 [ac_cv_use_ipv6=$withval],
262 [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
263 AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
264 if test x"$ac_cv_use_ipv6" != "xno" ; then
265 AC_DEFINE([IPV6], 1, [Enable IPv6 support])
268 dnl And now for --disable-asserts
269 AC_MSG_CHECKING([whether to enable asserts])
270 AC_ARG_ENABLE([asserts],
271 [ --disable-asserts Disable assertion checking],
272 [unet_cv_enable_asserts=$enable_asserts],
273 [AC_CACHE_VAL(unet_cv_enable_asserts,
274 [unet_cv_enable_asserts=yes])])
275 AC_MSG_RESULT([$unet_cv_enable_asserts])
277 if test x"$unet_cv_enable_asserts" = xno; then
278 AC_DEFINE([NDEBUG], 1, [Disable assertions])
281 dnl Now check for --enable-profile
282 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
283 AC_ARG_ENABLE([profile],
284 [ --enable-profile Enable profiling support (add -pg to CFLAGS and LDFLAGS)],
285 [unet_cv_enable_profile=$enable_profile],
286 [AC_CACHE_VAL(unet_cv_enable_profile,
287 [unet_cv_enable_profile=no])])
288 AC_MSG_RESULT([$unet_cv_enable_profile])
290 if test x"$unet_cv_enable_profile" = xyes; then
292 LDFLAGS="-pg $LDFLAGS"
295 dnl Now check for --enable-pedantic
296 AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
297 AC_ARG_ENABLE([pedantic],
298 [ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
299 [unet_cv_enable_pedantic=$enable_pedantic],
300 [AC_CACHE_VAL(unet_cv_enable_pedantic,
301 [unet_cv_enable_pedantic=no])])
302 AC_MSG_RESULT([$unet_cv_enable_pedantic])
304 if test x"$unet_cv_enable_pedantic" = xyes; then
305 CFLAGS="-pedantic $CFLAGS"
308 dnl Now check for --enable-warnings
309 AC_MSG_CHECKING([whether to enable compiler warnings])
310 AC_ARG_ENABLE([warnings],
311 [ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
312 [unet_cv_enable_warnings=$enable_warnings],
313 [AC_CACHE_VAL(unet_cv_enable_warnings,
314 [unet_cv_enable_warnings=no])])
315 AC_MSG_RESULT([$unet_cv_enable_warnings])
317 if test x"$unet_cv_enable_warnings" = xyes; then
318 CFLAGS="-Wall $CFLAGS"
321 dnl --disable-inlines check...
322 AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
323 AC_ARG_ENABLE([inlines],
324 [ --disable-inlines Disable inlining for a few critical functions],
325 [unet_cv_enable_inlines=$enable_inlines],
326 [AC_CACHE_VAL(unet_cv_enable_inlines,
327 [unet_cv_enable_inlines=yes])])
328 AC_MSG_RESULT([$unet_cv_enable_inlines])
330 if test x"$unet_cv_enable_inlines" = xyes; then
331 AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
334 dnl --disable-devpoll check...
335 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
336 AC_ARG_ENABLE([devpoll],
337 [ --disable-devpoll Disable the /dev/poll-based engine],
338 [unet_cv_enable_devpoll=$enable_devpoll],
339 [AC_CACHE_VAL(unet_cv_enable_devpoll,
340 [unet_cv_enable_devpoll=yes])])
342 if test x"$ac_cv_header_sys_devpoll_h" = xno; then
343 unet_cv_enable_devpoll=no
346 AC_MSG_RESULT([$unet_cv_enable_devpoll])
348 if test x"$unet_cv_enable_devpoll" != xno; then
349 AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
350 ENGINE_C="engine_devpoll.c $ENGINE_C"
353 dnl --disable-kqueue check...
354 AC_MSG_CHECKING([whether to enable the kqueue event engine])
355 AC_ARG_ENABLE([kqueue],
356 [ --disable-kqueue Disable the kqueue-based engine],
357 [unet_cv_enable_kqueue=$enable_kqueue],
358 [AC_CACHE_VAL(unet_cv_enable_kqueue,
359 [unet_cv_enable_kqueue=yes])])
361 if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
362 unet_cv_enable_kqueue=no
365 AC_MSG_RESULT([$unet_cv_enable_kqueue])
367 if test x"$unet_cv_enable_kqueue" != xno; then
368 AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
369 ENGINE_C="engine_kqueue.c $ENGINE_C"
372 dnl --disable-epoll check
373 AC_MSG_CHECKING([whether to enable the epoll event engine])
374 AC_ARG_ENABLE([epoll],
375 [ --disable-epoll Disable the epoll-based engine],
376 [unet_cv_enable_epoll=$enable_epoll],
377 [AC_CACHE_VAL(unet_cv_enable_epoll,
378 [unet_cv_enable_epoll=yes])])
380 if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno; then
381 unet_cv_enable_epoll=no
384 AC_MSG_RESULT([$unet_cv_enable_epoll])
386 dnl If we have the header and user has not refused epoll, we still need
387 dnl to check whether the functions are properly defined.
388 if test x"$unet_cv_enable_epoll" != xno; then
389 AC_MSG_CHECKING([whether epoll functions are properly defined])
390 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
391 [AC_MSG_RESULT([yes])],
393 AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
394 AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
395 ENGINE_C="engine_epoll.c $ENGINE_C"
398 dnl How to copy one va_list to another?
399 AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
400 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
401 [unet_cv_c_va_copy="yes"],
402 [unet_cv_c_va_copy="no"]
404 if test "$unet_cv_c_va_copy" = "yes" ; then
405 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
408 AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
409 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
410 [unet_cv_c___va_copy="yes"],
411 [unet_cv_c___va_copy="no"]
413 if test "$unet_cv_c___va_copy" = "yes" ; then
414 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
417 dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
418 AC_MSG_CHECKING([what name to give the symlink])
419 AC_ARG_WITH([symlink],
420 [ --with-symlink=name Name to give the symlink; if name is "no," no
421 symlink will be created.],
422 [unet_cv_with_symlink=$with_symlink],
423 [AC_CACHE_VAL(unet_cv_with_symlink,
424 [unet_cv_with_symlink="ircd"])])
426 if test x"$unet_cv_with_symlink" = xyes; then
427 unet_cv_with_symlink="ircd"
430 AC_MSG_RESULT([$unet_cv_with_symlink])
432 if test x"$unet_cv_with_symlink" = xno; then
433 INSTALL_RULE=install-no-symlink
436 INSTALL_RULE=install-with-symlink
437 SYMLINK=$unet_cv_with_symlink
439 AC_SUBST(INSTALL_RULE)
442 dnl --with-mode lets us set the permissions on the binary
443 AC_MSG_CHECKING([what permissions to set on the installed binary])
445 [ --with-mode=mode Permissions (in octal) to give the binary],
446 [unet_cv_with_mode=$with_mode],
447 [AC_CACHE_VAL(unet_cv_with_mode,
448 [unet_cv_with_mode=711])])
450 if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
451 unet_cv_with_mode=711
454 AC_MSG_RESULT([$unet_cv_with_mode])
456 IRCDMODE=$unet_cv_with_mode
459 dnl --with-owner lets us set the owner of the binary
461 unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
463 AC_MSG_CHECKING([which user should own the installed binary])
465 [ --with-owner=owner Specify owner of the installed binary],
466 [unet_cv_with_owner=$with_owner],
467 [AC_CACHE_VAL(unet_cv_with_owner,
468 [unet_cv_with_owner=$unet_uid])])
470 if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
471 unet_cv_with_owner=$unet_uid
474 AC_MSG_RESULT([$unet_cv_with_owner])
476 IRCDOWN=$unet_cv_with_owner
479 dnl --with-group lets us set the group owner of the binary
481 unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
483 AC_MSG_CHECKING([which group should own the installed binary])
485 [ --with-group=group Specify group owner of the installed binary],
486 [unet_cv_with_group=$with_group],
487 [AC_CACHE_VAL(unet_cv_with_group,
488 [unet_cv_with_group=$unet_gid])])
490 if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
491 unet_cv_with_group=$unet_gid
494 AC_MSG_RESULT([$unet_cv_with_group])
496 IRCDGRP=$unet_cv_with_group
499 dnl --with-domain lets us set the domain name for some statistics-gathering
501 if test -f /etc/resolv.conf; then
502 unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
503 if test x"$unet_domain" = x; then
504 unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
507 AC_MSG_CHECKING([for site domain name])
508 AC_ARG_WITH([domain],
509 [ --with-domain=domain Domain name to use in local statistics gathering],
510 [unet_cv_with_domain=$with_domain],
511 [AC_CACHE_VAL(unet_cv_with_domain,
512 [unet_cv_with_domain=$unet_domain])])
514 if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
515 unet_cv_with_domain=$unet_domain
517 if test x"$unet_cv_with_domain" = xno; then
518 AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
521 AC_MSG_RESULT([$unet_cv_with_domain])
523 AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
524 [Domain name to be used for some statistics gathering])
526 dnl --with-chroot lets us define a directory that we are going to be using
527 dnl as the root of our filesystem
528 AC_MSG_CHECKING([if chroot operation is desired])
529 AC_ARG_WITH([chroot],
530 [ --with-chroot=dir Specify that the server will be operated under
531 a different root directory given by dir. See
532 doc/readme.chroot for more information.],
533 [unet_cv_with_chroot=$with_chroot],
534 [AC_CACHE_VAL(unet_cv_with_chroot,
535 [unet_cv_with_chroot=no])])
537 if test x"$unet_cv_with_chroot" = xyes; then
538 AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
541 # Ensure there are no trailing /'s to mess us up
542 unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
544 AC_MSG_RESULT([$unet_cv_with_chroot])
546 dnl Determine some default directory names
548 dnl HACK WARNING: We are referencing an autoconf internal variable. This is
549 dnl the only way to figure out what value $prefix will have when we go to do
550 dnl the install--and the only way we can stick that value in our definitions
552 # Deal with the annoying value "NONE" here
553 unet_save_prefix=$prefix
554 if test x"$prefix" = xNONE; then
555 prefix=$ac_default_prefix
560 unet_save_exec_prefix=$exec_prefix
561 if test x"$exec_prefix" = xNONE; then
564 exec_prefix=$exec_prefix
567 # Obtain the actual interesting directories
568 unet_bindir=`eval echo "$bindir"`
569 unet_libdir=`eval echo "$libdir"`
571 # Restore the original settings of $prefix and $exec_prefix
572 prefix=$unet_save_prefix
573 exec_prefix=$unet_save_exec_prefix
575 dnl Now compute the name of the binary and verify that it will work under
577 AC_MSG_CHECKING([where the binary will be for /restart])
578 if test x"$unet_cv_with_symlink" = xno; then
579 unet_spath="$unet_bindir/ircd"
581 unet_spath="$unet_bindir/$unet_cv_with_symlink"
583 AC_MSG_RESULT([$unet_spath])
585 if test x"$unet_cv_with_chroot" != xno; then
586 if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
587 unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
589 AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
593 AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
595 dnl --with-dpath sets the all-important DPATH
596 AC_MSG_CHECKING([what the data directory should be])
598 [ --with-dpath=dir Directory for all server data files],
599 [unet_cv_with_dpath=$with_dpath],
600 [AC_CACHE_VAL(unet_cv_with_dpath,
601 [unet_cv_with_dpath=$unet_libdir])])
603 if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
604 unet_cv_with_dpath=$unet_libdir
607 # Ensure there are no trailing /'s to mess us up
608 unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
610 AC_MSG_RESULT([$unet_cv_with_dpath])
612 if test x"$unet_cv_with_chroot" != xno; then
613 if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
614 unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
616 AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
619 unet_dpath=$unet_cv_with_dpath
622 AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
624 DPATH=$unet_cv_with_dpath
627 dnl --with-cpath allows us to specify the configuration file
628 AC_MSG_CHECKING([where the default configuration file resides])
630 [ --with-cpath=file Set server configuration file],
631 [unet_cv_with_cpath=$with_cpath],
632 [AC_CACHE_VAL(unet_cv_with_cpath,
633 [unet_cv_with_cpath="ircd.conf"])])
635 if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
636 unet_cv_with_cpath="ircd.conf"
639 AC_MSG_RESULT([$unet_cv_with_cpath])
641 if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
642 # Absolute path; check against chroot stuff
643 if test x"$unet_cv_with_chroot" != xno; then
644 if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
645 unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
647 AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
650 unet_cpath=$unet_cv_with_cpath
653 unet_cpath=$unet_cv_with_cpath
656 AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
658 dnl --with-lpath allows us to specify the default debugging log file
659 AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
661 [ --with-lpath=file Set the debugging log file],
662 [unet_cv_with_lpath=$with_lpath],
663 [AC_CACHE_VAL(unet_cv_with_lpath,
664 [unet_cv_with_lpath="ircd.log"])])
666 if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
667 unet_cv_with_lpath="ircd.log"
670 AC_MSG_RESULT([$unet_cv_with_lpath])
672 if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
673 # Absolute path; check against chroot stuff
674 if test x"$unet_cv_with_chroot" != xno; then
675 if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
676 unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
678 AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
679 unet_cv_with_lpath="ircd.log"
680 unet_lpath="ircd.log"
683 unet_lpath=$unet_cv_with_lpath
686 unet_lpath=$unet_cv_with_lpath
689 AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
691 dnl --with-maxcon allows us to set the maximum connections
692 unet_maxcon=`ulimit -Hn`
693 if test x"$unet_maxcon" = xunlimited; then
694 unet_maxcon=`ulimit -Sn`
696 unet_maxcon=`expr $unet_maxcon - 4`
697 AC_MSG_CHECKING([max connections])
698 AC_ARG_WITH([maxcon],
699 [ --with-maxcon=maxcon Maximum number of connections server will accept],
700 [unet_cv_with_maxcon=$with_maxcon],
701 [AC_CACHE_VAL(unet_cv_with_maxcon,
702 [unet_cv_with_maxcon=$unet_maxcon])])
704 if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
705 if test "$unet_maxcon" -lt 32; then
706 AC_MSG_ERROR([Maximum connections (number of open files minus 4) must be at least 32.])
708 unet_cv_with_maxcon=$unet_maxcon
709 elif test "$unet_cv_with_maxcon" -lt 32; then
710 AC_MSG_ERROR([Maximum connections (--with-maxcon) must be at least 32.])
713 AC_MSG_RESULT([$unet_cv_with_maxcon])
715 AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
716 [Maximum number of network connections])
718 dnl Finally really generate all output files:
719 AC_OUTPUT(Makefile ircd/Makefile ircd/test/Makefile doc/Makefile, [echo timestamp > stamp-h])
721 dnl Report configuration
722 AC_OUTPUT_COMMANDS([echo "
723 ircu is now hopefully configured for your system.
725 Host system: $host_os
727 Asserts: $unet_cv_enable_asserts
728 Warnings: $unet_cv_enable_warnings
729 Debug: $unet_cv_enable_debug
730 Profile: $unet_cv_enable_profile
731 Owner/mode: $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
732 Chroot: $unet_cv_with_chroot
734 Domain: $unet_cv_with_domain
735 DPath: $unet_cv_with_dpath
736 CPath: $unet_cv_with_cpath
737 LPath: $unet_cv_with_lpath
738 Maximum connections: $unet_cv_with_maxcon
740 poll() engine: $unet_cv_enable_poll
741 kqueue() engine: $unet_cv_enable_kqueue
742 /dev/poll engine: $unet_cv_enable_devpoll
743 epoll() engine: $unet_cv_enable_epoll