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 test "$LEX" = ":" ; then
147 AC_MSG_ERROR([Cannot find flex.])
148 elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
151 AC_MSG_ERROR([Cannot use $LEX as flex.])
154 if test -z "$LEXLIB" ; then
155 AC_MSG_FAILURE([Cannot find a library with yywrap() in, but flex was found.
156 It's possible the compiler you're using ($CC) is incompatible with the
164 dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
165 dnl but judging from AC_PROG_LEX, it may not stay true.
166 if test "$YACC" = ":" ; then
167 AC_MSG_ERROR([Cannot find yacc.])
168 elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
171 dnl byacc does not seem to have any way to test for workingness, so only warn.
172 AC_MSG_WARN([$YACC may not work as yacc.])
179 dnl Add -pipe when possible
182 dnl Check OS for os_dep files.
183 AC_MSG_CHECKING(for OS-dependent information)
186 AC_MSG_RESULT([Linux ($host) found.])
187 unet_poll_syscall=yes
191 AC_MSG_RESULT([Solaris ($host) found.])
192 if test x"$ac_cv_header_poll_h" = xyes; then
193 unet_poll_syscall=yes
200 AC_MSG_RESULT([Solaris ($host) found.])
205 AC_MSG_RESULT([OpenBSD ($host) found.])
206 if test x"$ac_cv_header_poll_h" = xyes; then
207 unet_poll_syscall=yes
214 AC_MSG_RESULT([Generic BSD ($host) found.])
215 if test x"$ac_cv_header_poll_h" = xyes; then
216 unet_poll_syscall=yes
223 AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
228 AC_MSG_RESULT([Unknown system type $host found.])
229 AC_MSG_WARN([Unknown OS type; using generic routines.])
234 dnl Check user configuration options
235 dnl Start with --enable-poll
236 AC_MSG_CHECKING([whether to enable use of poll()])
237 AC_ARG_ENABLE([poll],
238 [ --enable-poll Force poll to be used regardless of whether or not
239 it is a system call],
240 [unet_cv_enable_poll=$enable_poll],
241 [AC_CACHE_VAL(unet_cv_enable_poll,
242 [unet_cv_enable_poll=$unet_poll_syscall])])
244 # Force poll to be disabled if there is no poll.h
245 if test x"$ac_cv_header_poll_h" != xyes; then
246 unet_cv_enable_poll=no
249 AC_MSG_RESULT([$unet_cv_enable_poll])
251 if test x"$unet_cv_enable_poll" = xyes; then
252 AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
253 ENGINE_C=engine_poll.c
255 ENGINE_C=engine_select.c
259 dnl Now look for --enable-debug
260 AC_MSG_CHECKING([whether to enable debug mode])
261 AC_ARG_ENABLE([debug],
262 [ --enable-debug Turn on debugging mode],
263 [unet_cv_enable_debug=$enable_debug],
264 [AC_CACHE_VAL(unet_cv_enable_debug,
265 [unet_cv_enable_debug=no])])
266 AC_MSG_RESULT([$unet_cv_enable_debug])
268 if test x"$unet_cv_enable_debug" = xyes; then
269 AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
272 dnl Now look for --enable-leak-detect
273 AC_MSG_CHECKING([whether to enable leak detection])
274 AC_ARG_WITH([leak-detect],
275 [ --with-leak-detect Turn on the leak detector(requires patched boehm)],
276 [unet_cv_with_leak_detect=$with_leak_detect],
277 [AC_CACHE_VAL(unet_cv_with_leak_detect,
278 [unet_cv_with_leak_detect=no])])
279 AC_MSG_RESULT([$unet_cv_enable_leak_detect])
281 if test x"$unet_cv_with_leak_detect" != xno; then
283 CFLAGS="-DMDEBUG $CFLAGS"
284 if test x"$unet_cv_with_leak_detect" != xyes; then
285 LIBS="-L$unet_cv_with_leak_detect $LIBS"
290 AS_HELP_STRING([--without-ipv6], [disable IPv6 support (default is autodetect)]),
291 [ac_cv_use_ipv6=$withval],
292 [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
293 AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
294 if test x"$ac_cv_use_ipv6" != "xno" ; then
295 AC_DEFINE([IPV6], 1, [Enable IPv6 support])
298 dnl And now for --disable-asserts
299 AC_MSG_CHECKING([whether to enable asserts])
300 AC_ARG_ENABLE([asserts],
301 [ --disable-asserts Disable assertion checking],
302 [unet_cv_enable_asserts=$enable_asserts],
303 [AC_CACHE_VAL(unet_cv_enable_asserts,
304 [unet_cv_enable_asserts=yes])])
305 AC_MSG_RESULT([$unet_cv_enable_asserts])
307 if test x"$unet_cv_enable_asserts" = xno; then
308 AC_DEFINE([NDEBUG], 1, [Disable assertions])
311 dnl Check for --enable-symbols
312 AC_MSG_CHECKING([whether to enable debugging symbols])
313 AC_ARG_ENABLE([symbols],
314 [ --disable-symbols Disable debugging symbols (remove -g from CFLAGS)],
315 [unet_cv_enable_symbols=$enable_symbols],
316 [AC_CACHE_VAL(unet_cv_enable_symbols,
317 [unet_cv_enable_symbols=yes])])
318 AC_MSG_RESULT([$unet_cv_enable_symbols])
320 if test x"$unet_cv_enable_symbols" = xyes; then
324 dnl Now check for --enable-profile
325 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
326 AC_ARG_ENABLE([profile],
327 [ --enable-profile Enable profiling support (add -pg to CFLAGS)],
328 [unet_cv_enable_profile=$enable_profile],
329 [AC_CACHE_VAL(unet_cv_enable_profile,
330 [unet_cv_enable_profile=no])])
331 AC_MSG_RESULT([$unet_cv_enable_profile])
333 if test x"$unet_cv_enable_profile" = xyes; then
337 dnl Now check for --enable-pedantic
338 AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
339 AC_ARG_ENABLE([pedantic],
340 [ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
341 [unet_cv_enable_pedantic=$enable_pedantic],
342 [AC_CACHE_VAL(unet_cv_enable_pedantic,
343 [unet_cv_enable_pedantic=no])])
344 AC_MSG_RESULT([$unet_cv_enable_pedantic])
346 if test x"$unet_cv_enable_pedantic" = xyes; then
347 CFLAGS="-pedantic $CFLAGS"
350 dnl Now check for --enable-warnings
351 AC_MSG_CHECKING([whether to enable compiler warnings])
352 AC_ARG_ENABLE([warnings],
353 [ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
354 [unet_cv_enable_warnings=$enable_warnings],
355 [AC_CACHE_VAL(unet_cv_enable_warnings,
356 [unet_cv_enable_warnings=no])])
357 AC_MSG_RESULT([$unet_cv_enable_warnings])
359 if test x"$unet_cv_enable_warnings" = xyes; then
360 CFLAGS="-Wall $CFLAGS"
363 dnl --disable-inlines check...
364 AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
365 AC_ARG_ENABLE([inlines],
366 [ --disable-inlines Disable inlining for a few critical functions],
367 [unet_cv_enable_inlines=$enable_inlines],
368 [AC_CACHE_VAL(unet_cv_enable_inlines,
369 [unet_cv_enable_inlines=yes])])
370 AC_MSG_RESULT([$unet_cv_enable_inlines])
372 if test x"$unet_cv_enable_inlines" = xyes; then
373 AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
376 dnl --disable-devpoll check...
377 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
378 AC_ARG_ENABLE([devpoll],
379 [ --disable-devpoll Disable the /dev/poll-based engine],
380 [unet_cv_enable_devpoll=$enable_devpoll],
381 [AC_CACHE_VAL(unet_cv_enable_devpoll,
382 [unet_cv_enable_devpoll=yes])])
384 if test x"$ac_cv_header_sys_devpoll_h" = xno; then
385 unet_cv_enable_devpoll=no
388 AC_MSG_RESULT([$unet_cv_enable_devpoll])
390 if test x"$unet_cv_enable_devpoll" != xno; then
391 AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
392 ENGINE_C="engine_devpoll.c $ENGINE_C"
395 dnl --disable-kqueue check...
396 AC_MSG_CHECKING([whether to enable the kqueue event engine])
397 AC_ARG_ENABLE([kqueue],
398 [ --disable-kqueue Disable the kqueue-based engine],
399 [unet_cv_enable_kqueue=$enable_kqueue],
400 [AC_CACHE_VAL(unet_cv_enable_kqueue,
401 [unet_cv_enable_kqueue=yes])])
403 if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
404 unet_cv_enable_kqueue=no
407 AC_MSG_RESULT([$unet_cv_enable_kqueue])
409 if test x"$unet_cv_enable_kqueue" != xno; then
410 AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
411 ENGINE_C="engine_kqueue.c $ENGINE_C"
414 dnl --disable-epoll check
415 AC_MSG_CHECKING([whether to enable the epoll event engine])
416 AC_ARG_ENABLE([epoll],
417 [ --disable-epoll Disable the epoll-based engine],
418 [unet_cv_enable_epoll=$enable_epoll],
419 [AC_CACHE_VAL(unet_cv_enable_epoll,
420 [unet_cv_enable_epoll=yes])])
422 if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno; then
423 unet_cv_enable_epoll=no
426 AC_MSG_RESULT([$unet_cv_enable_epoll])
428 dnl If we have the header and user has not refused epoll, we still need
429 dnl to check whether the functions are properly defined.
430 if test x"$unet_cv_enable_epoll" != xno; then
431 AC_MSG_CHECKING([whether epoll functions are properly defined])
432 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
433 [AC_MSG_RESULT([yes])],
435 AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
436 AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
437 ENGINE_C="engine_epoll.c $ENGINE_C"
440 dnl How to copy one va_list to another?
441 AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
442 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
443 [unet_cv_c_va_copy="yes"],
444 [unet_cv_c_va_copy="no"]
446 if test "$unet_cv_c_va_copy" = "yes" ; then
447 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
450 AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
451 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
452 [unet_cv_c___va_copy="yes"],
453 [unet_cv_c___va_copy="no"]
455 if test "$unet_cv_c___va_copy" = "yes" ; then
456 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
459 dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
460 AC_MSG_CHECKING([what name to give the symlink])
461 AC_ARG_WITH([symlink],
462 [ --with-symlink=name Name to give the symlink; if name is "no," no
463 symlink will be created.],
464 [unet_cv_with_symlink=$with_symlink],
465 [AC_CACHE_VAL(unet_cv_with_symlink,
466 [unet_cv_with_symlink="ircd"])])
468 if test x"$unet_cv_with_symlink" = xyes; then
469 unet_cv_with_symlink="ircd"
472 AC_MSG_RESULT([$unet_cv_with_symlink])
474 if test x"$unet_cv_with_symlink" = xno; then
475 INSTALL_RULE=install-no-symlink
478 INSTALL_RULE=install-with-symlink
479 SYMLINK=$unet_cv_with_symlink
481 AC_SUBST(INSTALL_RULE)
484 dnl --with-mode lets us set the permissions on the binary
485 AC_MSG_CHECKING([what permissions to set on the installed binary])
487 [ --with-mode=mode Permissions (in octal) to give the binary],
488 [unet_cv_with_mode=$with_mode],
489 [AC_CACHE_VAL(unet_cv_with_mode,
490 [unet_cv_with_mode=711])])
492 if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
493 unet_cv_with_mode=711
496 AC_MSG_RESULT([$unet_cv_with_mode])
498 IRCDMODE=$unet_cv_with_mode
501 dnl --with-owner lets us set the owner of the binary
503 unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
505 AC_MSG_CHECKING([which user should own the installed binary])
507 [ --with-owner=owner Specify owner of the installed binary],
508 [unet_cv_with_owner=$with_owner],
509 [AC_CACHE_VAL(unet_cv_with_owner,
510 [unet_cv_with_owner=$unet_uid])])
512 if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
513 unet_cv_with_owner=$unet_uid
516 AC_MSG_RESULT([$unet_cv_with_owner])
518 IRCDOWN=$unet_cv_with_owner
521 dnl --with-group lets us set the group owner of the binary
523 unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
525 AC_MSG_CHECKING([which group should own the installed binary])
527 [ --with-group=group Specify group owner of the installed binary],
528 [unet_cv_with_group=$with_group],
529 [AC_CACHE_VAL(unet_cv_with_group,
530 [unet_cv_with_group=$unet_gid])])
532 if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
533 unet_cv_with_group=$unet_gid
536 AC_MSG_RESULT([$unet_cv_with_group])
538 IRCDGRP=$unet_cv_with_group
541 dnl --with-domain lets us set the domain name for some statistics-gathering
543 if test -f /etc/resolv.conf; then
544 unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
545 if test x"$unet_domain" = x; then
546 unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
549 AC_MSG_CHECKING([for site domain name])
550 AC_ARG_WITH([domain],
551 [ --with-domain=domain Domain name to use in local statistics gathering],
552 [unet_cv_with_domain=$with_domain],
553 [AC_CACHE_VAL(unet_cv_with_domain,
554 [unet_cv_with_domain=$unet_domain])])
556 if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
557 unet_cv_with_domain=$unet_domain
559 if test x"$unet_cv_with_domain" = xno; then
560 AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
563 AC_MSG_RESULT([$unet_cv_with_domain])
565 AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
566 [Domain name to be used for some statistics gathering])
568 dnl --with-chroot lets us define a directory that we are going to be using
569 dnl as the root of our filesystem
570 AC_MSG_CHECKING([if chroot operation is desired])
571 AC_ARG_WITH([chroot],
572 [ --with-chroot=dir Specify that the server will be operated under
573 a different root directory given by dir. See
574 doc/readme.chroot for more information.],
575 [unet_cv_with_chroot=$with_chroot],
576 [AC_CACHE_VAL(unet_cv_with_chroot,
577 [unet_cv_with_chroot=no])])
579 if test x"$unet_cv_with_chroot" = xyes; then
580 AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
583 # Ensure there are no trailing /'s to mess us up
584 unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
586 AC_MSG_RESULT([$unet_cv_with_chroot])
588 dnl Determine some default directory names
590 dnl HACK WARNING: We are referencing an autoconf internal variable. This is
591 dnl the only way to figure out what value $prefix will have when we go to do
592 dnl the install--and the only way we can stick that value in our definitions
594 # Deal with the annoying value "NONE" here
595 unet_save_prefix=$prefix
596 if test x"$prefix" = xNONE; then
597 prefix=$ac_default_prefix
602 unet_save_exec_prefix=$exec_prefix
603 if test x"$exec_prefix" = xNONE; then
606 exec_prefix=$exec_prefix
609 # Obtain the actual interesting directories
610 unet_bindir=`eval echo "$bindir"`
611 unet_libdir=`eval echo "$libdir"`
613 # Restore the original settings of $prefix and $exec_prefix
614 prefix=$unet_save_prefix
615 exec_prefix=$unet_save_exec_prefix
617 dnl Now compute the name of the binary and verify that it will work under
619 AC_MSG_CHECKING([where the binary will be for /restart])
620 if test x"$unet_cv_with_symlink" = xno; then
621 unet_spath="$unet_bindir/ircd"
623 unet_spath="$unet_bindir/$unet_cv_with_symlink"
625 AC_MSG_RESULT([$unet_spath])
627 if test x"$unet_cv_with_chroot" != xno; then
628 if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
629 unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
631 AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
635 AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
637 dnl --with-dpath sets the all-important DPATH
638 AC_MSG_CHECKING([what the data directory should be])
640 [ --with-dpath=dir Directory for all server data files],
641 [unet_cv_with_dpath=$with_dpath],
642 [AC_CACHE_VAL(unet_cv_with_dpath,
643 [unet_cv_with_dpath=$unet_libdir])])
645 if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
646 unet_cv_with_dpath=$unet_libdir
649 # Ensure there are no trailing /'s to mess us up
650 unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
652 AC_MSG_RESULT([$unet_cv_with_dpath])
654 if test x"$unet_cv_with_chroot" != xno; then
655 if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
656 unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
658 AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
661 unet_dpath=$unet_cv_with_dpath
664 AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
666 DPATH=$unet_cv_with_dpath
669 dnl --with-cpath allows us to specify the configuration file
670 AC_MSG_CHECKING([where the default configuration file resides])
672 [ --with-cpath=file Set server configuration file],
673 [unet_cv_with_cpath=$with_cpath],
674 [AC_CACHE_VAL(unet_cv_with_cpath,
675 [unet_cv_with_cpath="ircd.conf"])])
677 if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
678 unet_cv_with_cpath="ircd.conf"
681 AC_MSG_RESULT([$unet_cv_with_cpath])
683 if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
684 # Absolute path; check against chroot stuff
685 if test x"$unet_cv_with_chroot" != xno; then
686 if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
687 unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
689 AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
692 unet_cpath=$unet_cv_with_cpath
695 unet_cpath=$unet_cv_with_cpath
698 AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
700 dnl --with-lpath allows us to specify the default debugging log file
701 AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
703 [ --with-lpath=file Set the debugging log file],
704 [unet_cv_with_lpath=$with_lpath],
705 [AC_CACHE_VAL(unet_cv_with_lpath,
706 [unet_cv_with_lpath="ircd.log"])])
708 if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
709 unet_cv_with_lpath="ircd.log"
712 AC_MSG_RESULT([$unet_cv_with_lpath])
714 if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
715 # Absolute path; check against chroot stuff
716 if test x"$unet_cv_with_chroot" != xno; then
717 if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
718 unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
720 AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
721 unet_cv_with_lpath="ircd.log"
722 unet_lpath="ircd.log"
725 unet_lpath=$unet_cv_with_lpath
728 unet_lpath=$unet_cv_with_lpath
731 AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
733 dnl --with-maxcon allows us to set the maximum connections
734 unet_maxcon=`ulimit -Hn`
735 if test x"$unet_maxcon" = xunlimited; then
736 unet_maxcon=`ulimit -Sn`
738 unet_maxcon=`expr $unet_maxcon - 4`
739 AC_MSG_CHECKING([max connections])
740 AC_ARG_WITH([maxcon],
741 [ --with-maxcon=maxcon Maximum number of connections server will accept],
742 [unet_cv_with_maxcon=$with_maxcon],
743 [AC_CACHE_VAL(unet_cv_with_maxcon,
744 [unet_cv_with_maxcon=$unet_maxcon])])
746 if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
747 unet_cv_with_maxcon=$unet_maxcon
750 AC_MSG_RESULT([$unet_cv_with_maxcon])
752 AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
753 [Maximum number of network connections])
755 dnl Finally really generate all output files:
756 AC_OUTPUT(Makefile ircd/Makefile ircd/test/Makefile doc/Makefile, [echo timestamp > stamp-h])
758 dnl Report configuration
759 AC_OUTPUT_COMMANDS([echo "
760 ircu is now hopefully configured for your system.
762 Host system: $host_os
764 Asserts: $unet_cv_enable_asserts
765 Warnings: $unet_cv_enable_warnings
766 Debug: $unet_cv_enable_debug
767 Profile: $unet_cv_enable_profile
768 Owner/mode: $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
769 Chroot: $unet_cv_with_chroot
771 Domain: $unet_cv_with_domain
772 DPath: $unet_cv_with_dpath
773 CPath: $unet_cv_with_cpath
774 LPath: $unet_cv_with_lpath
775 Maximum connections: $unet_cv_with_maxcon
777 poll() engine: $unet_cv_enable_poll
778 kqueue() engine: $unet_cv_enable_kqueue
779 /dev/poll engine: $unet_cv_enable_devpoll
780 epoll() engine: $unet_cv_enable_epoll