]> jfr.im git - irc/quakenet/snircd.git/blame - configure.in
seems snircd also needs gline_resend updated - it was using ircu .12 gline format...
[irc/quakenet/snircd.git] / configure.in
CommitLineData
189935b1 1dnl Prefered emacs editing mode: -*- shell-script -*-
2dnl
3dnl Process this file with autoconf to produce a configure script.
4dnl
5dnl Copyright (c) 1997, by Carlo Wood <carlo@runaway.xs4all.nl>
6dnl Copyright (C) 2001 Kevin L. Mitchell <klmitch@mit.edu>
7dnl
8dnl This program is free software; you can redistribute it and/or modify
9dnl it under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 1, or (at your option)
11dnl any later version.
12dnl
13dnl This program is distributed in the hope that it will be useful,
14dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16dnl GNU General Public License for more details.
17dnl
18dnl You should have received a copy of the GNU General Public License
19dnl along with this program; if not, write to the Free Software
20dnl Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21dnl
22dnl $Id: configure.in,v 1.34 2005/07/17 00:18:58 entrope Exp $
23
24dnl Make sure we are in the correct directory (someone could have run
25dnl 'configure' with a wrong '--srcdir').
26AC_INIT(ircd/ircd.c)
27
28dnl Set the default prefix
29AC_PREFIX_DEFAULT([$HOME])
30AC_MSG_CHECKING([for installation prefix])
31AC_CACHE_VAL(unet_cv_prefix, [unet_cv_prefix=$HOME])
32if test x"$prefix" != xNONE; then
33 unet_cv_prefix=$prefix
34fi
35AC_MSG_RESULT([$unet_cv_prefix])
36dnl HACK WARNING: We are referencing an autoconf internal variable. This is
37dnl the only way to force the prefix to be retrieved from the config.cache
38dnl file!
39ac_default_prefix=$unet_cv_prefix
40
41dnl Define the input and output configuration header file.
42AC_CONFIG_HEADER([config.h])
43
44dnl Demand at least version 2.59 of autoconf (for AS_HELP_STRING)
45AC_PREREQ(2.59)
46
47dnl Find out what type of system we are
48AC_CANONICAL_HOST
49
50dnl This should be done early.
51AC_PROG_CC
52
53dnl ANSIfy the C compiler whenever possible.
54AM_PROG_CC_STDC
55
56dnl Checks for libraries.
57
58dnl Locate the library containing crypt
59AC_SEARCH_LIBS(crypt, descrypt crypt, ,
60[AC_MSG_ERROR([Unable to find library containing crypt()])])
61
62dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
63AC_LIBRARY_NET
64
65dnl Checks for header files.
66AC_HEADER_STDC
67AC_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)
68
69dnl Checks for typedefs, structures, and compiler characteristics
70dnl AC_C_CONST
71AC_C_BIGENDIAN
72AC_TYPE_SIZE_T
73AC_HEADER_TIME
74AC_STRUCT_TM
75AC_TYPE_UID_T
76unet_CHECK_TYPE_SIZES
77AC_CHECK_TYPE(struct sockaddr_in6, [unet_have_sockaddr_in6="yes"], [unet_have_sockaddr_in6="no"], [#include <sys/types.h>
78#include <netinet/in.h>])
79
80dnl Check for socklen_t. In traditional BSD this is an int, but some
81dnl OSes use a different type. Test until we find something that will
82dnl work properly. Test borrowed from a patch submitted for Python.
83AC_CHECK_TYPE([socklen_t], ,[
84 AC_MSG_CHECKING([for socklen_t equivalent])
85 AC_CACHE_VAL([curl_cv_socklen_t_equiv],
86 [
87dnl Systems have either "struct sockaddr*" or "void*" as second
88dnl 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>
94int getpeername (int $arg2 *, $t *);],[$t len;
95 getpeername(0, 0, &len);], [curl_cv_socklen_t_equiv="$t"
96 break])
97 done
98 done
99 ])
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>])
105
106dnl Checks for library functions.
107AC_CHECK_FUNCS([kqueue setrlimit getrusage times])
108
109dnl Do we have restarting syscalls ?
110AC_SYS_RESTARTABLE_SYSCALLS
111
112dnl Check for required features for admins?
113AC_MSG_CHECKING([for donuts])
114AC_MSG_RESULT([yes])
115
116dnl Test for programs
117AC_PROG_AWK
118AC_PROG_MAKE_SET
119AC_PROG_INSTALL
120AC_PROG_LN_S
121AC_PATH_PROGS(RMPROG, rm, /bin/rm)
122AC_PATH_PROGS(SHPROG, sh, /bin/sh)
123
124dnl (F)LEX - needed for the new conf file parser
125AC_PROG_LEX
126dnl The autoconf docs say $LEX defaults to 'lex'. They lie.
127if test "$LEX" = ":" ; then
128 AC_MSG_ERROR([Cannot find flex.])
129elif echo "" | $LEX -V -v --version > /dev/null 2>&1 ; then
130 :
131else
132 AC_MSG_ERROR([Cannot use $LEX as flex.])
133fi
134
135if test -z "$LEXLIB" ; then
136 AC_MSG_FAILURE([Cannot find a library with yywrap() in, but flex was found.
137 It's possible the compiler you're using ($CC) is incompatible with the
138 installed library.])
139fi
140
141LIBS="$LEXLIB $LIBS"
142
143dnl YACC - ditto
144AC_PROG_YACC
145dnl The autoconf docs say $YACC defaults to 'yacc'. This seems to be true,
146dnl but judging from AC_PROG_LEX, it may not stay true.
147if test "$YACC" = ":" ; then
148 AC_MSG_ERROR([Cannot find yacc.])
149elif echo "" | $YACC -V -v --version > /dev/null 2>&1 ; then
150 :
151else
152dnl byacc does not seem to have any way to test for workingness, so only warn.
153 AC_MSG_WARN([$YACC may not work as yacc.])
154fi
155
156unet_NONBLOCKING
157unet_SIGNALS
158
159dnl Check OS for os_dep files.
160AC_MSG_CHECKING(for OS-dependent information)
161case "$host" in
162 *-linux*)
163 AC_MSG_RESULT([Linux ($host) found.])
164 unet_poll_syscall=yes
165 ;;
166
167 *-solaris*)
168 AC_MSG_RESULT([Solaris ($host) found.])
169 if test x"$ac_cv_header_poll_h" = xyes; then
170 unet_poll_syscall=yes
171 else
172 unet_poll_syscall=no
173 fi
174 ;;
175
176 *-sunos*)
177 AC_MSG_RESULT([Solaris ($host) found.])
178 unet_poll_syscall=no
179 ;;
180
181 *-openbsd*)
182 AC_MSG_RESULT([OpenBSD ($host) found.])
183 if test x"$ac_cv_header_poll_h" = xyes; then
184 unet_poll_syscall=yes
185 else
186 unet_poll_syscall=no
187 fi
188 ;;
189
190 *-*bsd*)
191 AC_MSG_RESULT([Generic BSD ($host) found.])
192 if test x"$ac_cv_header_poll_h" = xyes; then
193 unet_poll_syscall=yes
194 else
195 unet_poll_syscall=no
196 fi
197 ;;
198
199 *-darwin*)
200 AC_MSG_RESULT([Darwin (Mac OS X) ($host) found.])
201 unet_poll_syscall=no
202 ;;
203
204 *)
205 AC_MSG_RESULT([Unknown system type $host found.])
206 AC_MSG_WARN([Unknown OS type; using generic routines.])
207 unet_poll_syscall=no
208 ;;
209esac
210
211dnl Check user configuration options
212dnl Start with --enable-poll
213AC_MSG_CHECKING([whether to enable use of poll()])
214AC_ARG_ENABLE([poll],
215[ --enable-poll Force poll to be used regardless of whether or not
216 it is a system call],
217[unet_cv_enable_poll=$enable_poll],
218[AC_CACHE_VAL(unet_cv_enable_poll,
219[unet_cv_enable_poll=$unet_poll_syscall])])
220
221# Force poll to be disabled if there is no poll.h
222if test x"$ac_cv_header_poll_h" != xyes; then
223 unet_cv_enable_poll=no
224fi
225
226AC_MSG_RESULT([$unet_cv_enable_poll])
227
228if test x"$unet_cv_enable_poll" = xyes; then
229 AC_DEFINE([USE_POLL], 1, [Specify whether or not to use poll()])
230 ENGINE_C=engine_poll.c
231else
232 ENGINE_C=engine_select.c
233fi
234AC_SUBST(ENGINE_C)
235
236dnl Now look for --enable-debug
237AC_MSG_CHECKING([whether to enable debug mode])
238AC_ARG_ENABLE([debug],
239[ --enable-debug Turn on debugging mode],
240[unet_cv_enable_debug=$enable_debug],
241[AC_CACHE_VAL(unet_cv_enable_debug,
242[unet_cv_enable_debug=no])])
243AC_MSG_RESULT([$unet_cv_enable_debug])
244
245if test x"$unet_cv_enable_debug" = xyes; then
246 AC_DEFINE([DEBUGMODE], 1, [Enable debugging code])
247fi
248
249dnl Now look for --enable-leak-detect
250AC_MSG_CHECKING([whether to enable leak detection])
251AC_ARG_WITH([leak-detect],
252[ --with-leak-detect Turn on the leak detector(requires patched boehm)],
253[unet_cv_with_leak_detect=$with_leak_detect],
254[AC_CACHE_VAL(unet_cv_with_leak_detect,
255[unet_cv_with_leak_detect=no])])
256AC_MSG_RESULT([$unet_cv_enable_leak_detect])
257
258if test x"$unet_cv_with_leak_detect" != xno; then
259 LIBS="-lgc $LIBS"
260 CFLAGS="-DMDEBUG $CFLAGS"
261 if test x"$unet_cv_with_leak_detect" != xyes; then
262 LIBS="-L$unet_cv_with_leak_detect $LIBS"
263 fi
264fi
265
266AC_ARG_WITH([ipv6],
267 AS_HELP_STRING([--without-ipv6], [disable IPv6 support (default is autodetect)]),
268 [ac_cv_use_ipv6=$withval],
269 [ac_cv_use_ipv6=$unet_have_sockaddr_in6])
270AC_CACHE_CHECK([whether to use IPv6], [ac_cv_use_ipv6], [ac_cv_use_ipv6=no])
271if test x"$ac_cv_use_ipv6" != "xno" ; then
272 AC_DEFINE([IPV6], 1, [Enable IPv6 support])
273fi
274
275dnl And now for --disable-asserts
276AC_MSG_CHECKING([whether to enable asserts])
277AC_ARG_ENABLE([asserts],
278[ --disable-asserts Disable assertion checking],
279[unet_cv_enable_asserts=$enable_asserts],
280[AC_CACHE_VAL(unet_cv_enable_asserts,
281[unet_cv_enable_asserts=yes])])
282AC_MSG_RESULT([$unet_cv_enable_asserts])
283
284if test x"$unet_cv_enable_asserts" = xno; then
285 AC_DEFINE([NDEBUG], 1, [Disable assertions])
286fi
287
288dnl Now check for --enable-profile
289AC_MSG_CHECKING([whether to enable profiling support (gprof)])
290AC_ARG_ENABLE([profile],
291[ --enable-profile Enable profiling support (add -pg to CFLAGS and LDFLAGS)],
292[unet_cv_enable_profile=$enable_profile],
293[AC_CACHE_VAL(unet_cv_enable_profile,
294[unet_cv_enable_profile=no])])
295AC_MSG_RESULT([$unet_cv_enable_profile])
296
297if test x"$unet_cv_enable_profile" = xyes; then
298 CFLAGS="-pg $CFLAGS"
299 LDFLAGS="-pg $LDFLAGS"
300fi
301
302dnl Now check for --enable-pedantic
303AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
304AC_ARG_ENABLE([pedantic],
305[ --enable-pedantic Enable pedantic warnings (add -pedantic to CFLAGS)],
306[unet_cv_enable_pedantic=$enable_pedantic],
307[AC_CACHE_VAL(unet_cv_enable_pedantic,
308[unet_cv_enable_pedantic=no])])
309AC_MSG_RESULT([$unet_cv_enable_pedantic])
310
311if test x"$unet_cv_enable_pedantic" = xyes; then
312 CFLAGS="-pedantic $CFLAGS"
313fi
314
315dnl Now check for --enable-warnings
316AC_MSG_CHECKING([whether to enable compiler warnings])
317AC_ARG_ENABLE([warnings],
318[ --enable-warnings Enable warnings (add -Wall to CFLAGS)],
319[unet_cv_enable_warnings=$enable_warnings],
320[AC_CACHE_VAL(unet_cv_enable_warnings,
321[unet_cv_enable_warnings=no])])
322AC_MSG_RESULT([$unet_cv_enable_warnings])
323
324if test x"$unet_cv_enable_warnings" = xyes; then
325 CFLAGS="-Wall $CFLAGS"
326fi
327
328dnl --disable-inlines check...
329AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
330AC_ARG_ENABLE([inlines],
331[ --disable-inlines Disable inlining for a few critical functions],
332[unet_cv_enable_inlines=$enable_inlines],
333[AC_CACHE_VAL(unet_cv_enable_inlines,
334[unet_cv_enable_inlines=yes])])
335AC_MSG_RESULT([$unet_cv_enable_inlines])
336
337if test x"$unet_cv_enable_inlines" = xyes; then
338 AC_DEFINE([FORCEINLINE], 1, [Force inlining for a few critical functions])
339fi
340
341dnl --disable-devpoll check...
342AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
343AC_ARG_ENABLE([devpoll],
344[ --disable-devpoll Disable the /dev/poll-based engine],
345[unet_cv_enable_devpoll=$enable_devpoll],
346[AC_CACHE_VAL(unet_cv_enable_devpoll,
347[unet_cv_enable_devpoll=yes])])
348
349if test x"$ac_cv_header_sys_devpoll_h" = xno; then
350 unet_cv_enable_devpoll=no
351fi
352
353AC_MSG_RESULT([$unet_cv_enable_devpoll])
354
355if test x"$unet_cv_enable_devpoll" != xno; then
356 AC_DEFINE([USE_DEVPOLL], 1, [Define to enable the /dev/poll engine])
357 ENGINE_C="engine_devpoll.c $ENGINE_C"
358fi
359
360dnl --disable-kqueue check...
361AC_MSG_CHECKING([whether to enable the kqueue event engine])
362AC_ARG_ENABLE([kqueue],
363[ --disable-kqueue Disable the kqueue-based engine],
364[unet_cv_enable_kqueue=$enable_kqueue],
365[AC_CACHE_VAL(unet_cv_enable_kqueue,
366[unet_cv_enable_kqueue=yes])])
367
368if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
369 unet_cv_enable_kqueue=no
370fi
371
372AC_MSG_RESULT([$unet_cv_enable_kqueue])
373
374if test x"$unet_cv_enable_kqueue" != xno; then
375 AC_DEFINE([USE_KQUEUE], 1, [Define to enable the kqueue engine])
376 ENGINE_C="engine_kqueue.c $ENGINE_C"
377fi
378
379dnl --disable-epoll check
380AC_MSG_CHECKING([whether to enable the epoll event engine])
381AC_ARG_ENABLE([epoll],
382[ --disable-epoll Disable the epoll-based engine],
383[unet_cv_enable_epoll=$enable_epoll],
384[AC_CACHE_VAL(unet_cv_enable_epoll,
385[unet_cv_enable_epoll=yes])])
386
387if test x"$ac_cv_header_sys_epoll_h" = xno -o x"$ac_cv_func_epoll" = xno; then
388 unet_cv_enable_epoll=no
389fi
390
391AC_MSG_RESULT([$unet_cv_enable_epoll])
392
393dnl If we have the header and user has not refused epoll, we still need
394dnl to check whether the functions are properly defined.
395if test x"$unet_cv_enable_epoll" != xno; then
396 AC_MSG_CHECKING([whether epoll functions are properly defined])
397 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/epoll.h>], [epoll_create(10);])],
398 [AC_MSG_RESULT([yes])],
399 [AC_MSG_RESULT([no])
400 AC_DEFINE([EPOLL_NEED_BODY], 1, [Define to implement epoll system calls])])
401 AC_DEFINE([USE_EPOLL], 1, [Define to enable the epoll engine])
402 ENGINE_C="engine_epoll.c $ENGINE_C"
403fi
404
405dnl How to copy one va_list to another?
406AC_CACHE_CHECK([for va_copy], unet_cv_c_va_copy, [AC_LINK_IFELSE(
407 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
408 [unet_cv_c_va_copy="yes"],
409 [unet_cv_c_va_copy="no"]
410)])
411if test "$unet_cv_c_va_copy" = "yes" ; then
412 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
413fi
414
415AC_CACHE_CHECK([for __va_copy], unet_cv_c___va_copy, [AC_LINK_IFELSE(
416 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
417 [unet_cv_c___va_copy="yes"],
418 [unet_cv_c___va_copy="no"]
419)])
420if test "$unet_cv_c___va_copy" = "yes" ; then
421 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
422fi
423
424dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
425AC_MSG_CHECKING([what name to give the symlink])
426AC_ARG_WITH([symlink],
427[ --with-symlink=name Name to give the symlink; if name is "no," no
428 symlink will be created.],
429[unet_cv_with_symlink=$with_symlink],
430[AC_CACHE_VAL(unet_cv_with_symlink,
431[unet_cv_with_symlink="ircd"])])
432
433if test x"$unet_cv_with_symlink" = xyes; then
434 unet_cv_with_symlink="ircd"
435fi
436
437AC_MSG_RESULT([$unet_cv_with_symlink])
438
439if test x"$unet_cv_with_symlink" = xno; then
440 INSTALL_RULE=install-no-symlink
441 SYMLINK=
442else
443 INSTALL_RULE=install-with-symlink
444 SYMLINK=$unet_cv_with_symlink
445fi
446AC_SUBST(INSTALL_RULE)
447AC_SUBST(SYMLINK)
448
449dnl --with-mode lets us set the permissions on the binary
450AC_MSG_CHECKING([what permissions to set on the installed binary])
451AC_ARG_WITH([mode],
452[ --with-mode=mode Permissions (in octal) to give the binary],
453[unet_cv_with_mode=$with_mode],
454[AC_CACHE_VAL(unet_cv_with_mode,
455[unet_cv_with_mode=711])])
456
457if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
458 unet_cv_with_mode=711
459fi
460
461AC_MSG_RESULT([$unet_cv_with_mode])
462
463IRCDMODE=$unet_cv_with_mode
464AC_SUBST(IRCDMODE)
465
466dnl --with-owner lets us set the owner of the binary
467changequote(,)dnl
468unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
469changequote([,])dnl
470AC_MSG_CHECKING([which user should own the installed binary])
471AC_ARG_WITH([owner],
472[ --with-owner=owner Specify owner of the installed binary],
473[unet_cv_with_owner=$with_owner],
474[AC_CACHE_VAL(unet_cv_with_owner,
475[unet_cv_with_owner=$unet_uid])])
476
477if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
478 unet_cv_with_owner=$unet_uid
479fi
480
481AC_MSG_RESULT([$unet_cv_with_owner])
482
483IRCDOWN=$unet_cv_with_owner
484AC_SUBST(IRCDOWN)
485
486dnl --with-group lets us set the group owner of the binary
487changequote(,)dnl
488unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
489changequote([,])dnl
490AC_MSG_CHECKING([which group should own the installed binary])
491AC_ARG_WITH([group],
492[ --with-group=group Specify group owner of the installed binary],
493[unet_cv_with_group=$with_group],
494[AC_CACHE_VAL(unet_cv_with_group,
495[unet_cv_with_group=$unet_gid])])
496
497if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
498 unet_cv_with_group=$unet_gid
499fi
500
501AC_MSG_RESULT([$unet_cv_with_group])
502
503IRCDGRP=$unet_cv_with_group
504AC_SUBST(IRCDGRP)
505
506dnl --with-domain lets us set the domain name for some statistics-gathering
507unet_domain=
508if test -f /etc/resolv.conf; then
509 unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
510 if test x"$unet_domain" = x; then
511 unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
512 fi
513fi
514AC_MSG_CHECKING([for site domain name])
515AC_ARG_WITH([domain],
516[ --with-domain=domain Domain name to use in local statistics gathering],
517[unet_cv_with_domain=$with_domain],
518[AC_CACHE_VAL(unet_cv_with_domain,
519[unet_cv_with_domain=$unet_domain])])
520
521if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
522 unet_cv_with_domain=$unet_domain
523fi
524if test x"$unet_cv_with_domain" = xno; then
525 AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
526fi
527
528AC_MSG_RESULT([$unet_cv_with_domain])
529
530AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
531[Domain name to be used for some statistics gathering])
532
533dnl --with-chroot lets us define a directory that we are going to be using
534dnl as the root of our filesystem
535AC_MSG_CHECKING([if chroot operation is desired])
536AC_ARG_WITH([chroot],
537[ --with-chroot=dir Specify that the server will be operated under
538 a different root directory given by dir. See
539 doc/readme.chroot for more information.],
540[unet_cv_with_chroot=$with_chroot],
541[AC_CACHE_VAL(unet_cv_with_chroot,
542[unet_cv_with_chroot=no])])
543
544if test x"$unet_cv_with_chroot" = xyes; then
545 AC_MSG_ERROR([--with-chroot given with no directory. See doc/readme.chroot.])
546fi
547
548# Ensure there are no trailing /'s to mess us up
549unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
550
551AC_MSG_RESULT([$unet_cv_with_chroot])
552
553dnl Determine some default directory names
554dnl
555dnl HACK WARNING: We are referencing an autoconf internal variable. This is
556dnl the only way to figure out what value $prefix will have when we go to do
557dnl the install--and the only way we can stick that value in our definitions
558dnl of SPATH, etc.
559# Deal with the annoying value "NONE" here
560unet_save_prefix=$prefix
561if test x"$prefix" = xNONE; then
562 prefix=$ac_default_prefix
563else
564 prefix=$prefix
565fi
566
567unet_save_exec_prefix=$exec_prefix
568if test x"$exec_prefix" = xNONE; then
569 exec_prefix=$prefix
570else
571 exec_prefix=$exec_prefix
572fi
573
574# Obtain the actual interesting directories
575unet_bindir=`eval echo "$bindir"`
576unet_libdir=`eval echo "$libdir"`
577
578# Restore the original settings of $prefix and $exec_prefix
579prefix=$unet_save_prefix
580exec_prefix=$unet_save_exec_prefix
581
582dnl Now compute the name of the binary and verify that it will work under
583dnl chroot operation
584AC_MSG_CHECKING([where the binary will be for /restart])
585if test x"$unet_cv_with_symlink" = xno; then
586 unet_spath="$unet_bindir/ircd"
587else
588 unet_spath="$unet_bindir/$unet_cv_with_symlink"
589fi
590AC_MSG_RESULT([$unet_spath])
591
592if test x"$unet_cv_with_chroot" != xno; then
593 if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
594 unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
595 else
596 AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
597 fi
598fi
599
600AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
601
602dnl --with-dpath sets the all-important DPATH
603AC_MSG_CHECKING([what the data directory should be])
604AC_ARG_WITH([dpath],
605[ --with-dpath=dir Directory for all server data files],
606[unet_cv_with_dpath=$with_dpath],
607[AC_CACHE_VAL(unet_cv_with_dpath,
608[unet_cv_with_dpath=$unet_libdir])])
609
610if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
611 unet_cv_with_dpath=$unet_libdir
612fi
613
614# Ensure there are no trailing /'s to mess us up
615unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
616
617AC_MSG_RESULT([$unet_cv_with_dpath])
618
619if test x"$unet_cv_with_chroot" != xno; then
620 if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
621 unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
622 else
623 AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
624 fi
625else
626 unet_dpath=$unet_cv_with_dpath
627fi
628
629AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
630
631DPATH=$unet_cv_with_dpath
632AC_SUBST(DPATH)
633
634dnl --with-cpath allows us to specify the configuration file
635AC_MSG_CHECKING([where the default configuration file resides])
636AC_ARG_WITH([cpath],
637[ --with-cpath=file Set server configuration file],
638[unet_cv_with_cpath=$with_cpath],
639[AC_CACHE_VAL(unet_cv_with_cpath,
640[unet_cv_with_cpath="ircd.conf"])])
641
642if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
643 unet_cv_with_cpath="ircd.conf"
644fi
645
646AC_MSG_RESULT([$unet_cv_with_cpath])
647
648if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
649 # Absolute path; check against chroot stuff
650 if test x"$unet_cv_with_chroot" != xno; then
651 if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
652 unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
653 else
654 AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
655 fi
656 else
657 unet_cpath=$unet_cv_with_cpath
658 fi
659else
660 unet_cpath=$unet_cv_with_cpath
661fi
662
663AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
664
665dnl --with-lpath allows us to specify the default debugging log file
666AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
667AC_ARG_WITH([lpath],
668[ --with-lpath=file Set the debugging log file],
669[unet_cv_with_lpath=$with_lpath],
670[AC_CACHE_VAL(unet_cv_with_lpath,
671[unet_cv_with_lpath="ircd.log"])])
672
673if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
674 unet_cv_with_lpath="ircd.log"
675fi
676
677AC_MSG_RESULT([$unet_cv_with_lpath])
678
679if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
680 # Absolute path; check against chroot stuff
681 if test x"$unet_cv_with_chroot" != xno; then
682 if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
683 unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
684 else
685 AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
686 unet_cv_with_lpath="ircd.log"
687 unet_lpath="ircd.log"
688 fi
689 else
690 unet_lpath=$unet_cv_with_lpath
691 fi
692else
693 unet_lpath=$unet_cv_with_lpath
694fi
695
696AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
697
698dnl --with-maxcon allows us to set the maximum connections
699unet_maxcon=`ulimit -Hn`
700if test x"$unet_maxcon" = xunlimited; then
701 unet_maxcon=`ulimit -Sn`
702fi
703unet_maxcon=`expr $unet_maxcon - 4`
704AC_MSG_CHECKING([max connections])
705AC_ARG_WITH([maxcon],
706[ --with-maxcon=maxcon Maximum number of connections server will accept],
707[unet_cv_with_maxcon=$with_maxcon],
708[AC_CACHE_VAL(unet_cv_with_maxcon,
709[unet_cv_with_maxcon=$unet_maxcon])])
710
711if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
712 unet_cv_with_maxcon=$unet_maxcon
713fi
714
715AC_MSG_RESULT([$unet_cv_with_maxcon])
716
717AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
718[Maximum number of network connections])
719
720dnl Finally really generate all output files:
721AC_OUTPUT(Makefile ircd/Makefile ircd/test/Makefile doc/Makefile, [echo timestamp > stamp-h])
722
723dnl Report configuration
724AC_OUTPUT_COMMANDS([echo "
725ircu is now hopefully configured for your system.
726
727 Host system: $host_os
728 Prefix: $prefix
729 Asserts: $unet_cv_enable_asserts
730 Warnings: $unet_cv_enable_warnings
731 Debug: $unet_cv_enable_debug
732 Profile: $unet_cv_enable_profile
733 Owner/mode: $unet_cv_with_owner.$unet_cv_with_group ($unet_cv_with_mode)
734 Chroot: $unet_cv_with_chroot
735
736 Domain: $unet_cv_with_domain
737 DPath: $unet_cv_with_dpath
738 CPath: $unet_cv_with_cpath
739 LPath: $unet_cv_with_lpath
740 Maximum connections: $unet_cv_with_maxcon
741
742 poll() engine: $unet_cv_enable_poll
743 kqueue() engine: $unet_cv_enable_kqueue
744 /dev/poll engine: $unet_cv_enable_devpoll
745 epoll() engine: $unet_cv_enable_epoll
746"])