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.50 of autoconf
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.
55 dnl Allow specification of optimization level.
56 AC_ARG_WITH([optimization],
57 AS_HELP_STRING([--with-optimization=[-O2]], [Explicitly set the compiler optimization flags (default: -O3)]),
58 [unet_cv_optimization=$withval],
59 [unet_cv_optimization='-O3'])
60 AC_CACHE_CHECK([optimization level], [unet_cv_optimization], [unet_cv_optimization='-O3'])
61 if test "x$unet_cv_optimization" = "xno" ; then
62 unet_cv_optimization=""
64 if test x"$CFLAGS" != x; then
65 CFLAGS=`echo "$CFLAGS" | sed -e s/-O2/$unet_cv_optimization/`
67 dnl Remove -pipe during configure
68 if test x"$CFLAGS" != x; then
69 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
71 dnl Notice the -g flag and deal accordingly
72 if test x"$CFLAGS" != x; then
73 unet_old_cflags=$CFLAGS
74 CFLAGS=`echo "$CFLAGS" | sed -e 's/-g//g'`
76 if test x"$CFLAGS" != x"$unet_old_cflags"; then
77 # If -g was already there, force symbols to be enabled
78 unet_cv_enable_symbols=yes
80 dnl Notice the -pg flag and deal accordingly
81 if test x"$CFLAGS" != x; then
82 unet_old_cflags=$CFLAGS
83 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pg//g'`
85 if test x"$CFLAGS" != x"$unet_old_cflags"; then
86 # If -pg was already there, force profiling to be enabled
87 unet_cv_enable_profile=yes
89 dnl Notice the -Wall flag and deal accordingly
90 if test x"$CFLAGS" != x; then
91 unet_old_cflags=$CFLAGS
92 CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wall//g'`
94 if test x"$CFLAGS" != x"$unet_old_cflags"; then
95 # If -Wall was already there, force warnings to be enabled
96 unet_cv_enable_warnings=yes
98 dnl Notice the -pedantic flag and deal accordingly
99 if test x"$CFLAGS" != x; then
100 unet_old_cflags=$CFLAGS
101 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pedantic//g'`
103 if test x"$CFLAGS" != x"$unet_old_cflags"; then
104 # If -pedantic was already there, force pedatic to be enabled
105 unet_cv_enable_pedantic=yes
108 dnl Checks for libraries.
110 dnl Locate the library containing crypt
111 AC_SEARCH_LIBS(crypt, descrypt crypt, ,
112 [AC_MSG_ERROR([Unable to find library containing crypt()])])
114 dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
117 dnl Checks for header files.
119 AC_CHECK_HEADERS(crypt.h poll.h inttypes.h stdint.h sys/devpoll.h sys/epoll.h sys/event.h sys/param.h sys/socket.h)
121 dnl Checks for typedefs, structures, and compiler characteristics
128 unet_CHECK_TYPE_SIZES
129 AC_CHECK_TYPE(socklen_t, unsigned int)
130 AC_CHECK_TYPE(struct sockaddr_in6, [unet_have_sockaddr_in6="yes"], [unet_have_sockaddr_in6="no"], [#include <sys/types.h>
131 #include <netinet/in.h>])
133 dnl Checks for library functions.
134 AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
136 dnl Do we have restarting syscalls ?
137 AC_SYS_RESTARTABLE_SYSCALLS
139 dnl Check for required features for admins?
140 AC_MSG_CHECKING([for donuts])
143 dnl Test for programs
148 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
149 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
151 dnl (F)LEX - needed for the new conf file parser
153 dnl The autoconf docs say $LEX defaults to 'lex'. They lie.
154 if test "$LEX" = ":" ; then
155 AC_MSG_ERROR([Cannot find flex.])
156 elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
159 AC_MSG_ERROR([Cannot use $LEX as flex.])
162 if test -z "$LEXLIB" ; then
163 AC_MSG_FAILURE([Cannot find a library with yywrap() in, but flex was found.
164 It's possible the compiler you're using ($CC) is incompatible with the
172 dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
173 dnl but judging from AC_PROG_LEX, it may not stay true.
174 if test "$YACC" = ":" ; then
175 AC_MSG_ERROR([Cannot find yacc.])
176 elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
179 dnl byacc does not seem to have any way to test for workingness, so only warn.
180 AC_MSG_WARN([$YACC may not work as yacc.])
187 dnl Add -pipe when possible
190 dnl Check OS for os_dep files.
191 AC_MSG_CHECKING(for OS-dependent information)
194 AC_MSG_RESULT([Linux ($host) found.])
195 unet_poll_syscall=yes
199 AC_MSG_RESULT([Solaris ($host) found.])
200 if test x"$ac_cv_header_poll_h" = xyes; then
201 unet_poll_syscall=yes
208 AC_MSG_RESULT([Solaris ($host) found.])
213 AC_MSG_RESULT([OpenBSD ($host) found.])
214 if test x"$ac_cv_header_poll_h" = xyes; then
215 unet_poll_syscall=yes
222 AC_MSG_RESULT([Generic BSD ($host) found.])
223 if test x"$ac_cv_header_poll_h" = xyes; then
224 unet_poll_syscall=yes
231 AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
236 AC_MSG_RESULT([Unknown system type $host found.])
237 AC_MSG_WARN([Unknown OS type; using generic routines.])
242 dnl Check user configuration options
243 dnl Start with --enable-poll
244 AC_MSG_CHECKING([whether to enable use of poll()])
245 AC_ARG_ENABLE([poll],
246 [ --enable-poll Force poll to be used regardless of whether or not
247 it is a system call],
248 [unet_cv_enable_poll=$enable_poll],
249 [AC_CACHE_VAL(unet_cv_enable_poll,
250 [unet_cv_enable_poll=$unet_poll_syscall])])
252 # Force poll to be disabled if there is no poll.h
253 if test x"$ac_cv_header_poll_h" != xyes; then
254 unet_cv_enable_poll=no
257 AC_MSG_RESULT([$unet_cv_enable_poll])
259 if test x"$unet_cv_enable_poll" = xyes; then
260 AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
261 ENGINE_C=engine_poll.c
263 ENGINE_C=engine_select.c
267 dnl Now look for --enable-debug
268 AC_MSG_CHECKING([whether to enable debug mode])
269 AC_ARG_ENABLE([debug],
270 [ --enable-debug Turn on debugging mode],
271 [unet_cv_enable_debug=$enable_debug],
272 [AC_CACHE_VAL(unet_cv_enable_debug,
273 [unet_cv_enable_debug=no])])
274 AC_MSG_RESULT([$unet_cv_enable_debug])
276 if test x"$unet_cv_enable_debug" = xyes; then
277 AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
280 dnl Now look for --enable-leak-detect
281 AC_MSG_CHECKING([whether to enable leak detection])
282 AC_ARG_WITH([leak-detect],
283 [ --with-leak-detect Turn on the leak detector(requires patched boehm)],
284 [unet_cv_with_leak_detect=$with_leak_detect],
285 [AC_CACHE_VAL(unet_cv_with_leak_detect,
286 [unet_cv_with_leak_detect=no])])
287 AC_MSG_RESULT([$unet_cv_enable_leak_detect])
289 if test x"$unet_cv_with_leak_detect" != xno; then
291 CFLAGS="-DMDEBUG $CFLAGS"
292 if test x"$unet_cv_with_leak_detect" != xyes; then
293 LIBS="-L$unet_cv_with_leak_detect $LIBS"
298 AS_HELP_STRING([--without-ipv6], [disable IPv6 support (default is autodetect)]),
299 [ac_cv_use_ipv6=$withval],
300 [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
301 AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
302 if test x"$ac_cv_use_ipv6" != "xno" ; then
303 AC_DEFINE([IPV6], 1, [Enable IPv6 support])
306 dnl And now for --disable-asserts
307 AC_MSG_CHECKING([whether to enable asserts])
308 AC_ARG_ENABLE([asserts],
309 [ --disable-asserts Disable assertion checking],
310 [unet_cv_enable_asserts=$enable_asserts],
311 [AC_CACHE_VAL(unet_cv_enable_asserts,
312 [unet_cv_enable_asserts=yes])])
313 AC_MSG_RESULT([$unet_cv_enable_asserts])
315 if test x"$unet_cv_enable_asserts" = xno; then
316 AC_DEFINE([NDEBUG], 1, [Disable assertions])
319 dnl Check for --enable-symbols
320 AC_MSG_CHECKING([whether to enable debugging symbols])
321 AC_ARG_ENABLE([symbols],
322 [ --disable-symbols Disable debugging symbols (remove -g from CFLAGS)],
323 [unet_cv_enable_symbols=$enable_symbols],
324 [AC_CACHE_VAL(unet_cv_enable_symbols,
325 [unet_cv_enable_symbols=yes])])
326 AC_MSG_RESULT([$unet_cv_enable_symbols])
328 if test x"$unet_cv_enable_symbols" = xyes; then
332 dnl Now check for --enable-profile
333 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
334 AC_ARG_ENABLE([profile],
335 [ --enable-profile Enable profiling support (add -pg to CFLAGS)],
336 [unet_cv_enable_profile=$enable_profile],
337 [AC_CACHE_VAL(unet_cv_enable_profile,
338 [unet_cv_enable_profile=no])])
339 AC_MSG_RESULT([$unet_cv_enable_profile])
341 if test x"$unet_cv_enable_profile" = xyes; then
345 dnl Now check for --enable-pedantic
346 AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
347 AC_ARG_ENABLE([pedantic],
348 [ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
349 [unet_cv_enable_pedantic=$enable_pedantic],
350 [AC_CACHE_VAL(unet_cv_enable_pedantic,
351 [unet_cv_enable_pedantic=no])])
352 AC_MSG_RESULT([$unet_cv_enable_pedantic])
354 if test x"$unet_cv_enable_pedantic" = xyes; then
355 CFLAGS="-pedantic $CFLAGS"
358 dnl Now check for --enable-warnings
359 AC_MSG_CHECKING([whether to enable compiler warnings])
360 AC_ARG_ENABLE([warnings],
361 [ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
362 [unet_cv_enable_warnings=$enable_warnings],
363 [AC_CACHE_VAL(unet_cv_enable_warnings,
364 [unet_cv_enable_warnings=no])])
365 AC_MSG_RESULT([$unet_cv_enable_warnings])
367 if test x"$unet_cv_enable_warnings" = xyes; then
368 CFLAGS="-Wall $CFLAGS"
371 dnl --disable-inlines check...
372 AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
373 AC_ARG_ENABLE([inlines],
374 [ --disable-inlines Disable inlining for a few critical functions],
375 [unet_cv_enable_inlines=$enable_inlines],
376 [AC_CACHE_VAL(unet_cv_enable_inlines,
377 [unet_cv_enable_inlines=yes])])
378 AC_MSG_RESULT([$unet_cv_enable_inlines])
380 if test x"$unet_cv_enable_inlines" = xyes; then
381 AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
384 dnl --disable-devpoll check...
385 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
386 AC_ARG_ENABLE([devpoll],
387 [ --disable-devpoll Disable the /dev/poll-based engine],
388 [unet_cv_enable_devpoll=$enable_devpoll],
389 [AC_CACHE_VAL(unet_cv_enable_devpoll,
390 [unet_cv_enable_devpoll=yes])])
392 if test x"$ac_cv_header_sys_devpoll_h" = xno; then
393 unet_cv_enable_devpoll=no
396 AC_MSG_RESULT([$unet_cv_enable_devpoll])
398 if test x"$unet_cv_enable_devpoll" != xno; then
399 AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
400 ENGINE_C="engine_devpoll.c $ENGINE_C"
403 dnl --disable-kqueue check...
404 AC_MSG_CHECKING([whether to enable the kqueue event engine])
405 AC_ARG_ENABLE([kqueue],
406 [ --disable-kqueue Disable the kqueue-based engine],
407 [unet_cv_enable_kqueue=$enable_kqueue],
408 [AC_CACHE_VAL(unet_cv_enable_kqueue,
409 [unet_cv_enable_kqueue=yes])])
411 if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
412 unet_cv_enable_kqueue=no
415 AC_MSG_RESULT([$unet_cv_enable_kqueue])
417 if test x"$unet_cv_enable_kqueue" != xno; then
418 AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
419 ENGINE_C="engine_kqueue.c $ENGINE_C"
422 dnl --disable-epoll check
423 AC_MSG_CHECKING([whether to enable the epoll event engine])
424 AC_ARG_ENABLE([epoll],
425 [ --disable-epoll Disable the epoll-based engine],
426 [unet_cv_enable_epoll=$enable_epoll],
427 [AC_CACHE_VAL(unet_cv_enable_epoll,
428 [unet_cv_enable_epoll=yes])])
430 if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno; then
431 unet_cv_enable_epoll=no
434 AC_MSG_RESULT([$unet_cv_enable_epoll])
436 dnl If we have the header and user has not refused epoll, we still need
437 dnl to check whether the functions are properly defined.
438 if test x"$unet_cv_enable_epoll" != xno; then
439 AC_MSG_CHECKING([whether epoll functions are properly defined])
440 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
441 [AC_MSG_RESULT([yes])],
443 AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
444 AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
445 ENGINE_C="engine_epoll.c $ENGINE_C"
448 dnl How to copy one va_list to another?
449 AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
450 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
451 [unet_cv_c_va_copy="yes"],
452 [unet_cv_c_va_copy="no"]
454 if test "$unet_cv_c_va_copy" = "yes" ; then
455 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
458 AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
459 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
460 [unet_cv_c___va_copy="yes"],
461 [unet_cv_c___va_copy="no"]
463 if test "$unet_cv_c___va_copy" = "yes" ; then
464 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
467 dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
468 AC_MSG_CHECKING([what name to give the symlink])
469 AC_ARG_WITH([symlink],
470 [ --with-symlink=name Name to give the symlink; if name is "no," no
471 symlink will be created.],
472 [unet_cv_with_symlink=$with_symlink],
473 [AC_CACHE_VAL(unet_cv_with_symlink,
474 [unet_cv_with_symlink="ircd"])])
476 if test x"$unet_cv_with_symlink" = xyes; then
477 unet_cv_with_symlink="ircd"
480 AC_MSG_RESULT([$unet_cv_with_symlink])
482 if test x"$unet_cv_with_symlink" = xno; then
483 INSTALL_RULE=install-no-symlink
486 INSTALL_RULE=install-with-symlink
487 SYMLINK=$unet_cv_with_symlink
489 AC_SUBST(INSTALL_RULE)
492 dnl --with-mode lets us set the permissions on the binary
493 AC_MSG_CHECKING([what permissions to set on the installed binary])
495 [ --with-mode=mode Permissions (in octal) to give the binary],
496 [unet_cv_with_mode=$with_mode],
497 [AC_CACHE_VAL(unet_cv_with_mode,
498 [unet_cv_with_mode=711])])
500 if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
501 unet_cv_with_mode=711
504 AC_MSG_RESULT([$unet_cv_with_mode])
506 IRCDMODE=$unet_cv_with_mode
509 dnl --with-owner lets us set the owner of the binary
511 unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
513 AC_MSG_CHECKING([which user should own the installed binary])
515 [ --with-owner=owner Specify owner of the installed binary],
516 [unet_cv_with_owner=$with_owner],
517 [AC_CACHE_VAL(unet_cv_with_owner,
518 [unet_cv_with_owner=$unet_uid])])
520 if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
521 unet_cv_with_owner=$unet_uid
524 AC_MSG_RESULT([$unet_cv_with_owner])
526 IRCDOWN=$unet_cv_with_owner
529 dnl --with-group lets us set the group owner of the binary
531 unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
533 AC_MSG_CHECKING([which group should own the installed binary])
535 [ --with-group=group Specify group owner of the installed binary],
536 [unet_cv_with_group=$with_group],
537 [AC_CACHE_VAL(unet_cv_with_group,
538 [unet_cv_with_group=$unet_gid])])
540 if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
541 unet_cv_with_group=$unet_gid
544 AC_MSG_RESULT([$unet_cv_with_group])
546 IRCDGRP=$unet_cv_with_group
549 dnl --with-domain lets us set the domain name for some statistics-gathering
551 if test -f /etc/resolv.conf; then
552 unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
553 if test x"$unet_domain" = x; then
554 unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
557 AC_MSG_CHECKING([for site domain name])
558 AC_ARG_WITH([domain],
559 [ --with-domain=domain Domain name to use in local statistics gathering],
560 [unet_cv_with_domain=$with_domain],
561 [AC_CACHE_VAL(unet_cv_with_domain,
562 [unet_cv_with_domain=$unet_domain])])
564 if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
565 unet_cv_with_domain=$unet_domain
567 if test x"$unet_cv_with_domain" = xno; then
568 AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
571 AC_MSG_RESULT([$unet_cv_with_domain])
573 AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
574 [Domain name to be used for some statistics gathering])
576 dnl --with-chroot lets us define a directory that we are going to be using
577 dnl as the root of our filesystem
578 AC_MSG_CHECKING([if chroot operation is desired])
579 AC_ARG_WITH([chroot],
580 [ --with-chroot=dir Specify that the server will be operated under
581 a different root directory given by dir. See
582 doc/readme.chroot for more information.],
583 [unet_cv_with_chroot=$with_chroot],
584 [AC_CACHE_VAL(unet_cv_with_chroot,
585 [unet_cv_with_chroot=no])])
587 if test x"$unet_cv_with_chroot" = xyes; then
588 AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
591 # Ensure there are no trailing /'s to mess us up
592 unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
594 AC_MSG_RESULT([$unet_cv_with_chroot])
596 dnl Determine some default directory names
598 dnl HACK WARNING: We are referencing an autoconf internal variable. This is
599 dnl the only way to figure out what value $prefix will have when we go to do
600 dnl the install--and the only way we can stick that value in our definitions
602 # Deal with the annoying value "NONE" here
603 unet_save_prefix=$prefix
604 if test x"$prefix" = xNONE; then
605 prefix=$ac_default_prefix
610 unet_save_exec_prefix=$exec_prefix
611 if test x"$exec_prefix" = xNONE; then
614 exec_prefix=$exec_prefix
617 # Obtain the actual interesting directories
618 unet_bindir=`eval echo "$bindir"`
619 unet_libdir=`eval echo "$libdir"`
621 # Restore the original settings of $prefix and $exec_prefix
622 prefix=$unet_save_prefix
623 exec_prefix=$unet_save_exec_prefix
625 dnl Now compute the name of the binary and verify that it will work under
627 AC_MSG_CHECKING([where the binary will be for /restart])
628 if test x"$unet_cv_with_symlink" = xno; then
629 unet_spath="$unet_bindir/ircd"
631 unet_spath="$unet_bindir/$unet_cv_with_symlink"
633 AC_MSG_RESULT([$unet_spath])
635 if test x"$unet_cv_with_chroot" != xno; then
636 if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
637 unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
639 AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
643 AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
645 dnl --with-dpath sets the all-important DPATH
646 AC_MSG_CHECKING([what the data directory should be])
648 [ --with-dpath=dir Directory for all server data files],
649 [unet_cv_with_dpath=$with_dpath],
650 [AC_CACHE_VAL(unet_cv_with_dpath,
651 [unet_cv_with_dpath=$unet_libdir])])
653 if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
654 unet_cv_with_dpath=$unet_libdir
657 # Ensure there are no trailing /'s to mess us up
658 unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
660 AC_MSG_RESULT([$unet_cv_with_dpath])
662 if test x"$unet_cv_with_chroot" != xno; then
663 if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
664 unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
666 AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
669 unet_dpath=$unet_cv_with_dpath
672 AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
674 DPATH=$unet_cv_with_dpath
677 dnl --with-cpath allows us to specify the configuration file
678 AC_MSG_CHECKING([where the default configuration file resides])
680 [ --with-cpath=file Set server configuration file],
681 [unet_cv_with_cpath=$with_cpath],
682 [AC_CACHE_VAL(unet_cv_with_cpath,
683 [unet_cv_with_cpath="ircd.conf"])])
685 if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
686 unet_cv_with_cpath="ircd.conf"
689 AC_MSG_RESULT([$unet_cv_with_cpath])
691 if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
692 # Absolute path; check against chroot stuff
693 if test x"$unet_cv_with_chroot" != xno; then
694 if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
695 unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
697 AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
700 unet_cpath=$unet_cv_with_cpath
703 unet_cpath=$unet_cv_with_cpath
706 AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
708 dnl --with-lpath allows us to specify the default debugging log file
709 AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
711 [ --with-lpath=file Set the debugging log file],
712 [unet_cv_with_lpath=$with_lpath],
713 [AC_CACHE_VAL(unet_cv_with_lpath,
714 [unet_cv_with_lpath="ircd.log"])])
716 if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
717 unet_cv_with_lpath="ircd.log"
720 AC_MSG_RESULT([$unet_cv_with_lpath])
722 if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
723 # Absolute path; check against chroot stuff
724 if test x"$unet_cv_with_chroot" != xno; then
725 if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
726 unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
728 AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
729 unet_cv_with_lpath="ircd.log"
730 unet_lpath="ircd.log"
733 unet_lpath=$unet_cv_with_lpath
736 unet_lpath=$unet_cv_with_lpath
739 AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
741 dnl --with-maxcon allows us to set the maximum connections
742 unet_maxcon=`ulimit -Hn`
743 if test x"$unet_maxcon" = xunlimited; then
744 unet_maxcon=`ulimit -Sn`
746 unet_maxcon=`expr $unet_maxcon - 4`
747 AC_MSG_CHECKING([max connections])
748 AC_ARG_WITH([maxcon],
749 [ --with-maxcon=maxcon Maximum number of connections server will accept],
750 [unet_cv_with_maxcon=$with_maxcon],
751 [AC_CACHE_VAL(unet_cv_with_maxcon,
752 [unet_cv_with_maxcon=$unet_maxcon])])
754 if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
755 unet_cv_with_maxcon=$unet_maxcon
758 AC_MSG_RESULT([$unet_cv_with_maxcon])
760 AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
761 [Maximum number of network connections])
763 dnl Finally really generate all output files:
764 AC_OUTPUT(Makefile ircd/Makefile ircd/test/Makefile doc/Makefile, [echo timestamp > stamp-h])
766 dnl Report configuration
767 AC_OUTPUT_COMMANDS([echo "
768 ircu is now hopefully configured for your system.
770 Host system: $host_os
772 Asserts: $unet_cv_enable_asserts
773 Warnings: $unet_cv_enable_warnings
774 Debug: $unet_cv_enable_debug
775 Profile: $unet_cv_enable_profile
776 Owner/mode: $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
777 Chroot: $unet_cv_with_chroot
779 Domain: $unet_cv_with_domain
780 DPath: $unet_cv_with_dpath
781 CPath: $unet_cv_with_cpath
782 LPath: $unet_cv_with_lpath
783 Maximum connections: $unet_cv_with_maxcon
785 poll() engine: $unet_cv_enable_poll
786 kqueue() engine: $unet_cv_enable_kqueue
787 /dev/poll engine: $unet_cv_enable_devpoll
788 epoll() engine: $unet_cv_enable_epoll