]> jfr.im git - irc/unrealircd/unrealircd.git/blob - configure.ac
Create branch unreal33.
[irc/unrealircd/unrealircd.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT([unrealircd], [3.2.8.1], [http://bugs.unrealircd.org/], [], [http://unrealircd.org/])
3 AC_CONFIG_SRCDIR([src/ircd.c])
4 AC_CONFIG_HEADER([include/setup.h])
5 AC_CONFIG_AUX_DIR([autoconf])
6 AC_CONFIG_MACRO_DIR([autoconf/m4])
7
8 if test "x$enable_dynamic_linking" = "x"; then
9 echo "Please use ./Config instead of ./configure"
10 exit 1
11 fi
12
13 AC_PROG_CC
14 if test "$ac_cv_prog_gcc" = "yes"; then
15 CFLAGS="$CFLAGS -funsigned-char"
16 AC_CACHE_CHECK(if gcc has a working -pipe, ac_cv_pipe, [
17 save_cflags="$CFLAGS"
18 CFLAGS="$CFLAGS -pipe"
19 AC_TRY_COMPILE(,, ac_cv_pipe="yes", ac_cv_pipe="no")
20 CFLAGS="$save_cflags"
21 ])
22 if test "$ac_cv_pipe" = "yes"; then
23 CFLAGS="-pipe $CFLAGS"
24 fi
25 fi
26
27 dnl (the gcc flag detection trick is taken from xemacs/Vin Shelton)
28
29 dnl UnrealIRCd might not be strict-aliasing safe at this time
30 case "`$CC -v --help 2>&1`" in
31 *-fstrict-aliasing* ) CFLAGS="$CFLAGS -fno-strict-aliasing" ;;
32 esac
33
34 dnl Pointer signedness warnings are really a pain and 99.9% of the time
35 dnl they are of absolutely no use whatsoever. IMO the person who decided
36 dnl to enable this without -Wall should be shot on sight.
37 case "`$CC -v --help 2>&1`" in
38 *-Wpointer-sign* ) CFLAGS="$CFLAGS -Wno-pointer-sign" ;;
39 esac
40
41 AC_PATH_PROG(RM,rm)
42 AC_PATH_PROG(CP,cp)
43 AC_PATH_PROG(TOUCH,touch)
44 AC_PATH_PROG(OPENSSLPATH,openssl)
45 AC_PATH_PROG(INSTALL,install)
46 AC_CHECK_PROG(MAKER, gmake, gmake, make)
47 AC_PATH_PROG(GMAKE,gmake)
48 AC_PATH_PROG(GUNZIP, gunzip)
49 AC_PATH_PROG(PKGCONFIG, pkg-config)
50
51 dnl Checks for libraries.
52 AC_CHECK_LIB(descrypt, crypt,
53 [AC_DEFINE([HAVE_CRYPT], [], [Define if you have crypt])
54 IRCDLIBS="$IRCDLIBS-ldescrypt "
55 MKPASSWDLIBS="-ldescrypt"],
56 [AC_CHECK_LIB(crypt, crypt,
57 [AC_DEFINE([HAVE_CRYPT], [], [Define if you have crypt])
58 IRCDLIBS="$IRCDLIBS-lcrypt "
59 MKPASSWDLIBS="-lcrypt"])])
60 AC_CHECK_LIB(socket, socket,
61 [IRCDLIBS="$IRCDLIBS-lsocket "
62 SOCKLIB="-lsocket"])
63 AC_CHECK_LIB(nsl, inet_ntoa,
64 [IRCDLIBS="$IRCDLIBS-lnsl "
65 INETLIB="-lnsl"])
66
67 AC_SUBST(IRCDLIBS)
68 AC_SUBST(MKPASSWDLIBS)
69
70 dnl module checking based on Hyb7's module checking code
71 AC_DEFUN([AC_ENABLE_DYN],
72 [
73 AC_CHECK_FUNC(dlopen,, [AC_CHECK_LIB(dl, dlopen,IRCDLIBS="$IRCDLIBS -ldl",
74 [
75 AC_MSG_WARN(Dynamic linking is not enabled because dlopen was not found)
76 AC_DEFINE(STATIC_LINKING)
77 ])])
78
79 hold_cflags=$CFLAGS
80 CFLAGS="$CFLAGS -export-dynamic"
81 AC_CACHE_CHECK(if we need the -export-dynamic flag, ac_cv_export_dynamic, [
82 AC_TRY_LINK(, [int i];, ac_cv_export_dynamic=yes, ac_cv_export_dynamic=no)])
83 if test "$ac_cv_export_dynamic" = "no"; then
84 CFLAGS=$hold_cflags
85 fi
86
87 AC_CACHE_CHECK(for compiler option to produce PIC,ac_cv_pic,[
88 if test "$ac_cv_prog_gcc" = "yes"; then
89 ac_cv_pic="-fPIC -DPIC -shared"
90 case `uname -s` in
91 Darwin*[)]
92 ac_cv_pic="-bundle -flat_namespace -undefined suppress"
93 ;;
94 HP-UX*[)]
95 ac_cv_pic="-fPIC"
96 ;;
97 esac
98 else
99 case `uname -s` in
100 SunOS*[)]
101 ac_cv_pic="-KPIC -DPIC -G"
102 ;;
103 esac
104 fi
105 ])
106 AC_CACHE_CHECK(if your system prepends an underscore on symbols,ac_cv_underscore,[
107 cat >uscore.c << __EOF__
108 int main() {
109 return 0;
110 }
111 __EOF__
112 $CC -o uscore $CFLAGS uscore.c 1>&5
113 if test -z "`strings -a uscore |grep '^_main$'`"; then
114 ac_cv_underscore=no
115 else
116 ac_cv_underscore=yes
117 fi
118 rm -f uscore uscore.c
119 ])
120 dnl libtool has built-in tests that determine proper underscorage
121 if test "$ac_cv_underscore" = "yes"; then
122 AC_DEFINE([UNDERSCORE], [], [Define if your system prepends an underscore to symbols])
123 fi
124
125 MODULEFLAGS=$ac_cv_pic
126 dnl DYNAMIC_LINKING is not meant to be defined in include/setup.h, it's
127 dnl defined in the Makefiles using -D. Having it defined globally will
128 dnl only cause braindamage and symbol collisions :-D.
129 dnl AC_DEFINE([DYNAMIC_LINKING], [], [Link dynamically as opposed to statically. (Dynamic linking is the only supported method of linking atm)])
130 ])
131 AC_DEFUN([AC_ENABLE_INET6],[
132 AC_CACHE_CHECK([if your system has IPv6 support], [ac_cv_ip6], [
133 save_libs="$LIBS"
134 LIBS="$LIBS $SOCKLIB"
135 AC_TRY_RUN([
136 #include <sys/types.h>
137 #include <sys/socket.h>
138 int main() {
139 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
140 exit(1);
141 exit(0);
142 }
143 ],
144 [ac_cv_ip6=yes],
145 [ac_cv_ip6=no])
146 ])
147 if test "$ac_cv_ip6" = "no"; then
148 AC_MSG_ERROR([Your system does not support IPv6 so it will not be enabled])
149 else
150 AC_DEFINE([INET6], [], [Define if you want IPv6 enabled])
151 dnl in6addr_any detection code taken from ratbox
152 AC_MSG_CHECKING([for struct in6addr_any])
153 AC_COMPILE_IFELSE(
154 [AC_LANG_PROGRAM(
155 [[#define IN_AUTOCONF
156 #include <sys/types.h>
157 #include <sys/socket.h>
158 #include <netinet/in.h>]],
159 [[struct in6_addr a = in6addr_any;]]
160 )],
161 [AC_MSG_RESULT(yes)],
162 [
163 AC_MSG_RESULT([no])
164 AC_DEFINE([NO_IN6ADDR_ANY], [1], [Define to 1 if your system has no in6addr_any.])
165 ]
166 )
167 fi
168 LIBS="$save_libs"
169 ])
170
171 AC_CHECK_HEADER(sys/param.h,
172 AC_DEFINE([PARAMH], [], [Define if you have the <sys/param.h> header file.]))
173 AC_CHECK_HEADER(stdlib.h,
174 AC_DEFINE([STDLIBH], [], [Define if you have the <stdlib.h> header file.]))
175 AC_CHECK_HEADER(stddef.h,
176 AC_DEFINE([STDDEFH], [], [Define if you have the <stddef.h> header file.]))
177 AC_CHECK_HEADER(sys/syslog.h,
178 AC_DEFINE([SYSSYSLOGH], [], [Define if you have the <sys/syslog.h> header file.]))
179 AC_CHECK_HEADER(unistd.h,
180 AC_DEFINE([UNISTDH], [], [Define if you have the <unistd.h> header file.]))
181 AC_CHECK_HEADER(string.h,
182 AC_DEFINE([STRINGH], [], [Define if you have the <string.h> header file.]))
183 AC_CHECK_HEADER(strings.h,
184 AC_DEFINE([STRINGSH], [], [Define if you have the <strings.h> header file.]))
185 AC_CHECK_HEADER(malloc.h,
186 AC_DEFINE([MALLOCH], [<malloc.h>], [Define to <malloc.h> you need malloc.h.]))
187 AC_CHECK_HEADER(sys/rusage.h,
188 AC_DEFINE([RUSAGEH], [], [Define if you have the <sys/rusage.h> header file.]))
189 AC_CHECK_HEADER(glob.h,
190 AC_DEFINE([GLOBH], [], [Define if you have the <glob.h> header file.]))
191 AC_CHECK_HEADERS([stdint.h inttypes.h])
192 dnl Checks for typedefs, structures, and compiler characteristics.
193 AC_C_CONST
194 AC_C_INLINE
195
196 AC_TYPE_MODE_T
197 AC_TYPE_SIZE_T
198 AC_TYPE_INTPTR_T
199
200 AC_HEADER_TIME
201 AC_STRUCT_TM
202 AC_TYPE_UID_T
203 unreal_CHECK_TYPE_SIZES
204
205 dnl in the future, it would be nice to avoid AC_TRY_RUN to allow
206 dnl better support for crosscompiling.
207 AC_CACHE_CHECK([what kind of nonblocking sockets you have], [ac_cv_nonblocking],[
208 save_libs="$LIBS"
209 LIBS="$LIBS $SOCKLIB"
210 AC_TRY_RUN([
211 #include <sys/types.h>
212 #include <sys/socket.h>
213 #include <fcntl.h>
214 #include <sys/ioctl.h>
215 #include <sys/file.h>
216 #include <signal.h>
217 alarmed() {
218 exit(1);
219 }
220 int main() {
221 #ifdef O_NONBLOCK
222 char b[12], x[32];
223 int f, l = sizeof(x);
224 f = socket(AF_INET, SOCK_DGRAM, 0);
225 if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK))) {
226 signal(SIGALRM, alarmed);
227 alarm(3);
228 recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
229 alarm(0);
230 exit(0);
231 }
232 #endif
233 exit(1);
234 }
235 ],ac_cv_nonblocking=O_NONBLOCK,[
236 AC_TRY_RUN([
237 #include <sys/types.h>
238 #include <sys/socket.h>
239 #include <fcntl.h>
240 #include <sys/ioctl.h>
241 #include <sys/file.h>
242 #include <signal.h>
243 alarmed() {
244 exit(0);
245 }
246 int main() {
247 #ifdef O_NDELAY
248 char b[12], x[32];
249 int f, l = sizeof(x);
250 f = socket(AF_INET, SOCK_DGRAM, 0);
251 if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY))) {
252 signal(SIGALRM, alarmed);
253 alarm(3);
254 recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
255 alarm(0);
256 exit(0);
257 }
258 #endif
259 exit(1);
260 }],ac_cv_nonblocking=O_NDELAY,[
261 AC_TRY_RUN([
262 #include <sys/types.h>
263 #include <sys/socket.h>
264 #include <fcntl.h>
265 #include <sys/ioctl.h>
266 #include <sys/file.h>
267 #include <signal.h>
268 alarmed() {
269 exit(1);
270 }
271 int main() {
272 #ifdef FIONBIO
273 char b[12], x[32];
274 int f, l = sizeof(x);
275 f = socket(AF_INET, SOCK_DGRAM, 0);
276 if (f >= 0 && !(fcntl(f, F_SETFL, FIONBIO))) {
277 signal(SIGALRM, alarmed);
278 alarm(3);
279 recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
280 alarm(0);
281 exit(0);
282 }
283 #endif
284 exit(1);
285 ], ac_cv_nonblocking=FIONBIO,ac_cv_nonblocking=none)])])])
286 if test "$ac_cv_nonblocking" = "O_NONBLOCK"; then
287 AC_DEFINE([NBLOCK_POSIX], [], [Define if you have O_NONBLOCK])
288 elif test "$ac_cv_nonblocking" = "O_NDELAY"; then
289 AC_DEFINE([NBLOCK_BSD], [], [Define if you have O_NDELAY])
290 elif test "$ac_cv_nonblocking" = "FIONBIO"; then
291 AC_DEFINE([NBLOCK_SYSV], [], [Define if you have FIONBIO])
292 fi
293 LIBS="$save_libs"
294 dnl Checks for library functions.
295 AC_PROG_GCC_TRADITIONAL
296 AC_FUNC_SETPGRP
297 AC_FUNC_SETVBUF_REVERSED
298 AC_FUNC_ALLOCA
299 AC_CHECK_FUNCS(snprintf,
300 AC_DEFINE([HAVE_SNPRINTF], [], [Define if you have snprintf]))
301 AC_CHECK_FUNCS(vsnprintf,
302 AC_DEFINE([HAVE_VSNPRINTF], [], [Define if you have vsnprintf]))
303 AC_CHECK_FUNCS(strlcpy,
304 AC_DEFINE([HAVE_STRLCPY], [], [Define if you have strlcpy. Otherwise, an internal implementation will be used!]))
305 AC_CHECK_FUNCS(strlcat,
306 AC_DEFINE([HAVE_STRLCAT], [], [Define if you have strlcat]))
307 AC_CHECK_FUNCS(strlncat,
308 AC_DEFINE([HAVE_STRLNCAT], [], [Define if you have strlncat]))
309 AC_CHECK_FUNCS(inet_pton,
310 AC_DEFINE([HAVE_INET_PTON], [], [Define if you have inet_pton]))
311 AC_CHECK_FUNCS(inet_ntop,
312 AC_DEFINE([HAVE_INET_NTOP], [], [Define if you have inet_ntop]))
313 dnl Check if it supports C99 style variable length arrays
314 AC_CACHE_CHECK([if C99 variable length arrays are supported], [ac_cv_varlen_arrays], [
315 AC_TRY_COMPILE(,[
316 int main() {
317 int i = 5;
318 int a[i];
319 a[0] = 1;
320 return 0;
321 }], ac_cv_varlen_arrays=yes, ac_cv_varlen_arrays=no)
322 ])
323 if test "$ac_cv_varlen_arrays" = "yes" ; then
324 AC_DEFINE([HAVE_C99_VARLEN_ARRAY], [], [Define if you have a compiler with C99 variable length array support])
325 fi
326
327 dnl This check doesn't need to be in ./configure, we can
328 dnl write the sourcecode to actually handle the return value
329 dnl of setrlimit if necessary... -- ohnobinki
330 AC_CACHE_CHECK([if we can set the core size to unlimited], [ac_cv_force_core], [
331 AC_TRY_RUN([
332 #include <sys/time.h>
333 #include <sys/resource.h>
334 #include <unistd.h>
335 int main() {
336 struct rlimit corelim;
337 corelim.rlim_cur = corelim.rlim_max = RLIM_INFINITY;
338 if (setrlimit(RLIMIT_CORE, &corelim))
339 exit(1);
340 exit(0);
341 }
342 ],ac_cv_force_core=yes,ac_cv_force_core=no)
343 ])
344 if test "$ac_cv_force_core" = "yes"; then
345 AC_DEFINE([FORCE_CORE], [], [Define if you can set the core size to unlimited])
346 fi
347 AC_FUNC_VPRINTF
348 AC_CHECK_FUNCS([gettimeofday],
349 [AC_DEFINE([GETTIMEOFDAY], [], [Define if you have gettimeofday])],
350 [AC_CHECK_FUNCS([lrand48],
351 [AC_DEFINE([LRADN48], [], [Define if you have lrand48])])])
352 AC_CHECK_FUNCS([getrusage],
353 [AC_DEFINE([GETRUSAGE_2], [], [Define if you have getrusage])],
354 [AC_CHECK_FUNCS([times],
355 [AC_DEFINE([TIMES_2], [], [Define if you have times])])])
356 AC_CHECK_FUNCS([setproctitle],
357 [AC_DEFINE([HAVE_SETPROCTITLE], [], [Define if you have setproctitle])],
358 [AC_CHECK_LIB([util],
359 [setproctitle],
360 [AC_DEFINE([HAVE_SETPROCTITLE], [], [Define if you have setproctitle])
361 IRCDLIBS="$IRCDLIBS-lutil"],
362 [
363 AC_EGREP_HEADER([#define.*PS_STRINGS.*],[sys/exec.h],
364 [AC_DEFINE([HAVE_PSSTRINGS],[], [Define if you have PS_STRINGS])],
365 [AC_CHECK_FUNCS([pstat],
366 [AC_DEFINE([HAVE_PSTAT], [], [Define if you have pstat])])])
367 ])
368 ]
369 )
370
371
372 AC_CACHE_CHECK([what type of signals you have], [ac_cv_sigtype], [
373 AC_TRY_RUN([
374 #include <signal.h>
375 int main() {
376 sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L);
377 }
378 ], ac_cv_sigtype=POSIX, [
379 AC_TRY_RUN([
380 #include <signal.h>
381 int calls = 0;
382 void handler()
383 {
384 if (calls)
385 return;
386 calls++;
387 kill(getpid(), SIGTERM);
388 sleep(1);
389 }
390
391 int main() {
392 signal(SIGTERM, handler);
393 kill(getpid(), SIGTERM);
394 exit(0);
395 }
396 ], ac_cv_sigtype=BSD,ac_cv_sigtype=SYSV)])])
397
398 if test "$ac_cv_sigtype" = "POSIX"; then
399 AC_DEFINE([POSIX_SIGNALS], [], [Define if you have POSIX signals])
400 elif test "$ac_cv_sigtype" = "BSD"; then
401 AC_DEFINE([BSD_RELIABLE_SIGNALS], [], [Define if you have BSD signals])
402 else
403 AC_DEFINE([SYSV_UNRELIABLE_SIGNALS], [], [Define if you have SYSV signals])
404 fi
405 AC_CHECK_FUNCS(strtoken,,AC_DEFINE([NEED_STRTOKEN], [], [Define if you need the strtoken function.]))
406 AC_CHECK_FUNCS(strtok,,AC_DEFINE([NEED_STRTOK], [], [Define if you need the strtok function.]))
407 AC_CHECK_FUNCS(strerror,,AC_DEFINE([NEED_STRERROR], [], [Define if you need the strerror function.]))
408 AC_CHECK_FUNCS(index,,AC_DEFINE([NOINDEX], [], [Define if you do not have the index function.]))
409 AC_CHECK_FUNCS(strtoul,,STRTOUL="strtoul.o")
410 AC_CHECK_FUNCS(bcopy,,AC_DEFINE([NEED_BCOPY], [], [Define if you don't have bcopy]))
411 AC_CHECK_FUNCS(bcmp,,AC_DEFINE([NEED_BCMP], [], [Define if you don't have bcmp]))
412 AC_CHECK_FUNCS(bzero,,AC_DEFINE([NEED_BZERO], [], [Define if you need bzero]))
413 AC_CHECK_FUNCS(strcasecmp,AC_DEFINE([GOT_STRCASECMP], [], [Define if you have strcasecmp]))
414 save_libs="$LIBS"
415 LIBS="$LIBS $SOCKLIB $INETLIB"
416 AC_CHECK_FUNCS(inet_addr,,AC_DEFINE([NEED_INET_ADDR], [], [Define if you need inet_addr]))
417 AC_CHECK_FUNCS(inet_ntoa,,AC_DEFINE([NEED_INET_NTOA], [], [Define if you need inet_ntoa]))
418 AC_CHECK_FUNCS(inet_netof,,AC_DEFINE([NEED_INET_NETOF], [], [Define if you need inet_netof]))
419 LIBS="$save_libs"
420 AC_CHECK_FUNCS(syslog,AC_DEFINE([HAVE_SYSLOG], [], [Define if you have syslog]))
421 AC_CHECK_FUNCS(vsyslog,AC_DEFINE([HAVE_VSYSLOG], [], [Define if you have vsyslog]))
422 AC_SUBST(STRTOUL)
423 AC_SUBST(CRYPTOLIB)
424 AC_SUBST(MODULEFLAGS)
425 AC_ARG_WITH(listen, [AS_HELP_STRING([--with-listen=backlog],[Specify the listen backlog value])],
426 [AC_DEFINE_UNQUOTED([LISTEN_SIZE], [$withval], [Set to the listen backlog size you want])],
427 [AC_DEFINE([LISTEN_SIZE], [5], [Set to the listen backlog size you want])])
428 AC_ARG_WITH(nick-history, [AS_HELP_STRING([--with-nick-history=length],[Specify the length of the nickname history])],
429 [AC_DEFINE_UNQUOTED([NICKNAMEHISTORYLENGTH], [$withval], [Set to the nickname history length you want])],
430 [AC_DEFINE([NICKNAMEHISTORYLENGTH], [2000], [Set to the nickname history length you want])])
431 AC_ARG_WITH([sendq], [AS_HELP_STRING([--with-sendq=maxsendq],[Specify the max sendq for the server])],
432 [AC_DEFINE_UNQUOTED([MAXSENDQLENGTH], [$withval], [Set to the max sendq you want])],
433 [AC_DEFINE([MAXSENDQLENGTH], [3000000], [Set to the max sendq you want])])
434 AC_ARG_WITH(bufferpool, [AS_HELP_STRING([--with-bufferpool=size],[Specify the size of the buffer pool])],
435 [AC_DEFINE_UNQUOTED([BUFFERPOOL],[($withval * MAXSENDQLENGTH)], [Set to the bufferpool size you want])],
436 [AC_DEFINE([BUFFERPOOL],[(18 * MAXSENDQLENGTH)], [Set to the bufferpool size you want])])
437 AC_ARG_WITH(permissions, [AS_HELP_STRING([--with-permissions=permissions], [Specify the default permissions for
438 configuration files])],
439 dnl We have an apparently out-of-place 0 here because of a MacOSX bug and because
440 dnl we assume that a user thinks that `chmod 0600 blah' is the same as `chmod 600 blah'
441 dnl (#3189)
442 [AC_DEFINE_UNQUOTED([DEFAULT_PERMISSIONS], [0$withval], [The default permissions for configuration files. Set to 0 to prevent unrealircd from calling chmod() on the files.])],
443 [AC_DEFINE([DEFAULT_PERMISSIONS], [0600], [The default permissions for configuration files. Set to 0 to prevent unrealircd from calling chmod() on the files.])])
444 AC_ARG_WITH(dpath, [AS_HELP_STRING([--with-dpath=path],[Specify the path where configuration files are stored])],
445 [AC_DEFINE_UNQUOTED([DPATH], ["$withval"], [Define the location of the configuration files])
446 IRCDDIR="$withval"],
447 [AC_DEFINE_UNQUOTED([DPATH], ["`pwd`"], [Define the location of the configuration files])
448 IRCDDIR="`pwd`"])
449
450 AC_ARG_WITH(fd-setsize, [AS_HELP_STRING([--with-fd-setsize=size], [Specify the max file descriptors to use])],
451 [ac_fd=$withval],
452 [ac_fd=1024])
453 AC_DEFINE_UNQUOTED([MAXCONNECTIONS], [$ac_fd], [Set to the max connections you want])
454
455 dnl It would be nice if this could just respect --bindir like every other
456 dnl program does someday... -- ohnobinki
457 AC_ARG_WITH(spath, [AS_HELP_STRING([--with-spath],[Specify the location of the executable])],
458 [AC_DEFINE_UNQUOTED([SPATH], ["$withval"], [Define the location of the executable])
459 BINDIR="$withval"],
460 [AC_DEFINE_UNQUOTED([SPATH], ["`pwd`/src/ircd"], [Define the location of the executable])
461 BINDIR="`pwd`/src/ircd"])
462
463 # enable nospoof by default; protects against javascript POST attacks and much more ;-)
464 AC_ARG_ENABLE([nospoof],
465 [AS_HELP_STRING([--disable-nospoof], [Disable spoofing protection (requires clients to respond to a randomly generated PING packet after USER and NICK but before using other commands)])],
466 [],
467 [enable_nospoof=yes])
468 AS_IF([test $enable_nospoof = "yes"],
469 [AC_DEFINE([NOSPOOF], [], [Define if you want spoof protection])])
470
471 AC_ARG_ENABLE([prefixaq],
472 [AS_HELP_STRING([--disable-prefixaq],[Enable chanadmin (+a) and chanowner (+q) prefixes])],
473 [],
474 [enable_prefixaq=yes])
475 AS_IF([test $enable_prefixaq = "yes"],
476 [AC_DEFINE([PREFIX_AQ], [], [Define if you want +a/+q prefixes])])
477
478 AC_ARG_WITH(showlistmodes,
479 [AS_HELP_STRING([--with-showlistmodes], [Specify whether modes are shown in /list])],
480 [AS_IF([test $withval = "yes"],
481 [AC_DEFINE([LIST_SHOW_MODES], [], [Define if you want modes shown in /list])])])
482 AC_ARG_WITH(topicisnuhost, [AS_HELP_STRING([--with-topicisnuhost], [Display nick!user@host as the topic setter])],
483 [AS_IF([test $withval = "yes"],
484 [AC_DEFINE([TOPIC_NICK_IS_NUHOST], [], [Define if you want nick!user@host shown for the topic setter])])])
485 AC_ARG_WITH(shunnotices, [AS_HELP_STRING([--with-shunnotices], [Notify a user when he/she is no longer shunned])],
486 [AS_IF([test $withval = "yes"],
487 [AC_DEFINE([SHUN_NOTICES], [], [Define if you want users to be notified when their shun is removed])])])
488 AC_ARG_WITH(no-operoverride, [AS_HELP_STRING([--with-no-operoverride], [Disable OperOverride])],
489 [AS_IF([test $withval = "yes"],
490 [AC_DEFINE([NO_OPEROVERRIDE], [], [Define if you want OperOverride disabled])])])
491 AC_ARG_WITH(disableusermod, [AS_HELP_STRING([--with-disableusermod], [Disable /set* and /chg*])],
492 [AS_IF([test $withval = "yes"],
493 [AC_DEFINE([DISABLE_USERMOD], [], [Define if you want to disable /set* and /chg*])])])
494 AC_ARG_WITH(operoverride-verify, [AS_HELP_STRING([--with-operoverride-verify], [Require opers to invite themselves to +s/+p channels])],
495 [AS_IF([test $withval = "yes"],
496 [AC_DEFINE([OPEROVERRIDE_VERIFY], [], [Define if you want opers to have to use /invite to join +s/+p channels])])])
497 AC_ARG_WITH(disable-extendedban-stacking, [AS_HELP_STRING([--with-disable-extendedban-stacking], [Disable extended ban stacking])],
498 [AS_IF([test $withval = "yes"],
499 [AC_DEFINE([DISABLE_STACKED_EXTBANS], [], [Define to disable extended ban stacking (~q:~c:\#chan, etc)])])])
500 AC_ARG_WITH(system-tre, [AS_HELP_STRING([--with-system-tre], [Use the system tre package instead of bundled, discovered using pkg-config])], [], [with_system_tre=no])
501 AC_ARG_WITH(system-cares, [AS_HELP_STRING([--with-system-cares], [Use the system c-ares (at least version 1.6.0) package instead of bundled c-ares, discovered using pkg-config])], [], [with_system_cares=no])
502 CHECK_SSL
503 CHECK_ZLIB
504 AC_ARG_ENABLE(dynamic-linking, [AS_HELP_STRING([--disable-dynamic-linking], [Make the IRCd statically link with shared objects rather than dynamically (noone knows if disabling dynamic linking actually does anything or not)])],
505 [enable_dynamic_linking=$enableval], [enable_dynamic_linking="yes"])
506 AS_IF([test $enable_dynamic_linking = "yes"],
507 [AC_ENABLE_DYN],
508 [AC_DEFINE([STATIC_LINKING], [], [Link... statically(?) (defining this macro will probably cause the build tofail)])])
509
510 AC_ARG_ENABLE([inet6], [AS_HELP_STRING([--enable-inet6], [Make the IRCd support IPv6])],
511 [AS_IF([test $enableval = "yes"],
512 [AC_ENABLE_INET6])])
513 AC_SUBST(IRCDDIR)
514 AC_SUBST(BINDIR)
515 AC_MSG_CHECKING([if FD_SETSIZE is large enough to allow $ac_fd file descriptors])
516 AC_COMPILE_IFELSE([
517 #include <sys/types.h>
518 #include <sys/time.h>
519 int main() {
520 #if FD_SETSIZE < $ac_fd
521 #error FD_SETSIZE is smaller than $ac_fd
522 #endif
523 exit(0);
524 }
525 ], AC_MSG_RESULT([yes]), [
526 # must be passed on the commandline to avoid a ``warning, you redefined something''
527 FD_SETSIZE="-DFD_SETSIZE=$ac_fd"
528 AC_MSG_RESULT(no)
529 ])
530 AC_SUBST([FD_SETSIZE])
531
532 case `uname -s` in
533 *SunOS*|*solaris*)
534 AC_DEFINE([_SOLARIS], [], [Define if you are compiling unrealircd on Sun's (or Oracle's?) Solaris])
535 IRCDLIBS="$IRCDLIBS -lresolv "
536 ;;
537 esac
538
539 dnl c-ares needs PATH_SEPARATOR set or it will
540 dnl fail on certain solaris boxes. We might as
541 dnl well set it here.
542 export PATH_SEPARATOR
543
544 AS_IF([test "x$with_system_tre" = "xno"],[
545 dnl REMEMBER TO CHANGE WITH A NEW TRE RELEASE!
546 tre_version="0.8.0"
547 AC_MSG_RESULT(extracting TRE regex library)
548 cur_dir=`pwd`
549 cd extras
550 dnl remove old tre directory to force a recompile...
551 dnl and remove its installation prefix just to clean things up.
552 rm -rf tre-$tre_version rege[]xp
553 if test "x$ac_cv_path_GUNZIP" = "x" ; then
554 tar xfz tre.tar.gz
555 else
556 cp tre.tar.gz tre.tar.gz.bak
557 gunzip -f tre.tar.gz
558 cp tre.tar.gz.bak tre.tar.gz
559 tar xf tre.tar
560 fi
561 AC_MSG_RESULT(configuring TRE regex library)
562 cd tre-$tre_version
563 ./configure --disable-agrep --disable-shared --disable-system-abi --disable-wchar --disable-multibyte --prefix=$cur_dir/extras/regexp || exit 1
564 AC_MSG_RESULT(compiling TRE regex library)
565 $ac_cv_prog_MAKER || exit 1
566 AC_MSG_RESULT(installing TRE regex library)
567 $ac_cv_prog_MAKER install || exit 1
568 TRE_CFLAGS="-I$cur_dir/extras/regexp/include"
569 AC_SUBST(TRE_CFLAGS)
570
571 TRE_LIBS=
572 dnl See c-ares's compilation section for more info on this hack.
573 dnl ensure that we're linking against the bundled version of tre
574 dnl (we only reach this code if linking against the bundled version is desired).
575 AS_IF([test -n "$ac_cv_path_PKGCONFIG"],
576 [TRE_LIBS="`$ac_cv_path_PKGCONFIG --static --libs tre.pc | sed ['s,-L\([^ ]\+lib\) -ltre,\1/libtre.a,']`"])
577 dnl For when pkg-config isn't available -- or for when pkg-config
578 dnl doesn't see the tre.pc file somehow... (#3982)
579 AS_IF([test -z "$TRE_LIBS"],
580 [TRE_LIBS="../extras/regexp/lib/libtre.a"])
581 AC_SUBST(TRE_LIBS)
582 cd $cur_dir
583 ],[
584 dnl use pkgconfig for tre:
585 PKG_CHECK_MODULES([TRE], tre >= 0.7.5)
586 ])
587
588 AS_IF([test "x$with_system_cares" = "xno"],[
589 dnl REMEMBER TO CHANGE WITH A NEW C-ARES RELEASE!
590 dnl NOTE: when changing this here, ALSO change it in ./curlinstall
591 dnl and in the comment in this file around line 400!
592 cares_version="1.7.3"
593 AC_MSG_RESULT(extracting c-ares resolver library)
594 cur_dir=`pwd`
595 cd extras
596 dnl remove old c-ares directory to force a recompile...
597 rm -rf c-ares-$cares_version c-ares
598 if test "x$ac_cv_path_GUNZIP" = "x" ; then
599 tar xfz c-ares.tar.gz
600 else
601 cp c-ares.tar.gz c-ares.tar.gz.bak
602 gunzip -f c-ares.tar.gz
603 cp c-ares.tar.gz.bak c-ares.tar.gz
604 tar xf c-ares.tar
605 fi
606 AC_MSG_RESULT(configuring c-ares library)
607 cd c-ares-$cares_version
608 ./configure --prefix=$cur_dir/extras/c-ares --disable-shared || exit 1
609 AC_MSG_RESULT(compiling c-ares resolver library)
610 $ac_cv_prog_MAKER || exit 1
611 AC_MSG_RESULT(installing c-ares resolver library)
612 $ac_cv_prog_MAKER install || exit 1
613 CARES_CFLAGS="-I$cur_dir/extras/c-ares/include"
614 AC_SUBST(CARES_CFLAGS)
615 CARES_LIBS="-L../extras/c-ares/lib"
616
617 dnl Set default library parameters for when pkg-config is not available
618 dnl Ugly cd'ing out of extras/c-ares-xxx ;)
619 dnl Note: must be a full path, not relative path.
620 cd ../..
621 CARESLIBSALT="`pwd`/extras/c-ares/lib/libcares.a"
622 cd -
623 case `uname -s` in
624 *FreeBSD*)
625 CARESLIBSALT="$CARESLIBSALT"
626 ;;
627 *Linux*)
628 CARESLIBSALT="$CARESLIBSALT -lrt"
629 ;;
630 *SunOS*)
631 CARESLIBSALT="$CARESLIBSALT -lrt"
632 ;;
633 esac
634
635 dnl Use pkg-config for c-ares libraries, and if not available use defaults
636 dnl from above. Also, if pkg-config returns an empty result (ex: on fbsd
637 dnl or older versions it might be missing --static) then also use defaults.
638 if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
639 CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
640 else
641 CARES_LIBSPRE="$CARES_LIBS"
642 dnl the sed expression forces an absolute path to the .a file to be generated
643 dnl because this is what libtool would do. If this wasn't done and /usr/lib*/libcares.so
644 dnl exists, then unrealircd would still try to link against the system c-ares.
645 dnl The [] quotation is needed because the sed expression has [] in it.
646 [CARES_LIBS="$CARES_LIBS `$ac_cv_path_PKGCONFIG --static --libs libcares.pc | sed -e 's,-L\([^ ]\+lib\) -lcares,\1/libcares.a,'`"]
647 if test "$CARES_LIBS" = "$CARES_LIBSPRE " ; then
648 CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
649 fi
650 fi
651 AC_SUBST(CARES_LIBS)
652 cd $cur_dir
653 ],[
654 dnl use pkg-config for system c-ares:
655 PKG_CHECK_MODULES([CARES], libcares >= 1.6.0)
656 ])
657
658 CHECK_LIBCURL
659
660 AC_CONFIG_FILES([Makefile
661 src/modules/Makefile
662 unreal
663 ircdcron/ircdchk
664 ircdcron/ircd.cron])
665 AC_OUTPUT
666 chmod 0700 unreal
667 chmod 0700 ircdcron/ircdchk