Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / configure.in
1 dnl Prefered emacs editing mode: -*- shell-script -*-
2 dnl
3 dnl Process this file with autoconf to produce a configure script.
4 dnl
5 dnl Copyright (c) 1997, by Carlo Wood <carlo@runaway.xs4all.nl>
6 dnl Copyright (C) 2001  Kevin L. Mitchell <klmitch@mit.edu>
7 dnl
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.
12 dnl
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.
17 dnl
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.
21 dnl
22 dnl $Id$
23
24 dnl Make sure we are in the correct directory (someone could have run
25 dnl 'configure' with a wrong '--srcdir').
26 AC_INIT(ircd/ircd.c)
27
28 dnl Set the default prefix
29 AC_PREFIX_DEFAULT([$HOME])
30 AC_CACHE_VAL(unet_cv_prefix, [unet_cv_prefix=$HOME])
31 if test x"$prefix" != xNONE; then
32     unet_cv_prefix=$prefix
33 fi
34 dnl HACK WARNING: We are referencing an autoconf internal variable.  This is
35 dnl the only way to force the prefix to be retrieved from the config.cache
36 dnl file!
37 ac_default_prefix=$unet_cv_prefix
38
39 dnl Define the input and output configuration header file.
40 AC_CONFIG_HEADER([config.h])
41
42 dnl Demand at least version 2.13 of autoconf
43 AC_PREREQ(2.13)
44
45 dnl Find out what type of system we are
46 AC_CANONICAL_HOST
47
48 dnl This should be done early.
49 AC_PROG_CC
50
51 dnl ANSIfy the C compiler whenever possible.
52 AM_PROG_CC_STDC
53 dnl Use -O3 instead of -O2.
54 if test x"$CFLAGS" != x; then
55     CFLAGS=`echo "$CFLAGS" | sed -e 's/-O2/-O3/'`
56 fi
57 dnl Remove -pipe during configure
58 if test x"$CFLAGS" != x; then
59     CFLAGS=`echo "$CFLAGS" | sed -e 's/-pipe//g'`
60 fi
61 dnl Notice the -g flag and deal accordingly
62 if test x"$CFLAGS" != x; then
63     unet_old_cflags=$CFLAGS
64     CFLAGS=`echo "$CFLAGS" | sed -e 's/-g//g'`
65 fi
66 if test x"$CFLAGS" != x"$unet_old_cflags"; then
67     # If -g was already there, force symbols to be enabled
68     unet_cv_enable_symbols=yes
69 fi
70 dnl Notice the -pg flag and deal accordingly
71 if test x"$CFLAGS" != x; then
72     unet_old_cflags=$CFLAGS
73     CFLAGS=`echo "$CFLAGS" | sed -e 's/-pg//g'`
74 fi
75 if test x"$CFLAGS" != x"$unet_old_cflags"; then
76     # If -pg was already there, force profiling to be enabled
77     unet_cv_enable_profile=yes
78 fi
79 dnl Notice the -Wall flag and deal accordingly
80 if test x"$CFLAGS" != x; then
81     unet_old_cflags=$CFLAGS
82     CFLAGS=`echo "$CFLAGS" | sed -e 's/-Wall//g'`
83 fi
84 if test x"$CFLAGS" != x"$unet_old_cflags"; then
85     # If -Wall was already there, force warnings to be enabled
86     unet_cv_enable_warnings=yes
87 fi
88 dnl Notice the -pedantic flag and deal accordingly
89 if test x"$CFLAGS" != x; then
90     unet_old_cflags=$CFLAGS
91     CFLAGS=`echo "$CFLAGS" | sed -e 's/-pedantic//g'`
92 fi
93 if test x"$CFLAGS" != x"$unet_old_cflags"; then
94     # If -pedantic was already there, force pedatic to be enabled
95     unet_cv_enable_pedantic=yes
96 fi
97
98 dnl Checks for libraries.
99
100 dnl Locate the library containing crypt
101 AC_SEARCH_LIBS(crypt, descrypt crypt, ,
102 [AC_MSG_ERROR([Unable to find library containing crypt()])])
103
104 dnl Do all the checks necessary to figure out -lnsl / -lsocket stuff
105 AC_LIBRARY_NET
106
107 dnl Look for res_mkquery.  Done after AC_LIBRARY_NET in case res_mkquery
108 dnl is in one of those libraries somewhere.
109 AC_SEARCH_LIBS(res_mkquery, resolv, ,
110 [AC_MSG_ERROR([Unable to find library containing res_mkquery()])])
111
112 dnl Checks for header files.
113 AC_HEADER_STDC
114 AC_CHECK_HEADERS(poll.h sys/devpoll.h sys/event.h)
115
116 dnl Checks for typedefs, structures, and compiler characteristics
117 dnl AC_C_CONST
118 AC_C_BIGENDIAN
119 AC_TYPE_SIZE_T
120 AC_HEADER_TIME
121 AC_STRUCT_TM
122 AC_TYPE_UID_T
123 unet_CHECK_TYPE_SIZES
124
125 dnl Checks for library functions.
126 AC_CHECK_FUNC(kqueue)
127
128 dnl Do we have restarting syscalls ?
129 AC_SYS_RESTARTABLE_SYSCALLS
130
131 dnl Check for required features for admins?
132 AC_MSG_CHECKING([for donuts])
133 AC_MSG_RESULT([yes])
134
135 dnl Test for programs
136 AC_PROG_AWK
137 AC_PROG_MAKE_SET
138 AC_PROG_INSTALL
139 AC_PROG_LN_S
140 AC_PATH_PROGS(RMPROG, rm, /bin/rm)
141 AC_PATH_PROGS(SHPROG, sh, /bin/sh)
142
143 unet_NONBLOCKING
144 unet_SIGNALS
145
146 dnl Add -pipe when possible
147 unet_PIPE_CFLAGS
148
149 dnl Check OS for os_dep files.
150 AC_MSG_CHECKING(for OS-dependent information)
151 case "$host" in
152     *-linux*)
153         AC_MSG_RESULT([Linux ($host) found.])
154         unet_poll_syscall=yes
155         OSDEP_C=os_linux.c
156         ;;
157
158     *-solaris*)
159         AC_MSG_RESULT([Solaris ($host) found.])
160         if test x"$ac_cv_header_poll_h" = xyes; then
161             unet_poll_syscall=yes
162         else
163             unet_poll_syscall=no
164         fi
165         OSDEP_C=os_solaris.c
166         ;;
167
168     *-sunos*)
169         AC_MSG_RESULT([Solaris ($host) found.])
170         unet_poll_syscall=no
171         OSDEP_C=os_solaris.c
172         ;;
173
174     *-openbsd*)
175         AC_MSG_RESULT([OpenBSD ($host) found.])
176         if test x"$ac_cv_header_poll_h" = xyes; then
177             unet_poll_syscall=yes
178         else
179             unet_poll_syscall=no
180         fi
181         OSDEP_C=os_openbsd.c
182         ;;
183
184     *-*bsd*)
185         AC_MSG_RESULT([Generic BSD ($host) found.])
186         if test x"$ac_cv_header_poll_h" = xyes; then
187             unet_poll_syscall=yes
188         else
189             unet_poll_syscall=no
190         fi
191         OSDEP_C=os_bsd.c
192         ;;
193
194     *)
195         AC_MSG_RESULT([Unknown system type $host found.])
196         AC_MSG_WARN([Unknown OS type; using generic routines.])
197         unet_poll_syscall=no
198         OSDEP_C=os_generic.c
199         ;;
200 esac
201 AC_SUBST(OSDEP_C)
202
203 dnl Check user configuration options
204 dnl Start with --enable-poll
205 AC_MSG_CHECKING([whether to enable use of poll()])
206 AC_ARG_ENABLE([poll],
207 [  --enable-poll           Force poll to be used regardless of whether or not
208                           it is a system call],
209 [unet_cv_enable_poll=$enable_poll],
210 [AC_CACHE_VAL(unet_cv_enable_poll,
211 [unet_cv_enable_poll=$unet_poll_syscall])])
212
213 # Force poll to be disabled if there is no poll.h
214 if test x"$ac_cv_header_poll_h" != xyes; then
215     unet_cv_enable_poll=no
216 fi
217
218 AC_MSG_RESULT([$unet_cv_enable_poll])
219
220 if test x"$unet_cv_enable_poll" = xyes; then
221     AC_DEFINE([USE_POLL], , [Specify whether or not to use poll()])
222     ENGINE_C=engine_poll.c
223 else
224     ENGINE_C=engine_select.c
225 fi
226 AC_SUBST(ENGINE_C)
227
228 dnl Now look for --enable-debug
229 AC_MSG_CHECKING([whether to enable debug mode])
230 AC_ARG_ENABLE([debug],
231 [  --enable-debug          Turn on debugging mode],
232 [unet_cv_enable_debug=$enable_debug],
233 [AC_CACHE_VAL(unet_cv_enable_debug,
234 [unet_cv_enable_debug=no])])
235 AC_MSG_RESULT([$unet_cv_enable_debug])
236
237 if test x"$unet_cv_enable_debug" = xyes; then
238     AC_DEFINE([DEBUGMODE], , [Enable debugging code])
239 fi
240
241 dnl And now for --enable-asserts
242 AC_MSG_CHECKING([whether to enable asserts])
243 AC_ARG_ENABLE([asserts],
244 [  --enable-asserts        Enable asserts],
245 [unet_cv_enable_asserts=$enable_asserts],
246 [AC_CACHE_VAL(unet_cv_enable_asserts,
247 [unet_cv_enable_asserts=no])])
248 AC_MSG_RESULT([$unet_cv_enable_asserts])
249
250 if test x"$unet_cv_enable_asserts" = xno; then
251     AC_DEFINE([NDEBUG], , [Disable assertions])
252 fi
253
254 dnl Check for --enable-symbols
255 AC_MSG_CHECKING([whether to enable debugging symbols])
256 AC_ARG_ENABLE([symbols],
257 [  --disable-symbols       Disable debugging symbols (remove -g from CFLAGS)],
258 [unet_cv_enable_symbols=$enable_symbols],
259 [AC_CACHE_VAL(unet_cv_enable_symbols,
260 [unet_cv_enable_symbols=yes])])
261 AC_MSG_RESULT([$unet_cv_enable_symbols])
262
263 if test x"$unet_cv_enable_symbols" = xyes; then
264     CFLAGS="-g $CFLAGS"
265 fi
266
267 dnl Now check for --enable-profile
268 AC_MSG_CHECKING([whether to enable profiling support (gprof)])
269 AC_ARG_ENABLE([profile],
270 [  --enable-profile        Enable profiling support (add -pg to CFLAGS)],
271 [unet_cv_enable_profile=$enable_profile],
272 [AC_CACHE_VAL(unet_cv_enable_profile,
273 [unet_cv_enable_profile=no])])
274 AC_MSG_RESULT([$unet_cv_enable_profile])
275
276 if test x"$unet_cv_enable_profile" = xyes; then
277     CFLAGS="-pg $CFLAGS"
278 fi
279
280 dnl Now check for --enable-pedantic
281 AC_MSG_CHECKING([whether to enable pedantic compiler warnings])
282 AC_ARG_ENABLE([pedantic],
283 [  --enable-pedantic       Enable pedantic warnings (add -pedantic to CFLAGS)],
284 [unet_cv_enable_pedantic=$enable_pedantic],
285 [AC_CACHE_VAL(unet_cv_enable_pedantic,
286 [unet_cv_enable_pedantic=no])])
287 AC_MSG_RESULT([$unet_cv_enable_pedantic])
288
289 if test x"$unet_cv_enable_pedantic" = xyes; then
290     CFLAGS="-pedantic $CFLAGS"
291 fi
292
293 dnl Now check for --enable-warnings
294 AC_MSG_CHECKING([whether to enable compiler warnings])
295 AC_ARG_ENABLE([warnings],
296 [  --enable-warnings       Enable warnings (add -Wall to CFLAGS)],
297 [unet_cv_enable_warnings=$enable_warnings],
298 [AC_CACHE_VAL(unet_cv_enable_warnings,
299 [unet_cv_enable_warnings=no])])
300 AC_MSG_RESULT([$unet_cv_enable_warnings])
301
302 if test x"$unet_cv_enable_warnings" = xyes; then
303     CFLAGS="-Wall $CFLAGS"
304 fi
305
306 dnl --disable-inlines check...
307 AC_MSG_CHECKING([whether to enable inlining for a few critical functions])
308 AC_ARG_ENABLE([inlines],
309 [  --disable-inlines       Disable inlining for a few critical functions],
310 [unet_cv_enable_inlines=$enable_inlines],
311 [AC_CACHE_VAL(unet_cv_enable_inlines,
312 [unet_cv_enable_inlines=yes])])
313 AC_MSG_RESULT([$unet_cv_enable_inlines])
314
315 if test x"$unet_cv_enable_inlines" = xyes; then
316     AC_DEFINE([FORCEINLINE], , [Force inlining for a few critical functions])
317 fi
318
319 dnl --enable-devpoll check...
320 AC_MSG_CHECKING([whether to enable the /dev/poll event engine])
321 AC_ARG_ENABLE([devpoll],
322 [  --enable-devpoll        Enable the experimental /dev/poll-based engine],
323 [unet_cv_enable_devpoll=$enable_devpoll],
324 [AC_CACHE_VAL(unet_cv_enable_devpoll,
325 [unet_cv_enable_devpoll=no])])
326
327 if test x"$ac_cv_header_sys_devpoll_h" = xno; then
328     unet_cv_enable_devpoll=no
329 fi
330
331 AC_MSG_RESULT([$unet_cv_enable_devpoll])
332
333 if test x"$unet_cv_enable_devpoll" != xno; then
334     AC_DEFINE([USE_DEVPOLL], , [Define to enable the /dev/poll engine])
335     ENGINE_C="engine_devpoll.c $ENGINE_C"
336 fi
337
338 dnl --enable-kqueue check...
339 AC_MSG_CHECKING([whether to enable the kqueue event engine])
340 AC_ARG_ENABLE([kqueue],
341 [  --enable-kqueue         Enable the experimental kqueue-based engine],
342 [unet_cv_enable_kqueue=$enable_kqueue],
343 [AC_CACHE_VAL(unet_cv_enable_kqueue,
344 [unet_cv_enable_kqueue=no])])
345
346 if test x"$ac_cv_header_sys_event_h" = xno -o x"$ac_cv_func_kqueue" = xno; then
347     unet_cv_enable_kqueue=no
348 fi
349
350 AC_MSG_RESULT([$unet_cv_enable_kqueue])
351
352 if test x"$unet_cv_enable_kqueue" != xno; then
353     AC_DEFINE([USE_KQUEUE], , [Define to enable the kqueue engine])
354     ENGINE_C="engine_kqueue.c $ENGINE_C"
355 fi
356
357 dnl --with-symlink lets us set the name of the symlink; defaults to "ircd"
358 AC_MSG_CHECKING([what name to give the symlink])
359 AC_ARG_WITH([symlink],
360 [  --with-symlink=name     Name to give the symlink; if name is "no," no
361                           symlink will be created.],
362 [unet_cv_with_symlink=$with_symlink],
363 [AC_CACHE_VAL(unet_cv_with_symlink,
364 [unet_cv_with_symlink="ircd"])])
365
366 if test x"$unet_cv_with_symlink" = xyes; then
367     unet_cv_with_symlink="ircd"
368 fi
369
370 AC_MSG_RESULT([$unet_cv_with_symlink])
371
372 if test x"$unet_cv_with_symlink" = xno; then
373     INSTALL_RULE=install-no-symlink
374     SYMLINK=
375 else
376     INSTALL_RULE=install-with-symlink
377     SYMLINK=$unet_cv_with_symlink
378 fi
379 AC_SUBST(INSTALL_RULE)
380 AC_SUBST(SYMLINK)
381
382 dnl --with-mode lets us set the permissions on the binary
383 AC_MSG_CHECKING([what permissions to set on the installed binary])
384 AC_ARG_WITH([mode],
385 [  --with-mode=mode        Permissions (in octal) to give the binary],
386 [unet_cv_with_mode=$with_mode],
387 [AC_CACHE_VAL(unet_cv_with_mode,
388 [unet_cv_with_mode=711])])
389
390 if test x"$unet_cv_with_mode" = xyes -o x"$unet_cv_with_mode" = xno; then
391     unet_cv_with_mode=711
392 fi
393
394 AC_MSG_RESULT([$unet_cv_with_mode])
395
396 IRCDMODE=$unet_cv_with_mode
397 AC_SUBST(IRCDMODE)
398
399 dnl --with-owner lets us set the owner of the binary
400 changequote(,)dnl
401 unet_uid=`id | sed -e 's/.*uid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
402 changequote([,])dnl
403 AC_MSG_CHECKING([which user should own the installed binary])
404 AC_ARG_WITH([owner],
405 [  --with-owner=owner      Specify owner of the installed binary],
406 [unet_cv_with_owner=$with_owner],
407 [AC_CACHE_VAL(unet_cv_with_owner,
408 [unet_cv_with_owner=$unet_uid])])
409
410 if test x"$unet_cv_with_owner" = xyes -o x"$unet_cv_with_owner" = xno; then
411     unet_cv_with_owner=$unet_uid
412 fi
413
414 AC_MSG_RESULT([$unet_cv_with_owner])
415
416 IRCDOWN=$unet_cv_with_owner
417 AC_SUBST(IRCDOWN)
418
419 dnl --with-group lets us set the group owner of the binary
420 changequote(,)dnl
421 unet_gid=`id | sed -e 's/.*gid=[0-9]*(//' -e 's/).*//' 2> /dev/null`
422 changequote([,])dnl
423 AC_MSG_CHECKING([which group should own the installed binary])
424 AC_ARG_WITH([group],
425 [  --with-group=group      Specify group owner of the installed binary],
426 [unet_cv_with_group=$with_group],
427 [AC_CACHE_VAL(unet_cv_with_group,
428 [unet_cv_with_group=$unet_gid])])
429
430 if test x"$unet_cv_with_group" = xyes -o x"$unet_cv_with_group" = xno; then
431     unet_cv_with_group=$unet_gid
432 fi
433
434 AC_MSG_RESULT([$unet_cv_with_group])
435
436 IRCDGRP=$unet_cv_with_group
437 AC_SUBST(IRCDGRP)
438
439 dnl --with-domain lets us set the domain name for some statistics-gathering
440 unet_domain=
441 if test -f /etc/resolv.conf; then
442     unet_domain=`awk '/^domain/ { print $2; exit }' /etc/resolv.conf`
443     if test x"$unet_domain" = x; then
444         unet_domain=`awk '/^search/ { print $2; exit }' /etc/resolv.conf`
445     fi
446 fi
447 AC_MSG_CHECKING([for site domain name])
448 AC_ARG_WITH([domain],
449 [  --with-domain=domain    Domain name to use in local statistics gathering],
450 [unet_cv_with_domain=$with_domain],
451 [AC_CACHE_VAL(unet_cv_with_domain,
452 [unet_cv_with_domain=$unet_domain])])
453
454 if test x"$unet_cv_with_domain" = xyes -o x"$unet_cv_with_domain" = xno; then
455     unet_cv_with_domain=$unet_domain
456 fi
457 if test x"$unet_cv_with_domain" = xno; then
458     AC_MSG_ERROR([Unable to determine server DNS domain; use --with-domain to set it])
459 fi
460
461 AC_MSG_RESULT([$unet_cv_with_domain])
462
463 AC_DEFINE_UNQUOTED(DOMAINNAME, "*$unet_cv_with_domain",
464 [Domain name to be used for some statistics gathering])
465
466 dnl --with-chroot lets us define a directory that we are going to be using
467 dnl as the root of our filesystem
468 AC_MSG_CHECKING([if chroot operation is desired])
469 AC_ARG_WITH([chroot],
470 [  --with-chroot=dir       Specify that the server will be operated under
471                           a different root directory given by dir.  See
472                           doc/readme.chroot for more information.],
473 [unet_cv_with_chroot=$with_chroot],
474 [AC_CACHE_VAL(unet_cv_with_chroot,
475 [unet_cv_with_chroot=no])])
476
477 if test x"$unet_cv_with_chroot" = xyes; then
478     AC_MSG_ERROR([--with-chroot given with no directory.  See doc/readme.chroot.])
479 fi
480
481 # Ensure there are no trailing /'s to mess us up
482 unet_cv_with_chroot=`echo "$unet_cv_with_chroot" | sed 's%/*$%%'`
483
484 AC_MSG_RESULT([$unet_cv_with_chroot])
485
486 dnl Determine some default directory names
487 dnl
488 dnl HACK WARNING: We are referencing an autoconf internal variable.  This is
489 dnl the only way to figure out what value $prefix will have when we go to do
490 dnl the install--and the only way we can stick that value in our definitions
491 dnl of SPATH, etc.
492 # Deal with the annoying value "NONE" here
493 unet_save_prefix=$prefix
494 if test x"$prefix" = xNONE; then
495     prefix=$ac_default_prefix
496 else
497     prefix=$prefix
498 fi
499
500 unet_save_exec_prefix=$exec_prefix
501 if test x"$exec_prefix" = xNONE; then
502     exec_prefix=$prefix
503 else
504     exec_prefix=$exec_prefix
505 fi
506
507 # Obtain the actual interesting directories
508 unet_bindir=`eval echo "$bindir"`
509 unet_libdir=`eval echo "$libdir"`
510
511 # Restore the original settings of $prefix and $exec_prefix
512 prefix=$unet_save_prefix
513 exec_prefix=$unet_save_exec_prefix
514
515 dnl Now compute the name of the binary and verify that it will work under
516 dnl chroot operation
517 AC_MSG_CHECKING([where the binary will be for /restart])
518 if test x"$unet_cv_with_symlink" = xno; then
519     unet_spath="$unet_bindir/ircd"
520 else
521     unet_spath="$unet_bindir/$unet_cv_with_symlink"
522 fi
523 AC_MSG_RESULT([$unet_spath])
524
525 if test x"$unet_cv_with_chroot" != xno; then
526     if echo "$unet_spath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
527         unet_spath=`echo "$unet_spath" | sed "s%^$unet_cv_with_chroot%%"`
528     else
529         AC_MSG_WARN([Binary $unet_spath not relative to root directory $unet_cv_with_chroot; restarts will probably fail])
530     fi
531 fi
532
533 AC_DEFINE_UNQUOTED(SPATH, "$unet_spath", [Path to executable for restarts])
534
535 dnl --with-dpath sets the all-important DPATH
536 AC_MSG_CHECKING([what the data directory should be])
537 AC_ARG_WITH([dpath],
538 [  --with-dpath=dir        Directory for all server data files],
539 [unet_cv_with_dpath=$with_dpath],
540 [AC_CACHE_VAL(unet_cv_with_dpath,
541 [unet_cv_with_dpath=$unet_libdir])])
542
543 if test x"$unet_cv_with_dpath" = xyes -o x"$unet_cv_with_dpath" = xno; then
544     unet_cv_with_dpath=$unet_libdir
545 fi
546
547 # Ensure there are no trailing /'s to mess us up
548 unet_cv_with_dpath=`echo "$unet_cv_with_dpath" | sed 's%/*$%%'`
549
550 AC_MSG_RESULT([$unet_cv_with_dpath])
551
552 if test x"$unet_cv_with_chroot" != xno; then
553     if echo "$unet_cv_with_dpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
554         unet_dpath=`echo "$unet_cv_with_dpath" | sed "s%^$unet_cv_with_chroot%%"`
555     else
556         AC_MSG_ERROR([Data directory $unet_cv_with_dpath not relative to root directory $unet_cv_with_chroot])
557     fi
558 else
559     unet_dpath=$unet_cv_with_dpath
560 fi
561
562 AC_DEFINE_UNQUOTED(DPATH, "$unet_dpath", [Path to data directory])
563
564 DPATH=$unet_cv_with_dpath
565 AC_SUBST(DPATH)
566
567 dnl --with-cpath allows us to specify the configuration file
568 AC_MSG_CHECKING([where the default configuration file resides])
569 AC_ARG_WITH([cpath],
570 [  --with-cpath=file       Set server configuration file],
571 [unet_cv_with_cpath=$with_cpath],
572 [AC_CACHE_VAL(unet_cv_with_cpath,
573 [unet_cv_with_cpath="ircd.conf"])])
574
575 if test x"$unet_cv_with_cpath" = xyes -o x"$unet_cv_with_cpath" = xno; then
576     unet_cv_with_cpath="ircd.conf"
577 fi
578
579 AC_MSG_RESULT([$unet_cv_with_cpath])
580
581 if echo "$unet_cv_with_cpath" | grep '^/' > /dev/null 2>&1; then
582     # Absolute path; check against chroot stuff
583     if test x"$unet_cv_with_chroot" != xno; then
584         if echo "$unet_cv_with_cpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
585             unet_cpath=`echo "$unet_cv_with_cpath" | sed "s%^$unet_cv_with_chroot%%"`
586         else
587             AC_MSG_ERROR([Configuration file $unet_cv_with_cpath not relative to root directory $unet_cv_with_chroot])
588         fi
589     else
590         unet_cpath=$unet_cv_with_cpath
591     fi
592 else
593     unet_cpath=$unet_cv_with_cpath
594 fi
595
596 AC_DEFINE_UNQUOTED(CPATH, "$unet_cpath", [Configuration file name])
597
598 dnl --with-lpath allows us to specify the default debugging log file
599 AC_MSG_CHECKING([where to put the debugging log if debugging enabled])
600 AC_ARG_WITH([lpath],
601 [  --with-lpath=file       Set the debugging log file],
602 [unet_cv_with_lpath=$with_lpath],
603 [AC_CACHE_VAL(unet_cv_with_lpath,
604 [unet_cv_with_lpath="ircd.log"])])
605
606 if test x"$unet_cv_with_lpath" = xyes -o x"$unet_cv_with_lpath" = xno; then
607     unet_cv_with_lpath="ircd.log"
608 fi
609
610 AC_MSG_RESULT([$unet_cv_with_lpath])
611
612 if echo "$unet_cv_with_lpath" | grep '^/' > /dev/null 2>&1; then
613     # Absolute path; check against chroot stuff
614     if test x"$unet_cv_with_chroot" != xno; then
615         if echo "$unet_cv_with_lpath" | grep "^$unet_cv_with_chroot" > /dev/null 2>&1; then
616             unet_lpath=`echo "$unet_cv_with_lpath" | sed "s%^$unet_cv_with_chroot%%"`
617         else
618             AC_MSG_WARN([Log file $unet_cv_with_lpath not relative to root directory $unet_cv_with_chroot; using default ircd.log instead])
619             unet_cv_with_lpath="ircd.log"
620             unet_lpath="ircd.log"
621         fi
622     else
623         unet_lpath=$unet_cv_with_lpath
624     fi
625 else
626     unet_lpath=$unet_cv_with_lpath
627 fi
628
629 AC_DEFINE_UNQUOTED(LPATH, "$unet_lpath", [Path to debugging log file])
630
631 dnl --with-maxcon allows us to set the maximum connections
632 unet_maxcon=`ulimit -Hn`
633 unet_maxcon=`expr $unet_maxcon - 4`
634 AC_MSG_CHECKING([max connections])
635 AC_ARG_WITH([maxcon],
636 [  --with-maxcon=maxcon    Maximum number of connections server will accept],
637 [unet_cv_with_maxcon=$with_maxcon],
638 [AC_CACHE_VAL(unet_cv_with_maxcon,
639 [unet_cv_with_maxcon=$unet_maxcon])])
640
641 if test x"$unet_cv_with_maxcon" = xyes -o x"$unet_cv_with_maxcon" = xno; then
642     unet_cv_with_maxcon=$unet_maxcon
643 fi
644
645 AC_MSG_RESULT([$unet_cv_with_maxcon])
646
647 AC_DEFINE_UNQUOTED(MAXCONNECTIONS, $unet_cv_with_maxcon,
648 [Maximum number of network connections])
649
650 dnl Finally really generate all output files:
651 AC_OUTPUT(Makefile ircd/Makefile doc/Makefile, [echo timestamp > stamp-h])