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 Use -O3 instead of -O2.
56 if test x"$CFLAGS" != x; then
57 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
59 dnl Remove -pipe during configure
60 if test x"$CFLAGS" != x; then
61 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
63 dnl Notice the -g flag and deal accordingly
64 if test x"$CFLAGS" != x; then
65 unet_old_cflags=$CFLAGS
66 CFLAGS=`echo "$CFLAGS" | sed -e 's/-g//g'`
68 if test x"$CFLAGS" != x"$unet_old_cflags"; then
69 # If -g was already there, force symbols to be enabled
70 unet_cv_enable_symbols=yes
72 dnl Notice the -pg flag and deal accordingly
73 if test x"$CFLAGS" != x; then
74 unet_old_cflags=$CFLAGS
75 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pg//g'`
77 if test x"$CFLAGS" != x"$unet_old_cflags"; then
78 # If -pg was already there, force profiling to be enabled
79 unet_cv_enable_profile=yes
81 dnl Notice the -Wall flag and deal accordingly
82 if test x"$CFLAGS" != x; then
83 unet_old_cflags=$CFLAGS
84 CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wall//g'`
86 if test x"$CFLAGS" != x"$unet_old_cflags"; then
87 # If -Wall was already there, force warnings to be enabled
88 unet_cv_enable_warnings=yes
90 dnl Notice the -pedantic flag and deal accordingly
91 if test x"$CFLAGS" != x; then
92 unet_old_cflags=$CFLAGS
93 CFLAGS=`echo "$CFLAGS" | sed -e 's/-pedantic//g'`
95 if test x"$CFLAGS" != x"$unet_old_cflags"; then
96 # If -pedantic was already there, force pedatic to be enabled
97 unet_cv_enable_pedantic=yes
100 dnl Checks for libraries.
102 dnl Locate the library containing crypt
103 AC_SEARCH_LIBS(crypt, descrypt crypt, ,
104 [AC_MSG_ERROR([Unable to find library containing crypt()])])
106 dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
109 dnl Checks for header files.
111 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)
113 dnl Checks for typedefs, structures, and compiler characteristics
120 unet_CHECK_TYPE_SIZES
121 AC_CHECK_TYPE(socklen_t, unsigned int)
122 AC_CHECK_TYPE(struct sockaddr_in6, [unet_have_sockaddr_in6="yes"], [unet_have_sockaddr_in6="no"], [#include <sys/types.h>
123 #include <netinet/in.h>])
125 dnl Checks for library functions.
126 AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
128 dnl Do we have restarting syscalls ?
129 AC_SYS_RESTARTABLE_SYSCALLS
131 dnl Check for required features for admins?
132 AC_MSG_CHECKING([for donuts])
135 dnl Test for programs
140 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
141 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
143 dnl (F)LEX - needed for the new conf file parser
145 dnl The autoconf docs say $LEX defaults to 'lex'. They lie.
146 if [ "$LEX" eq ":" ] ; then
147 AC_MSG_ERROR([Cannot find flex.])
148 elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
149 AC_MSG_ERROR([Cannot find flex.])
152 if test -z "$LEXLIB" ; then
153 AC_MSG_FAILURE([Cannot find a library with yywrap() in, but flex was found.
154 It's possible the compiler you're using ($CC) is incompatible with the
162 dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
163 dnl but judging from AC_PROG_LEX, it may not stay true.
164 if [ "$YACC" eq ":" ] ; then
165 AC_MSG_ERROR([Cannot find yacc.])
166 elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
167 AC_MSG_ERROR([Cannot find yacc.])
174 dnl Add -pipe when possible
177 dnl Check OS for os_dep files.
178 AC_MSG_CHECKING(for OS-dependent information)
181 AC_MSG_RESULT([Linux ($host) found.])
182 unet_poll_syscall=yes
186 AC_MSG_RESULT([Solaris ($host) found.])
187 if test x"$ac_cv_header_poll_h" = xyes; then
188 unet_poll_syscall=yes
195 AC_MSG_RESULT([Solaris ($host) found.])
200 AC_MSG_RESULT([OpenBSD ($host) found.])
201 if test x"$ac_cv_header_poll_h" = xyes; then
202 unet_poll_syscall=yes
209 AC_MSG_RESULT([Generic BSD ($host) found.])
210 if test x"$ac_cv_header_poll_h" = xyes; then
211 unet_poll_syscall=yes
218 AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
223 AC_MSG_RESULT([Unknown system type $host found.])
224 AC_MSG_WARN([Unknown OS type; using generic routines.])
229 dnl Check user configuration options
230 dnl Start with --enable-poll
231 AC_MSG_CHECKING([whether to enable use of poll()])
232 AC_ARG_ENABLE([poll],
233 [ --enable-poll Force poll to be used regardless of whether or not
234 it is a system call],
235 [unet_cv_enable_poll=$enable_poll],
236 [AC_CACHE_VAL(unet_cv_enable_poll,
237 [unet_cv_enable_poll=$unet_poll_syscall])])
239 # Force poll to be disabled if there is no poll.h
240 if test x"$ac_cv_header_poll_h" != xyes; then
241 unet_cv_enable_poll=no
244 AC_MSG_RESULT([$unet_cv_enable_poll])
246 if test x"$unet_cv_enable_poll" = xyes; then
247 AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()])
248 ENGINE_C=engine_poll.c
250 ENGINE_C=engine_select.c
254 dnl Now look for --enable-debug
255 AC_MSG_CHECKING([whether to enable debug mode])
256 AC_ARG_ENABLE([debug],
257 [ --enable-debug Turn on debugging mode],
258 [unet_cv_enable_debug=$enable_debug],
259 [AC_CACHE_VAL(unet_cv_enable_debug,
260 [unet_cv_enable_debug=no])])
261 AC_MSG_RESULT([$unet_cv_enable_debug])
263 if test x"$unet_cv_enable_debug" = xyes; then
264 AC_DEFINE([DEBUGMODE], , [Enable debugging code])
267 dnl Now look for --enable-leak-detect
268 AC_MSG_CHECKING([whether to enable leak detection])
269 AC_ARG_WITH([leak-detect],
270 [ --with-leak-detect Turn on the leak detector(requires patched boehm)],
271 [unet_cv_with_leak_detect=$with_leak_detect],
272 [AC_CACHE_VAL(unet_cv_with_leak_detect,
273 [unet_cv_with_leak_detect=no])])
274 AC_MSG_RESULT([$unet_cv_enable_leak_detect])
276 if test x"$unet_cv_with_leak_detect" != xno; then
278 CFLAGS="-DMDEBUG $CFLAGS"
279 if test x"$unet_cv_with_leak_detect" != xyes; then
280 LIBS="-L$unet_cv_with_leak_detect $LIBS"
285 AS_HELP_STRING([--without-ipv6], [disable IPv6 support (default is autodetect)]),
286 [ac_cv_use_ipv6=$withval],
287 [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
288 AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
289 if test x"$ac_cv_use_ipv6" != "xno" ; then
290 AC_DEFINE([IPV6], , [Enable IPv6 support])
293 dnl And now for --disable-asserts
294 AC_MSG_CHECKING([whether to enable asserts])
295 AC_ARG_ENABLE([asserts],
296 [ --disable-asserts Disable assertion checking],
297 [unet_cv_enable_asserts=$enable_asserts],
298 [AC_CACHE_VAL(unet_cv_enable_asserts,
299 [unet_cv_enable_asserts=yes])])
300 AC_MSG_RESULT([$unet_cv_enable_asserts])
302 if test x"$unet_cv_enable_asserts" = xno; then
303 AC_DEFINE([NDEBUG], , [Disable assertions])
306 dnl Check for --enable-symbols
307 AC_MSG_CHECKING([whether to enable debugging symbols])
308 AC_ARG_ENABLE([symbols],
309 [ --disable-symbols Disable debugging symbols (remove -g from CFLAGS)],
310 [unet_cv_enable_symbols=$enable_symbols],
311 [AC_CACHE_VAL(unet_cv_enable_symbols,
312 [unet_cv_enable_symbols=yes])])
313 AC_MSG_RESULT([$unet_cv_enable_symbols])
315 if test x"$unet_cv_enable_symbols" = xyes; then
319 dnl Now check for --enable-profile
320 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
321 AC_ARG_ENABLE([profile],
322 [ --enable-profile Enable profiling support (add -pg to CFLAGS)],
323 [unet_cv_enable_profile=$enable_profile],
324 [AC_CACHE_VAL(unet_cv_enable_profile,
325 [unet_cv_enable_profile=no])])
326 AC_MSG_RESULT([$unet_cv_enable_profile])
328 if test x"$unet_cv_enable_profile" = xyes; then
332 dnl Now check for --enable-pedantic
333 AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
334 AC_ARG_ENABLE([pedantic],
335 [ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
336 [unet_cv_enable_pedantic=$enable_pedantic],
337 [AC_CACHE_VAL(unet_cv_enable_pedantic,
338 [unet_cv_enable_pedantic=no])])
339 AC_MSG_RESULT([$unet_cv_enable_pedantic])
341 if test x"$unet_cv_enable_pedantic" = xyes; then
342 CFLAGS="-pedantic $CFLAGS"
345 dnl Now check for --enable-warnings
346 AC_MSG_CHECKING([whether to enable compiler warnings])
347 AC_ARG_ENABLE([warnings],
348 [ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
349 [unet_cv_enable_warnings=$enable_warnings],
350 [AC_CACHE_VAL(unet_cv_enable_warnings,
351 [unet_cv_enable_warnings=no])])
352 AC_MSG_RESULT([$unet_cv_enable_warnings])
354 if test x"$unet_cv_enable_warnings" = xyes; then
355 CFLAGS="-Wall $CFLAGS"
358 dnl --disable-inlines check...
359 AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
360 AC_ARG_ENABLE([inlines],
361 [ --disable-inlines Disable inlining for a few critical functions],
362 [unet_cv_enable_inlines=$enable_inlines],
363 [AC_CACHE_VAL(unet_cv_enable_inlines,
364 [unet_cv_enable_inlines=yes])])
365 AC_MSG_RESULT([$unet_cv_enable_inlines])
367 if test x"$unet_cv_enable_inlines" = xyes; then
368 AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
371 dnl --disable-devpoll check...
372 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
373 AC_ARG_ENABLE([devpoll],
374 [ --disable-devpoll Disable the /dev/poll-based engine],
375 [unet_cv_enable_devpoll=$enable_devpoll],
376 [AC_CACHE_VAL(unet_cv_enable_devpoll,
377 [unet_cv_enable_devpoll=yes])])
379 if test x"$ac_cv_header_sys_devpoll_h" = xno; then
380 unet_cv_enable_devpoll=no
383 AC_MSG_RESULT([$unet_cv_enable_devpoll])
385 if test x"$unet_cv_enable_devpoll" != xno; then
386 AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine])
387 ENGINE_C="engine_devpoll.c $ENGINE_C"
390 dnl --disable-kqueue check...
391 AC_MSG_CHECKING([whether to enable the kqueue event engine])
392 AC_ARG_ENABLE([kqueue],
393 [ --disable-kqueue Disable the kqueue-based engine],
394 [unet_cv_enable_kqueue=$enable_kqueue],
395 [AC_CACHE_VAL(unet_cv_enable_kqueue,
396 [unet_cv_enable_kqueue=yes])])
398 if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
399 unet_cv_enable_kqueue=no
402 AC_MSG_RESULT([$unet_cv_enable_kqueue])
404 if test x"$unet_cv_enable_kqueue" != xno; then
405 AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine])
406 ENGINE_C="engine_kqueue.c $ENGINE_C"
409 dnl --disable-epoll check
410 AC_MSG_CHECKING([whether to enable the epoll event engine])
411 AC_ARG_ENABLE([epoll],
412 [ --disable-epoll Disable the epoll-based engine],
413 [unet_cv_enable_epoll=$enable_epoll],
414 [AC_CACHE_VAL(unet_cv_enable_epoll,
415 [unet_cv_enable_epoll=yes])])
417 if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno; then
418 unet_cv_enable_epoll=no
421 AC_MSG_RESULT([$unet_cv_enable_epoll])
423 dnl If we have the header and user has not refused epoll, we still need
424 dnl to check whether the functions are properly defined.
425 if test x"$unet_cv_enable_epoll" != xno; then
426 AC_MSG_CHECKING([whether epoll functions are properly defined])
427 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
428 [AC_MSG_RESULT([yes])],
430 AC_DEFINE([EPOLL_NEED_BODY],,[Define to implement epoll system calls])])
431 AC_DEFINE([USE_EPOLL], , [Define to enable the epoll engine])
432 ENGINE_C="engine_epoll.c $ENGINE_C"
435 dnl How to copy one va_list to another?
436 AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
437 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
438 [unet_cv_c_va_copy="yes"],
439 [unet_cv_c_va_copy="no"]
441 if test "$unet_cv_c_va_copy" = "yes" ; then
442 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
445 AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
446 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
447 [unet_cv_c___va_copy="yes"],
448 [unet_cv_c___va_copy="no"]
450 if test "$unet_cv_c___va_copy" = "yes" ; then
451 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
454 dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
455 AC_MSG_CHECKING([what name to give the symlink])
456 AC_ARG_WITH([symlink],
457 [ --with-symlink=name Name to give the symlink; if name is "no," no
458 symlink will be created.],
459 [unet_cv_with_symlink=$with_symlink],
460 [AC_CACHE_VAL(unet_cv_with_symlink,
461 [unet_cv_with_symlink="ircd"])])
463 if test x"$unet_cv_with_symlink" = xyes; then
464 unet_cv_with_symlink="ircd"
467 AC_MSG_RESULT([$unet_cv_with_symlink])
469 if test x"$unet_cv_with_symlink" = xno; then
470 INSTALL_RULE=install-no-symlink
473 INSTALL_RULE=install-with-symlink
474 SYMLINK=$unet_cv_with_symlink
476 AC_SUBST(INSTALL_RULE)
479 dnl --with-mode lets us set the permissions on the binary
480 AC_MSG_CHECKING([what permissions to set on the installed binary])
482 [ --with-mode=mode Permissions (in octal) to give the binary],
483 [unet_cv_with_mode=$with_mode],
484 [AC_CACHE_VAL(unet_cv_with_mode,
485 [unet_cv_with_mode=711])])
487 if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
488 unet_cv_with_mode=711
491 AC_MSG_RESULT([$unet_cv_with_mode])
493 IRCDMODE=$unet_cv_with_mode
496 dnl --with-owner lets us set the owner of the binary
498 unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
500 AC_MSG_CHECKING([which user should own the installed binary])
502 [ --with-owner=owner Specify owner of the installed binary],
503 [unet_cv_with_owner=$with_owner],
504 [AC_CACHE_VAL(unet_cv_with_owner,
505 [unet_cv_with_owner=$unet_uid])])
507 if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
508 unet_cv_with_owner=$unet_uid
511 AC_MSG_RESULT([$unet_cv_with_owner])
513 IRCDOWN=$unet_cv_with_owner
516 dnl --with-group lets us set the group owner of the binary
518 unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
520 AC_MSG_CHECKING([which group should own the installed binary])
522 [ --with-group=group Specify group owner of the installed binary],
523 [unet_cv_with_group=$with_group],
524 [AC_CACHE_VAL(unet_cv_with_group,
525 [unet_cv_with_group=$unet_gid])])
527 if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
528 unet_cv_with_group=$unet_gid
531 AC_MSG_RESULT([$unet_cv_with_group])
533 IRCDGRP=$unet_cv_with_group
536 dnl --with-domain lets us set the domain name for some statistics-gathering
538 if test -f /etc/resolv.conf; then
539 unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
540 if test x"$unet_domain" = x; then
541 unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
544 AC_MSG_CHECKING([for site domain name])
545 AC_ARG_WITH([domain],
546 [ --with-domain=domain Domain name to use in local statistics gathering],
547 [unet_cv_with_domain=$with_domain],
548 [AC_CACHE_VAL(unet_cv_with_domain,
549 [unet_cv_with_domain=$unet_domain])])
551 if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
552 unet_cv_with_domain=$unet_domain
554 if test x"$unet_cv_with_domain" = xno; then
555 AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
558 AC_MSG_RESULT([$unet_cv_with_domain])
560 AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
561 [Domain name to be used for some statistics gathering])
563 dnl --with-chroot lets us define a directory that we are going to be using
564 dnl as the root of our filesystem
565 AC_MSG_CHECKING([if chroot operation is desired])
566 AC_ARG_WITH([chroot],
567 [ --with-chroot=dir Specify that the server will be operated under
568 a different root directory given by dir. See
569 doc/readme.chroot for more information.],
570 [unet_cv_with_chroot=$with_chroot],
571 [AC_CACHE_VAL(unet_cv_with_chroot,
572 [unet_cv_with_chroot=no])])
574 if test x"$unet_cv_with_chroot" = xyes; then
575 AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
578 # Ensure there are no trailing /'s to mess us up
579 unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
581 AC_MSG_RESULT([$unet_cv_with_chroot])
583 dnl Determine some default directory names
585 dnl HACK WARNING: We are referencing an autoconf internal variable. This is
586 dnl the only way to figure out what value $prefix will have when we go to do
587 dnl the install--and the only way we can stick that value in our definitions
589 # Deal with the annoying value "NONE" here
590 unet_save_prefix=$prefix
591 if test x"$prefix" = xNONE; then
592 prefix=$ac_default_prefix
597 unet_save_exec_prefix=$exec_prefix
598 if test x"$exec_prefix" = xNONE; then
601 exec_prefix=$exec_prefix
604 # Obtain the actual interesting directories
605 unet_bindir=`eval echo "$bindir"`
606 unet_libdir=`eval echo "$libdir"`
608 # Restore the original settings of $prefix and $exec_prefix
609 prefix=$unet_save_prefix
610 exec_prefix=$unet_save_exec_prefix
612 dnl Now compute the name of the binary and verify that it will work under
614 AC_MSG_CHECKING([where the binary will be for /restart])
615 if test x"$unet_cv_with_symlink" = xno; then
616 unet_spath="$unet_bindir/ircd"
618 unet_spath="$unet_bindir/$unet_cv_with_symlink"
620 AC_MSG_RESULT([$unet_spath])
622 if test x"$unet_cv_with_chroot" != xno; then
623 if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
624 unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
626 AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
630 AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
632 dnl --with-dpath sets the all-important DPATH
633 AC_MSG_CHECKING([what the data directory should be])
635 [ --with-dpath=dir Directory for all server data files],
636 [unet_cv_with_dpath=$with_dpath],
637 [AC_CACHE_VAL(unet_cv_with_dpath,
638 [unet_cv_with_dpath=$unet_libdir])])
640 if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
641 unet_cv_with_dpath=$unet_libdir
644 # Ensure there are no trailing /'s to mess us up
645 unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
647 AC_MSG_RESULT([$unet_cv_with_dpath])
649 if test x"$unet_cv_with_chroot" != xno; then
650 if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
651 unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
653 AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
656 unet_dpath=$unet_cv_with_dpath
659 AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
661 DPATH=$unet_cv_with_dpath
664 dnl --with-cpath allows us to specify the configuration file
665 AC_MSG_CHECKING([where the default configuration file resides])
667 [ --with-cpath=file Set server configuration file],
668 [unet_cv_with_cpath=$with_cpath],
669 [AC_CACHE_VAL(unet_cv_with_cpath,
670 [unet_cv_with_cpath="ircd.conf"])])
672 if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
673 unet_cv_with_cpath="ircd.conf"
676 AC_MSG_RESULT([$unet_cv_with_cpath])
678 if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
679 # Absolute path; check against chroot stuff
680 if test x"$unet_cv_with_chroot" != xno; then
681 if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
682 unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
684 AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
687 unet_cpath=$unet_cv_with_cpath
690 unet_cpath=$unet_cv_with_cpath
693 AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
695 dnl --with-lpath allows us to specify the default debugging log file
696 AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
698 [ --with-lpath=file Set the debugging log file],
699 [unet_cv_with_lpath=$with_lpath],
700 [AC_CACHE_VAL(unet_cv_with_lpath,
701 [unet_cv_with_lpath="ircd.log"])])
703 if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
704 unet_cv_with_lpath="ircd.log"
707 AC_MSG_RESULT([$unet_cv_with_lpath])
709 if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
710 # Absolute path; check against chroot stuff
711 if test x"$unet_cv_with_chroot" != xno; then
712 if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
713 unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
715 AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
716 unet_cv_with_lpath="ircd.log"
717 unet_lpath="ircd.log"
720 unet_lpath=$unet_cv_with_lpath
723 unet_lpath=$unet_cv_with_lpath
726 AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
728 dnl --with-maxcon allows us to set the maximum connections
729 unet_maxcon=`ulimit -Hn`
730 if test x"$unet_maxcon" = xunlimited; then
731 unet_maxcon=`ulimit -Sn`
733 unet_maxcon=`expr $unet_maxcon - 4`
734 AC_MSG_CHECKING([max connections])
735 AC_ARG_WITH([maxcon],
736 [ --with-maxcon=maxcon Maximum number of connections server will accept],
737 [unet_cv_with_maxcon=$with_maxcon],
738 [AC_CACHE_VAL(unet_cv_with_maxcon,
739 [unet_cv_with_maxcon=$unet_maxcon])])
741 if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
742 unet_cv_with_maxcon=$unet_maxcon
745 AC_MSG_RESULT([$unet_cv_with_maxcon])
747 AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
748 [Maximum number of network connections])
750 dnl Finally really generate all output files:
751 AC_OUTPUT(Makefile ircd/Makefile ircd/test/Makefile doc/Makefile, [echo timestamp > stamp-h])
753 dnl Report configuration
754 AC_OUTPUT_COMMANDS([echo "
755 ircu is now hopefully configured for your system.
757 Host system: $host_os
759 Asserts: $unet_cv_enable_asserts
760 Warnings: $unet_cv_enable_warnings
761 Debug: $unet_cv_enable_debug
762 Profile: $unet_cv_enable_profile
763 Owner/mode: $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
764 Chroot: $unet_cv_with_chroot
766 Domain: $unet_cv_with_domain
767 DPath: $unet_cv_with_dpath
768 CPath: $unet_cv_with_cpath
769 LPath: $unet_cv_with_lpath
770 Maximum connections: $unet_cv_with_maxcon
772 poll() engine: $unet_cv_enable_poll
773 kqueue() engine: $unet_cv_enable_kqueue
774 /dev/poll engine: $unet_cv_enable_devpoll
775 epoll() engine: $unet_cv_enable_epoll