]> jfr.im git - irc/unrealircd/unrealircd.git/blob - configure.ac
Fix rare crash if deleting spamfilter by id that isn't a spamfilter.
[irc/unrealircd/unrealircd.git] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 dnl When updating the version, remember to update the following files
4 dnl appropriately:
5 dnl
6 dnl include/win32/setup.h
7 dnl src/win32/unrealinst.iss
8 dnl .CHANGES.NEW
9 dnl src/version.c.SH
10
11 AC_INIT([unrealircd], [4.0.19-rc2], [http://bugs.unrealircd.org/], [], [http://unrealircd.org/])
12 AC_CONFIG_SRCDIR([src/ircd.c])
13 AC_CONFIG_HEADER([include/setup.h])
14 AC_CONFIG_AUX_DIR([autoconf])
15 AC_CONFIG_MACRO_DIR([autoconf/m4])
16
17 if test "x$enable_dynamic_linking" = "x"; then
18 echo "Please use ./Config instead of ./configure"
19 exit 1
20 fi
21
22 dnl Save CFLAGS, use this when building the libraries like c-ares
23 orig_cflags="$CFLAGS"
24
25 dnl Save build directory early on (used in our m4 macros too)
26 BUILDDIR="`pwd`"
27 AC_SUBST(BUILDDIR)
28
29 dnl Calculate the versions. Perhaps the use of expr is a little too extravagant
30 # Generation version number (e.g.: X in X.Y.Z)
31 UNREAL_VERSION_GENERATION=["4"]
32 AC_DEFINE_UNQUOTED([UNREAL_VERSION_GENERATION], [$UNREAL_VERSION_GENERATION], [Generation version number (e.g.: X for X.Y.Z)])
33
34 # Major version number (e.g.: Y in X.Y.Z)
35 UNREAL_VERSION_MAJOR=["0"]
36 AC_DEFINE_UNQUOTED([UNREAL_VERSION_MAJOR], [$UNREAL_VERSION_MAJOR], [Major version number (e.g.: Y for X.Y.Z)])
37
38 # Minor version number (e.g.: Z in X.Y.Z)
39 UNREAL_VERSION_MINOR=["19"]
40 AC_DEFINE_UNQUOTED([UNREAL_VERSION_MINOR], [$UNREAL_VERSION_MINOR], [Minor version number (e.g.: Z for X.Y.Z)])
41
42 # The version suffix such as a beta marker or release candidate
43 # marker. (e.g.: -rcX for unrealircd-3.2.9-rcX). This macro is a
44 # string instead of an integer because it contains arbitrary data.
45 UNREAL_VERSION_SUFFIX=["-rc2"]
46 AC_DEFINE_UNQUOTED([UNREAL_VERSION_SUFFIX], ["$UNREAL_VERSION_SUFFIX"], [Version suffix such as a beta marker or release candidate marker. (e.g.: -rcX for unrealircd-3.2.9-rcX)])
47
48 AC_PROG_CC
49 if test "$ac_cv_prog_gcc" = "yes"; then
50 CFLAGS="$CFLAGS -funsigned-char"
51 AC_CACHE_CHECK(if gcc has a working -pipe, ac_cv_pipe, [
52 save_cflags="$CFLAGS"
53 CFLAGS="$CFLAGS -pipe"
54 AC_TRY_COMPILE(,, ac_cv_pipe="yes", ac_cv_pipe="no")
55 CFLAGS="$save_cflags"
56 ])
57 if test "$ac_cv_pipe" = "yes"; then
58 CFLAGS="-pipe $CFLAGS"
59 fi
60 fi
61
62 dnl UnrealIRCd might not be strict-aliasing safe at this time
63 AC_CACHE_CHECK(if the compiler has a working -fno-strict-aliasing, ac_cv_nsa, [
64 save_cflags="$CFLAGS"
65 CFLAGS="$CFLAGS -fno-strict-aliasing"
66 AC_TRY_COMPILE(,, ac_cv_nsa="yes", ac_cv_nsa="no")
67 CFLAGS="$save_cflags"
68 ])
69 if test "$ac_cv_nsa" = "yes"; then
70 CFLAGS="$CFLAGS -fno-strict-aliasing"
71 fi
72
73 dnl Pointer signedness warnings are really a pain and 99.9% of the time
74 dnl they are of absolutely no use whatsoever. IMO the person who decided
75 dnl to enable this without -Wall should be shot on sight.
76 AC_CACHE_CHECK(if the compiler has a working -Wno-pointer-sign, ac_cv_nps, [
77 save_cflags="$CFLAGS"
78 CFLAGS="$CFLAGS -Wno-pointer-sign"
79 AC_TRY_COMPILE(,, ac_cv_nps="yes", ac_cv_nps="no")
80 CFLAGS="$save_cflags"
81 ])
82 if test "$ac_cv_nps" = "yes"; then
83 CFLAGS="$CFLAGS -Wno-pointer-sign"
84 fi
85
86 dnl This is purely for charsys.c... I like it so we can easily read
87 dnl this for non-utf8. We can remove it once we ditch non-utf8 some day
88 dnl of course, or decide to ignore me and encode them.
89 AC_CACHE_CHECK(if the compiler has a working -Wno-invalid-source-encoding, ac_cv_nise, [
90 save_cflags="$CFLAGS"
91 CFLAGS="$CFLAGS -Wno-invalid-source-encoding"
92 AC_TRY_COMPILE(,, ac_cv_nise="yes", ac_cv_nise="no")
93 CFLAGS="$save_cflags"
94 ])
95 if test "$ac_cv_nise" = "yes"; then
96 CFLAGS="$CFLAGS -Wno-invalid-source-encoding"
97 fi
98
99 dnl Pffff..
100 AC_CACHE_CHECK(if the compiler has a working -Wno-format-zero-length, ac_cv_nfzl, [
101 save_cflags="$CFLAGS"
102 CFLAGS="$CFLAGS -Wno-format-zero-length"
103 AC_TRY_COMPILE(,, ac_cv_nfzl="yes", ac_cv_nfzl="no")
104 CFLAGS="$save_cflags"
105 ])
106 if test "$ac_cv_nfzl" = "yes"; then
107 CFLAGS="$CFLAGS -Wno-format-zero-length"
108 fi
109
110 dnl More and more and more....
111 AC_CACHE_CHECK(if the compiler has a working -Wno-format-truncation, ac_cv_nft, [
112 save_cflags="$CFLAGS"
113 CFLAGS="$CFLAGS -Wno-format-truncation -Werror"
114 AC_TRY_COMPILE(,, ac_cv_nft="yes", ac_cv_nft="no")
115 CFLAGS="$save_cflags"
116 ])
117 if test "$ac_cv_nft" = "yes"; then
118 CFLAGS="$CFLAGS -Wno-format-truncation"
119 fi
120
121 AC_PATH_PROG(RM,rm)
122 AC_PATH_PROG(CP,cp)
123 AC_PATH_PROG(TOUCH,touch)
124 AC_PATH_PROG(OPENSSLPATH,openssl)
125 AC_PATH_PROG(INSTALL,install)
126 AC_CHECK_PROG(MAKER, gmake, gmake, make)
127 AC_PATH_PROG(GMAKE,gmake)
128 AC_PATH_PROG(GUNZIP, gunzip)
129 AC_PATH_PROG(PKGCONFIG, pkg-config)
130
131 dnl Checks for libraries.
132 AC_CHECK_LIB(descrypt, crypt,
133 [AC_DEFINE([HAVE_CRYPT], [], [Define if you have crypt])
134 IRCDLIBS="$IRCDLIBS-ldescrypt "
135 MKPASSWDLIBS="-ldescrypt"],
136 [AC_CHECK_LIB(crypt, crypt,
137 [AC_DEFINE([HAVE_CRYPT], [], [Define if you have crypt])
138 IRCDLIBS="$IRCDLIBS-lcrypt "
139 MKPASSWDLIBS="-lcrypt"])])
140 AC_CHECK_LIB(socket, socket,
141 [IRCDLIBS="$IRCDLIBS-lsocket "
142 SOCKLIB="-lsocket"])
143 AC_CHECK_LIB(nsl, inet_ntoa,
144 [IRCDLIBS="$IRCDLIBS-lnsl "
145 INETLIB="-lnsl"])
146 AC_CHECK_LIB(crypto, RAND_egd,
147 AC_DEFINE(HAVE_RAND_EGD, 1, [Define if the libcrypto has RAND_egd]))
148
149 AC_SUBST(IRCDLIBS)
150 AC_SUBST(MKPASSWDLIBS)
151
152 dnl HARDENING START
153 dnl This is taken from https://github.com/kmcallister/autoharden
154 dnl With some very small modifications (to remove C++ checking for instance)
155 # We want to check for compiler flag support, but there is no way to make
156 # clang's "argument unused" warning fatal. So we invoke the compiler through a
157 # wrapper script that greps for this message.
158 saved_CC="$CC"
159 saved_CXX="$CXX"
160 saved_LD="$LD"
161 flag_wrap="$srcdir/extras/wrap-compiler-for-flag-check"
162 CC="$flag_wrap $CC"
163 CXX="$flag_wrap $CXX"
164 LD="$flag_wrap $LD"
165
166 # We use the same hardening flags for C and C++. We must check that each flag
167 # is supported by both compilers.
168 AC_DEFUN([check_cc_cxx_flag],
169 [AC_LANG_PUSH(C)
170 AX_CHECK_COMPILE_FLAG([$1],
171 [AC_LANG_PUSH(C)
172 AX_CHECK_COMPILE_FLAG([$1], [$2], [$3], [-Werror $4])
173 AC_LANG_POP(C)],
174 [$3], [-Werror $4])
175 AC_LANG_POP(C)])
176
177 AC_DEFUN([check_link_flag],
178 [AX_CHECK_LINK_FLAG([$1], [$2], [$3], [-Werror $4])])
179
180 AC_ARG_ENABLE([hardening],
181 [AS_HELP_STRING([--enable-hardening],
182 [Enable compiler and linker options to frustrate memory corruption exploits @<:@yes@:>@])],
183 [hardening="$enableval"],
184 [hardening="yes"])
185
186 HARDEN_CFLAGS=""
187 HARDEN_LDFLAGS=""
188 AS_IF([test x"$hardening" != x"no"], [
189 check_cc_cxx_flag([-fno-strict-overflow], [HARDEN_CFLAGS="$HARDEN_CFLAGS -fno-strict-overflow"])
190
191 # This one will likely succeed, even on platforms where it does nothing.
192 check_cc_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
193
194 check_cc_cxx_flag([-fstack-protector-all],
195 [check_link_flag([-fstack-protector-all],
196 [HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
197 check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
198 [], [-fstack-protector-all])
199 check_cc_cxx_flag([--param ssp-buffer-size=1], [HARDEN_CFLAGS="$HARDEN_CFLAGS --param ssp-buffer-size=1"],
200 [], [-fstack-protector-all])])])
201
202 # At the link step, we might want -pie (GCC) or -Wl,-pie (Clang on OS X)
203 #
204 # The linker checks also compile code, so we need to include -fPIE as well.
205 check_cc_cxx_flag([-fPIE],
206 [check_link_flag([-fPIE -pie],
207 [HARDEN_BINCFLAGS="-fPIE"
208 HARDEN_BINLDFLAGS="-pie"],
209 [check_link_flag([-fPIE -Wl,-pie],
210 [HARDEN_BINCFLAGS="-fPIE"
211 HARDEN_BINLDFLAGS="-Wl,-pie"])])])
212
213 check_link_flag([-Wl,-z,relro],
214 [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,relro"
215 check_link_flag([-Wl,-z,now], [HARDEN_LDFLAGS="$HARDEN_LDFLAGS -Wl,-z,now"])])])
216 AC_SUBST([HARDEN_CFLAGS])
217 AC_SUBST([HARDEN_LDFLAGS])
218 AC_SUBST([HARDEN_BINCFLAGS])
219 AC_SUBST([HARDEN_BINLDFLAGS])
220
221 # End of flag tests.
222 CC="$saved_CC"
223 CXX="$saved_CXX"
224 LD="$saved_LD"
225 dnl HARDENING END
226
227 dnl module checking based on Hyb7's module checking code
228 AC_DEFUN([AC_ENABLE_DYN],
229 [
230 AC_CHECK_FUNC(dlopen,, [AC_CHECK_LIB(dl, dlopen,IRCDLIBS="$IRCDLIBS -ldl",
231 [
232 AC_MSG_WARN(Dynamic linking is not enabled because dlopen was not found)
233 AC_DEFINE(STATIC_LINKING)
234 ])])
235
236 hold_cflags=$CFLAGS
237 DYNAMIC_LDFLAGS=""
238 CFLAGS="$CFLAGS -Wl,-export-dynamic"
239 AC_CACHE_CHECK(if we need the -export-dynamic flag, ac_cv_export_dynamic, [
240 AC_TRY_LINK(, [int i];, ac_cv_export_dynamic=yes, ac_cv_export_dynamic=no)])
241 CFLAGS=$hold_cflags
242 if test "$ac_cv_export_dynamic" = "yes"; then
243 DYNAMIC_LDFLAGS="-Wl,-export-dynamic"
244 fi
245
246 AC_CACHE_CHECK(for compiler option to produce PIC,ac_cv_pic,[
247 if test "$ac_cv_prog_gcc" = "yes"; then
248 ac_cv_pic="-fPIC -DPIC -shared"
249 case `uname -s` in
250 Darwin*[)]
251 ac_cv_pic="-std=gnu89 -bundle -flat_namespace -undefined suppress"
252 ;;
253 HP-UX*[)]
254 ac_cv_pic="-fPIC"
255 ;;
256 esac
257 else
258 case `uname -s` in
259 SunOS*[)]
260 ac_cv_pic="-KPIC -DPIC -G"
261 ;;
262 esac
263 fi
264 ])
265 AC_CACHE_CHECK(if your system prepends an underscore on symbols,ac_cv_underscore,[
266 cat >uscore.c << __EOF__
267 int main() {
268 return 0;
269 }
270 __EOF__
271 $CC -o uscore $CFLAGS uscore.c 1>&5
272 if test -z "`strings -a uscore |grep '^_main$'`"; then
273 ac_cv_underscore=no
274 else
275 ac_cv_underscore=yes
276 fi
277 rm -f uscore uscore.c
278 ])
279 dnl libtool has built-in tests that determine proper underscorage
280 if test "$ac_cv_underscore" = "yes"; then
281 AC_DEFINE([UNDERSCORE], [], [Define if your system prepends an underscore to symbols])
282 fi
283
284 MODULEFLAGS="$ac_cv_pic $DYNAMIC_LDFLAGS"
285 dnl DYNAMIC_LINKING is not meant to be defined in include/setup.h, it's
286 dnl defined in the Makefiles using -D. Having it defined globally will
287 dnl only cause braindamage and symbol collisions :-D.
288 dnl AC_DEFINE([DYNAMIC_LINKING], [], [Link dynamically as opposed to statically. (Dynamic linking is the only supported method of linking atm)])
289 ])
290
291 AC_CACHE_CHECK([if your system has IPv6 support], [ac_cv_ip6], [
292 save_libs="$LIBS"
293 LIBS="$LIBS $SOCKLIB"
294 AC_TRY_RUN([
295 #include <sys/types.h>
296 #include <sys/socket.h>
297 int main() {
298 int s = socket(AF_INET6, SOCK_STREAM, 0);
299 exit(0); /* We only check if the code compiles, that's enough. We can deal with missing runtime IPv6 */
300 }
301 ],
302 [ac_cv_ip6=yes],
303 [ac_cv_ip6=no])
304 ])
305 if test "$ac_cv_ip6" = "no"; then
306 AC_MSG_ERROR([Your system does not support IPv6])
307 fi
308 LIBS="$save_libs"
309
310 AC_CHECK_HEADER(sys/param.h,
311 AC_DEFINE([PARAMH], [], [Define if you have the <sys/param.h> header file.]))
312 AC_CHECK_HEADER(stdlib.h,
313 AC_DEFINE([STDLIBH], [], [Define if you have the <stdlib.h> header file.]))
314 AC_CHECK_HEADER(stddef.h,
315 AC_DEFINE([STDDEFH], [], [Define if you have the <stddef.h> header file.]))
316 AC_CHECK_HEADER(sys/syslog.h,
317 AC_DEFINE([SYSSYSLOGH], [], [Define if you have the <sys/syslog.h> header file.]))
318 AC_CHECK_HEADER(unistd.h,
319 AC_DEFINE([UNISTDH], [], [Define if you have the <unistd.h> header file.]))
320 AC_CHECK_HEADER(string.h,
321 AC_DEFINE([STRINGH], [], [Define if you have the <string.h> header file.]))
322 AC_CHECK_HEADER(strings.h,
323 AC_DEFINE([STRINGSH], [], [Define if you have the <strings.h> header file.]))
324 AC_CHECK_HEADER(malloc.h,
325 AC_DEFINE([MALLOCH], [<malloc.h>], [Define to <malloc.h> you need malloc.h.]))
326 AC_CHECK_HEADER(sys/rusage.h,
327 AC_DEFINE([RUSAGEH], [], [Define if you have the <sys/rusage.h> header file.]))
328 AC_CHECK_HEADER(glob.h,
329 AC_DEFINE([GLOBH], [], [Define if you have the <glob.h> header file.]))
330 AC_CHECK_HEADERS([stdint.h inttypes.h])
331 dnl Checks for typedefs, structures, and compiler characteristics.
332 AC_C_CONST
333 AC_C_INLINE
334
335 AC_TYPE_MODE_T
336 AC_TYPE_SIZE_T
337 AC_TYPE_INTPTR_T
338
339 AC_HEADER_TIME
340 AC_HEADER_SYS_WAIT
341 AC_STRUCT_TM
342 AC_TYPE_UID_T
343 unreal_CHECK_TYPE_SIZES
344
345 dnl in the future, it would be nice to avoid AC_TRY_RUN to allow
346 dnl better support for crosscompiling.
347 AC_CACHE_CHECK([what kind of nonblocking sockets you have], [ac_cv_nonblocking],[
348 save_libs="$LIBS"
349 LIBS="$LIBS $SOCKLIB"
350 AC_TRY_RUN([
351 #include <sys/types.h>
352 #include <sys/socket.h>
353 #include <fcntl.h>
354 #include <sys/ioctl.h>
355 #include <sys/file.h>
356 #include <signal.h>
357 alarmed() {
358 exit(1);
359 }
360 int main() {
361 #ifdef O_NONBLOCK
362 char b[12], x[32];
363 int f, l = sizeof(x);
364 f = socket(AF_INET, SOCK_DGRAM, 0);
365 if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK))) {
366 signal(SIGALRM, alarmed);
367 alarm(3);
368 recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
369 alarm(0);
370 exit(0);
371 }
372 #endif
373 exit(1);
374 }
375 ],ac_cv_nonblocking=O_NONBLOCK,[
376 AC_TRY_RUN([
377 #include <sys/types.h>
378 #include <sys/socket.h>
379 #include <fcntl.h>
380 #include <sys/ioctl.h>
381 #include <sys/file.h>
382 #include <signal.h>
383 alarmed() {
384 exit(0);
385 }
386 int main() {
387 #ifdef O_NDELAY
388 char b[12], x[32];
389 int f, l = sizeof(x);
390 f = socket(AF_INET, SOCK_DGRAM, 0);
391 if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY))) {
392 signal(SIGALRM, alarmed);
393 alarm(3);
394 recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
395 alarm(0);
396 exit(0);
397 }
398 #endif
399 exit(1);
400 }],ac_cv_nonblocking=O_NDELAY,[
401 AC_TRY_RUN([
402 #include <sys/types.h>
403 #include <sys/socket.h>
404 #include <fcntl.h>
405 #include <sys/ioctl.h>
406 #include <sys/file.h>
407 #include <signal.h>
408 alarmed() {
409 exit(1);
410 }
411 int main() {
412 #ifdef FIONBIO
413 char b[12], x[32];
414 int f, l = sizeof(x);
415 f = socket(AF_INET, SOCK_DGRAM, 0);
416 if (f >= 0 && !(fcntl(f, F_SETFL, FIONBIO))) {
417 signal(SIGALRM, alarmed);
418 alarm(3);
419 recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l);
420 alarm(0);
421 exit(0);
422 }
423 #endif
424 exit(1);
425 ], ac_cv_nonblocking=FIONBIO,ac_cv_nonblocking=none)])])])
426 if test "$ac_cv_nonblocking" = "O_NONBLOCK"; then
427 AC_DEFINE([NBLOCK_POSIX], [], [Define if you have O_NONBLOCK])
428 elif test "$ac_cv_nonblocking" = "O_NDELAY"; then
429 AC_DEFINE([NBLOCK_BSD], [], [Define if you have O_NDELAY])
430 elif test "$ac_cv_nonblocking" = "FIONBIO"; then
431 AC_DEFINE([NBLOCK_SYSV], [], [Define if you have FIONBIO])
432 fi
433 LIBS="$save_libs"
434 dnl Checks for library functions.
435 AC_PROG_GCC_TRADITIONAL
436 AC_FUNC_SETPGRP
437 AC_FUNC_SETVBUF_REVERSED
438 AC_CHECK_FUNCS(snprintf,
439 AC_DEFINE([HAVE_SNPRINTF], [], [Define if you have snprintf]))
440 AC_CHECK_FUNCS(vsnprintf,
441 AC_DEFINE([HAVE_VSNPRINTF], [], [Define if you have vsnprintf]))
442 AC_CHECK_FUNCS(strlcpy,
443 AC_DEFINE([HAVE_STRLCPY], [], [Define if you have strlcpy. Otherwise, an internal implementation will be used!]))
444 AC_CHECK_FUNCS(strlcat,
445 AC_DEFINE([HAVE_STRLCAT], [], [Define if you have strlcat]))
446 AC_CHECK_FUNCS(strlncat,
447 AC_DEFINE([HAVE_STRLNCAT], [], [Define if you have strlncat]))
448 AC_CHECK_FUNCS(inet_pton,
449 AC_DEFINE([HAVE_INET_PTON], [], [Define if you have inet_pton]))
450 AC_CHECK_FUNCS(inet_ntop,
451 AC_DEFINE([HAVE_INET_NTOP], [], [Define if you have inet_ntop]))
452 dnl Check if it supports C99 style variable length arrays
453 AC_CACHE_CHECK([if C99 variable length arrays are supported], [ac_cv_varlen_arrays], [
454 AC_TRY_COMPILE(,[
455 int main() {
456 int i = 5;
457 int a[i];
458 a[0] = 1;
459 return 0;
460 }], ac_cv_varlen_arrays=yes, ac_cv_varlen_arrays=no)
461 ])
462 if test "$ac_cv_varlen_arrays" = "yes" ; then
463 AC_DEFINE([HAVE_C99_VARLEN_ARRAY], [], [Define if you have a compiler with C99 variable length array support])
464 fi
465
466 dnl This check doesn't need to be in ./configure, we can
467 dnl write the sourcecode to actually handle the return value
468 dnl of setrlimit if necessary... -- ohnobinki
469 AC_CACHE_CHECK([if we can set the core size to unlimited], [ac_cv_force_core], [
470 AC_TRY_RUN([
471 #include <sys/time.h>
472 #include <sys/resource.h>
473 #include <unistd.h>
474 int main() {
475 struct rlimit corelim;
476 corelim.rlim_cur = corelim.rlim_max = RLIM_INFINITY;
477 if (setrlimit(RLIMIT_CORE, &corelim))
478 exit(1);
479 exit(0);
480 }
481 ],ac_cv_force_core=yes,ac_cv_force_core=no)
482 ])
483 if test "$ac_cv_force_core" = "yes"; then
484 AC_DEFINE([FORCE_CORE], [], [Define if you can set the core size to unlimited])
485 fi
486 AC_FUNC_VPRINTF
487 AC_CHECK_FUNCS([gettimeofday],
488 [AC_DEFINE([GETTIMEOFDAY], [], [Define if you have gettimeofday])],
489 [AC_CHECK_FUNCS([lrand48],
490 [AC_DEFINE([LRADN48], [], [Define if you have lrand48])])])
491 AC_CHECK_FUNCS([getrusage],
492 [AC_DEFINE([GETRUSAGE_2], [], [Define if you have getrusage])],
493 [AC_CHECK_FUNCS([times],
494 [AC_DEFINE([TIMES_2], [], [Define if you have times])])])
495 AC_CHECK_FUNCS([setproctitle],
496 [AC_DEFINE([HAVE_SETPROCTITLE], [], [Define if you have setproctitle])],
497 [AC_CHECK_LIB([util],
498 [setproctitle],
499 [AC_DEFINE([HAVE_SETPROCTITLE], [], [Define if you have setproctitle])
500 IRCDLIBS="$IRCDLIBS-lutil"],
501 [
502 AC_EGREP_HEADER([#define.*PS_STRINGS.*],[sys/exec.h],
503 [AC_DEFINE([HAVE_PSSTRINGS],[], [Define if you have PS_STRINGS])],
504 [AC_CHECK_FUNCS([pstat],
505 [AC_DEFINE([HAVE_PSTAT], [], [Define if you have pstat])])])
506 ])
507 ]
508 )
509
510
511 AC_CACHE_CHECK([what type of signals you have], [ac_cv_sigtype], [
512 AC_TRY_RUN([
513 #include <signal.h>
514 int main() {
515 sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L);
516 }
517 ], ac_cv_sigtype=POSIX, [
518 AC_TRY_RUN([
519 #include <signal.h>
520 int calls = 0;
521 void handler()
522 {
523 if (calls)
524 return;
525 calls++;
526 kill(getpid(), SIGTERM);
527 sleep(1);
528 }
529
530 int main() {
531 signal(SIGTERM, handler);
532 kill(getpid(), SIGTERM);
533 exit(0);
534 }
535 ], ac_cv_sigtype=BSD,ac_cv_sigtype=SYSV)])])
536
537 if test "$ac_cv_sigtype" = "POSIX"; then
538 AC_DEFINE([POSIX_SIGNALS], [], [Define if you have POSIX signals])
539 elif test "$ac_cv_sigtype" = "BSD"; then
540 AC_DEFINE([BSD_RELIABLE_SIGNALS], [], [Define if you have BSD signals])
541 else
542 AC_DEFINE([SYSV_UNRELIABLE_SIGNALS], [], [Define if you have SYSV signals])
543 fi
544 AC_CHECK_FUNCS(strtoken,,AC_DEFINE([NEED_STRTOKEN], [], [Define if you need the strtoken function.]))
545 AC_CHECK_FUNCS(strtok,,AC_DEFINE([NEED_STRTOK], [], [Define if you need the strtok function.]))
546 AC_CHECK_FUNCS(strerror,,AC_DEFINE([NEED_STRERROR], [], [Define if you need the strerror function.]))
547 AC_CHECK_FUNCS(index,,AC_DEFINE([NOINDEX], [], [Define if you do not have the index function.]))
548 AC_CHECK_FUNCS(strtoul,,STRTOUL="strtoul.o")
549 AC_CHECK_FUNCS(bcopy,,AC_DEFINE([NEED_BCOPY], [], [Define if you don't have bcopy]))
550 AC_CHECK_FUNCS(bcmp,,AC_DEFINE([NEED_BCMP], [], [Define if you don't have bcmp]))
551 AC_CHECK_FUNCS(bzero,,AC_DEFINE([NEED_BZERO], [], [Define if you need bzero]))
552 AC_CHECK_FUNCS(strcasecmp,AC_DEFINE([GOT_STRCASECMP], [], [Define if you have strcasecmp]))
553 save_libs="$LIBS"
554 LIBS="$LIBS $SOCKLIB $INETLIB"
555 AC_CHECK_FUNCS(inet_addr,,AC_DEFINE([NEED_INET_ADDR], [], [Define if you need inet_addr]))
556 AC_CHECK_FUNCS(inet_ntoa,,AC_DEFINE([NEED_INET_NTOA], [], [Define if you need inet_ntoa]))
557 LIBS="$save_libs"
558 AC_CHECK_FUNCS(syslog,AC_DEFINE([HAVE_SYSLOG], [], [Define if you have syslog]))
559 AC_SUBST(STRTOUL)
560 AC_SUBST(CRYPTOLIB)
561 AC_SUBST(MODULEFLAGS)
562 AC_SUBST(DYNAMIC_LDFLAGS)
563 AC_ARG_WITH(nick-history, [AS_HELP_STRING([--with-nick-history=length],[Specify the length of the nickname history])],
564 [AC_DEFINE_UNQUOTED([NICKNAMEHISTORYLENGTH], [$withval], [Set to the nickname history length you want])],
565 [AC_DEFINE([NICKNAMEHISTORYLENGTH], [2000], [Set to the nickname history length you want])])
566 AC_ARG_WITH([sendq], [AS_HELP_STRING([--with-sendq=maxsendq],[Specify the max sendq for the server])],
567 [AC_DEFINE_UNQUOTED([MAXSENDQLENGTH], [$withval], [Set to the max sendq you want])],
568 [AC_DEFINE([MAXSENDQLENGTH], [3000000], [Set to the max sendq you want])])
569 AC_ARG_WITH(permissions, [AS_HELP_STRING([--with-permissions=permissions], [Specify the default permissions for
570 configuration files])],
571 dnl We have an apparently out-of-place 0 here because of a MacOSX bug and because
572 dnl we assume that a user thinks that `chmod 0600 blah' is the same as `chmod 600 blah'
573 dnl (#3189)
574 [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.])],
575 [AC_DEFINE([DEFAULT_PERMISSIONS], [0600], [The default permissions for configuration files. Set to 0 to prevent unrealircd from calling chmod() on the files.])])
576
577 AC_ARG_WITH(bindir, [AS_HELP_STRING([--with-bindir=path],[Specify the directory for the unrealircd binary])],
578 [AC_DEFINE_UNQUOTED([BINDIR], ["$withval"], [Define the directory where the unrealircd binary is located])
579 BINDIR="$withval"],
580 [AC_DEFINE_UNQUOTED([BINDIR], ["$HOME/unrealircd/bin"], [Define the directory where the unrealircd binary is located])
581 BINDIR="$HOME/unrealircd/bin"])
582
583 AC_ARG_WITH(scriptdir, [AS_HELP_STRING([--with-scriptdir=path],[Specify the directory for the unrealircd start-stop script])],
584 [AC_DEFINE_UNQUOTED([SCRIPTDIR], ["$withval"], [Define the directory where the unrealircd start stop scripts is located])
585 SCRIPTDIR="$withval"],
586 [AC_DEFINE_UNQUOTED([SCRIPTDIR], ["$HOME/unrealircd"], [Define the directory where the unrealircd start stop scripts is located])
587 SCRIPTDIR="$HOME/unrealircd"])
588
589 AC_ARG_WITH(confdir, [AS_HELP_STRING([--with-confdir=path],[Specify the directory where configuration files are stored])],
590 [AC_DEFINE_UNQUOTED([CONFDIR], ["$withval"], [Define the location of the configuration files])
591 CONFDIR="$withval"],
592 [AC_DEFINE_UNQUOTED([CONFDIR], ["$HOME/unrealircd/conf"], [Define the location of the configuration files])
593 CONFDIR="$HOME/unrealircd/conf"])
594
595 AC_ARG_WITH(modulesdir, [AS_HELP_STRING([--with-modulesdir=path],[Specify the directory for loadable modules])],
596 [AC_DEFINE_UNQUOTED([MODULESDIR], ["$withval"], [Define the location of the modules])
597 MODULESDIR="$withval"],
598 [AC_DEFINE_UNQUOTED([MODULESDIR], ["$HOME/unrealircd/modules"], [Define the location of the modules])
599 MODULESDIR="$HOME/unrealircd/modules"])
600
601 AC_ARG_WITH(logdir, [AS_HELP_STRING([--with-logdir=path],[Specify the directory where log files are stored])],
602 [AC_DEFINE_UNQUOTED([LOGDIR], ["$withval"], [Define the location of the log files])
603 LOGDIR="$withval"],
604 [AC_DEFINE_UNQUOTED([LOGDIR], ["$HOME/unrealircd/logs"], [Define the location of the log files])
605 LOGDIR="$HOME/unrealircd/logs"])
606
607 AC_ARG_WITH(cachedir, [AS_HELP_STRING([--with-cachedir=path],[Specify the directory where cached files are stored])],
608 [AC_DEFINE_UNQUOTED([CACHEDIR], ["$withval"], [Define the location of the cached remote include files])
609 CACHEDIR="$withval"],
610 [AC_DEFINE_UNQUOTED([CACHEDIR], ["$HOME/unrealircd/cache"], [Define the location of the cached remote include files])
611 CACHEDIR="$HOME/unrealircd/cache"])
612
613 AC_ARG_WITH(tmpdir, [AS_HELP_STRING([--with-tmpdir=path],[Specify the directory where private temporary files are stored. Should not be readable or writable by others, so not /tmp!!])],
614 [AC_DEFINE_UNQUOTED([TMPDIR], ["$withval"], [Define the location of private temporary files])
615 TMPDIR="$withval"],
616 [AC_DEFINE_UNQUOTED([TMPDIR], ["$HOME/unrealircd/tmp"], [Define the location of private temporary files])
617 TMPDIR="$HOME/unrealircd/tmp"])
618
619 AC_ARG_WITH(datadir, [AS_HELP_STRING([--with-datadir=path],[Specify the directory where permanent data is stored])],
620 [AC_DEFINE_UNQUOTED([PERMDATADIR], ["$withval"], [Define the location of permanent data files])
621 PERMDATADIR="$withval"],
622 [AC_DEFINE_UNQUOTED([DATADIR], ["$HOME/unrealircd/data"], [Define the location of permanent data files])
623 PERMDATADIR="$HOME/unrealircd/data"])
624
625 AC_ARG_WITH(docdir, [AS_HELP_STRING([--with-docdir=path],[Specify the directory where documentation is stored])],
626 [AC_DEFINE_UNQUOTED([DOCDIR], ["$withval"], [Define the location of the documentation])
627 DOCDIR="$withval"],
628 [AC_DEFINE_UNQUOTED([DOCDIR], ["$HOME/unrealircd/doc"], [Define the location of the documentation])
629 DOCDIR="$HOME/unrealircd/doc"])
630
631 AC_ARG_WITH(pidfile, [AS_HELP_STRING([--with-pidfile=path],[Specify the path of the pid file])],
632 [AC_DEFINE_UNQUOTED([PIDFILE], ["$withval"], [Define the path of the pid file])
633 PIDFILE="$withval"],
634 [AC_DEFINE_UNQUOTED([PIDFILE], ["$HOME/unrealircd/data/unrealircd.pid"], [Define the path of the pid file])
635 PIDFILE="$HOME/unrealircd/data/unrealircd.pid"])
636
637 dnl Ensure that this “feature” can be disabled as it makes it harder to package unrealircd.
638 dnl Users have always been able to specify “./configure LDFLAGS=-Wl,-rpath,/path/to/blah”—binki
639 AC_ARG_WITH(privatelibdir, [AS_HELP_STRING([--with-privatelibdir=path],[Specify the directory where private libraries are stored. Disable when building a package for a distro])],
640 [],
641 [with_privatelibdir="yes"])
642 AS_IF([test "x$with_privatelibdir" = "xno"],
643 [PRIVATELIBDIR=],
644 [test "x$with_privatelibdir" = "xyes"],
645 [PRIVATELIBDIR="$HOME/unrealircd/lib"],
646 [PRIVATELIBDIR="$with_privatelibdir"])
647 AS_IF([test "x$PRIVATELIBDIR" = "x"],
648 [LDFLAGS_PRIVATELIBS=""],
649 [AC_DEFINE_UNQUOTED([PRIVATELIBDIR], ["$PRIVATELIBDIR"], [Define the location of private libraries])
650 LDFLAGS_PRIVATELIBS="-Wl,-rpath,$PRIVATELIBDIR"
651 LDFLAGS="$LDFLAGS $LDFLAGS_PRIVATELIBS"
652 export LDFLAGS])
653
654 AC_SUBST(BINDIR)
655 AC_SUBST(SCRIPTDIR)
656 AC_SUBST(CONFDIR)
657 AC_SUBST(MODULESDIR)
658 AC_SUBST(LOGDIR)
659 AC_SUBST(CACHEDIR)
660 AC_SUBST(TMPDIR)
661 dnl Why o why PERMDATADIR and not DATADIR you ask?
662 dnl well, Because DATADIR conflicts with the Windows SDK header files.. amazing.
663 AC_SUBST(PERMDATADIR)
664 AC_SUBST(DOCDIR)
665 AC_SUBST(PIDFILE)
666 AC_SUBST(LDFLAGS_PRIVATELIBS)
667
668 AC_ARG_WITH(fd-setsize, [AS_HELP_STRING([--with-fd-setsize=size], [Specify the max file descriptors to use])],
669 [ac_fd=$withval],
670 [ac_fd=1024])
671 AC_DEFINE_UNQUOTED([MAXCONNECTIONS], [$ac_fd], [Set to the max connections you want])
672
673 AC_ARG_ENABLE([prefixaq],
674 [AS_HELP_STRING([--disable-prefixaq],[Disable chanadmin (+a) and chanowner (+q) prefixes])],
675 [],
676 [enable_prefixaq=yes])
677 AS_IF([test $enable_prefixaq = "yes"],
678 [AC_DEFINE([PREFIX_AQ], [], [Define if you want +a/+q prefixes])])
679
680 AC_ARG_WITH(showlistmodes,
681 [AS_HELP_STRING([--with-showlistmodes], [Specify whether modes are shown in /list])],
682 [AS_IF([test $withval = "yes"],
683 [AC_DEFINE([LIST_SHOW_MODES], [], [Define if you want modes shown in /list])])])
684 AC_ARG_WITH(topicisnuhost, [AS_HELP_STRING([--with-topicisnuhost], [Display nick!user@host as the topic setter])],
685 [AS_IF([test $withval = "yes"],
686 [AC_DEFINE([TOPIC_NICK_IS_NUHOST], [], [Define if you want nick!user@host shown for the topic setter])])])
687 AC_ARG_WITH(shunnotices, [AS_HELP_STRING([--with-shunnotices], [Notify a user when he/she is no longer shunned])],
688 [AS_IF([test $withval = "yes"],
689 [AC_DEFINE([SHUN_NOTICES], [], [Define if you want users to be notified when their shun is removed])])])
690 AC_ARG_WITH(no-operoverride, [AS_HELP_STRING([--with-no-operoverride], [Disable OperOverride])],
691 [AS_IF([test $withval = "yes"],
692 [AC_DEFINE([NO_OPEROVERRIDE], [], [Define if you want OperOverride disabled])])])
693 AC_ARG_WITH(disableusermod, [AS_HELP_STRING([--with-disableusermod], [Disable /set* and /chg*])],
694 [AS_IF([test $withval = "yes"],
695 [AC_DEFINE([DISABLE_USERMOD], [], [Define if you want to disable /set* and /chg*])])])
696 AC_ARG_WITH(operoverride-verify, [AS_HELP_STRING([--with-operoverride-verify], [Require opers to invite themselves to +s/+p channels])],
697 [AS_IF([test $withval = "yes"],
698 [AC_DEFINE([OPEROVERRIDE_VERIFY], [], [Define if you want opers to have to use /invite to join +s/+p channels])])])
699 AC_ARG_WITH(disable-extendedban-stacking, [AS_HELP_STRING([--with-disable-extendedban-stacking], [Disable extended ban stacking])],
700 [AS_IF([test $withval = "yes"],
701 [AC_DEFINE([DISABLE_STACKED_EXTBANS], [], [Define to disable extended ban stacking (~q:~c:\#chan, etc)])])])
702 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])
703 AC_ARG_WITH(system-pcre2, [AS_HELP_STRING([--with-system-pcre2], [Use the system pcre2 package instead of bundled, discovered using pkg-config])], [], [with_system_pcre2=no])
704 AC_ARG_WITH(system-cares, [AS_HELP_STRING([--without-system-cares], [Use bundled version instead of system c-ares. Normally autodetected via pkg-config.])], [], [with_system_cares=yes])
705 CHECK_SSL
706 CHECK_SSL_CTX_SET1_CURVES_LIST
707 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)])],
708 [enable_dynamic_linking=$enableval], [enable_dynamic_linking="yes"])
709 AS_IF([test $enable_dynamic_linking = "yes"],
710 [AC_ENABLE_DYN],
711 [AC_DEFINE([STATIC_LINKING], [], [Link... statically(?) (defining this macro will probably cause the build tofail)])])
712
713 AC_ARG_ENABLE([werror],
714 [AS_HELP_STRING([--enable-werror],
715 [Turn compilation warnings into errors (-Werror)])],
716 [ac_cv_werror="$enableval"],
717 [ac_cv_werror="no"])
718
719 AC_MSG_CHECKING([if FD_SETSIZE is large enough to allow $ac_fd file descriptors])
720 AC_COMPILE_IFELSE([
721 #include <sys/types.h>
722 #include <sys/time.h>
723 int main() {
724 #if FD_SETSIZE < $ac_fd
725 #error FD_SETSIZE is smaller than $ac_fd
726 #endif
727 exit(0);
728 }
729 ], AC_MSG_RESULT([yes]), [
730 # must be passed on the commandline to avoid a ``warning, you redefined something''
731 FD_SETSIZE="-DFD_SETSIZE=$ac_fd"
732 AC_MSG_RESULT(no)
733 ])
734 AC_SUBST([FD_SETSIZE])
735
736 case `uname -s` in
737 *SunOS*|*solaris*)
738 AC_DEFINE([_SOLARIS], [], [Define if you are compiling unrealircd on Sun's (or Oracle's?) Solaris])
739 IRCDLIBS="$IRCDLIBS -lresolv "
740 ;;
741 esac
742
743 AC_CHECK_FUNCS([poll],
744 AC_DEFINE([HAVE_POLL], [], [Define if you have poll]))
745 AC_CHECK_FUNCS([epoll_create epoll_ctl epoll_wait],
746 AC_DEFINE([HAVE_EPOLL], [], [Define if you have epoll]))
747 AC_CHECK_FUNCS([kqueue kevent],
748 AC_DEFINE([HAVE_KQUEUE], [], [Define if you have kqueue]))
749
750 dnl c-ares needs PATH_SEPARATOR set or it will
751 dnl fail on certain solaris boxes. We might as
752 dnl well set it here.
753 export PATH_SEPARATOR
754
755 AS_IF([test "x$with_system_tre" = "xno"],[
756 dnl REMEMBER TO CHANGE WITH A NEW TRE RELEASE!
757 tre_version="0.8.0-git"
758 AC_MSG_RESULT(extracting TRE regex library)
759 cur_dir=`pwd`
760 cd extras
761 dnl remove old tre directory to force a recompile...
762 dnl and remove its installation prefix just to clean things up.
763 rm -rf tre-$tre_version rege[]xp
764 if test "x$ac_cv_path_GUNZIP" = "x" ; then
765 tar xfz tre.tar.gz
766 else
767 cp tre.tar.gz tre.tar.gz.bak
768 gunzip -f tre.tar.gz
769 cp tre.tar.gz.bak tre.tar.gz
770 tar xf tre.tar
771 fi
772 AC_MSG_RESULT(configuring TRE regex library)
773 cd tre-$tre_version
774 ./configure --disable-agrep --enable-shared --disable-system-abi --disable-wchar --disable-multibyte --prefix=$cur_dir/extras/regexp --libdir=$PRIVATELIBDIR || exit 1
775 AC_MSG_RESULT(compiling TRE regex library)
776 $ac_cv_prog_MAKER || exit 1
777 AC_MSG_RESULT(installing TRE regex library)
778 $ac_cv_prog_MAKER install || exit 1
779 TRE_CFLAGS="-I$cur_dir/extras/regexp/include"
780 AC_SUBST(TRE_CFLAGS)
781
782 TRE_LIBS=
783 AS_IF([test -n "$ac_cv_path_PKGCONFIG"],
784 [TRE_LIBS="`$ac_cv_path_PKGCONFIG --libs tre.pc`"])
785 dnl For when pkg-config isn't available -- or for when pkg-config
786 dnl doesn't see the tre.pc file somehow... (#3982)
787 AS_IF([test -z "$TRE_LIBS"],
788 [TRE_LIBS="$PRIVATELIBDIR/libtre.so"])
789 AC_SUBST(TRE_LIBS)
790 cd $cur_dir
791 ],[
792 dnl use pkgconfig for tre:
793 PKG_CHECK_MODULES([TRE], tre >= 0.7.5)
794 ])
795
796 AS_IF([test "x$with_system_pcre2" = "xno"],[
797 dnl REMEMBER TO CHANGE WITH A NEW PCRE2 RELEASE!
798 pcre2_version="10.30"
799 AC_MSG_RESULT(extracting PCRE2 regex library)
800 cur_dir=`pwd`
801 cd extras
802 dnl remove old pcre2 directory to force a recompile...
803 dnl and remove its installation prefix just to clean things up.
804 rm -rf pcre2-$pcre2_version pcre2
805 if test "x$ac_cv_path_GUNZIP" = "x" ; then
806 tar xfz pcre2.tar.gz
807 else
808 cp pcre2.tar.gz pcre2.tar.gz.bak
809 gunzip -f pcre2.tar.gz
810 cp pcre2.tar.gz.bak pcre2.tar.gz
811 tar xf pcre2.tar
812 fi
813 AC_MSG_RESULT(configuring PCRE2 regex library)
814 cd pcre2-$pcre2_version
815 ./configure --enable-jit --enable-shared --disable-unicode --prefix=$cur_dir/extras/pcre2 --libdir=$PRIVATELIBDIR || exit 1
816 AC_MSG_RESULT(compiling PCRE2 regex library)
817 $ac_cv_prog_MAKER || exit 1
818 AC_MSG_RESULT(installing PCRE2 regex library)
819 $ac_cv_prog_MAKER install || exit 1
820 PCRE2_CFLAGS="-I$cur_dir/extras/pcre2/include"
821 AC_SUBST(PCRE2_CFLAGS)
822
823 PCRE2_LIBS=
824 dnl See c-ares's compilation section for more info on this hack.
825 dnl ensure that we're linking against the bundled version of pcre2
826 dnl (we only reach this code if linking against the bundled version is desired).
827 AS_IF([test -n "$ac_cv_path_PKGCONFIG"],
828 [PCRE2_LIBS="`$ac_cv_path_PKGCONFIG --libs libpcre2-8.pc`"])
829 dnl For when pkg-config isn't available -- or for when pkg-config
830 dnl doesn't see the libpcre2-8.pc file somehow... (#3982)
831 AS_IF([test -z "$PCRE2_LIBS"],
832 [PCRE2_LIBS="$PRIVATELIBDIR/libpcre2-8.so"])
833 AC_SUBST(PCRE2_LIBS)
834 cd $cur_dir
835 ],[
836 dnl use pkgconfig for pcre2:
837 PKG_CHECK_MODULES([PCRE2], libpcre2-8 >= 10.00)
838 ])
839
840 dnl Use system c-ares when available, unless --without-system-cares.
841 has_system_cares="no"
842 AS_IF([test "x$with_system_cares" = "xyes"],[
843 PKG_CHECK_MODULES([CARES], libcares >= 1.6.0,[has_system_cares=yes
844 AS_IF([test "x$PRIVATELIBDIR" != "x"], [rm -f "$PRIVATELIBDIR/"libcares*])],[has_system_cares=no])])
845
846 AS_IF([test "$has_system_cares" = "no"], [
847 dnl REMEMBER TO CHANGE WITH A NEW C-ARES RELEASE!
848 dnl NOTE: when changing this here, ALSO change it in extras/curlinstall
849 dnl and in the comment in this file around line 400!
850 cares_version="1.13.0"
851 AC_MSG_RESULT(extracting c-ares resolver library)
852 cur_dir=`pwd`
853 cd extras
854 dnl remove old c-ares directory to force a recompile...
855 rm -rf c-ares-$cares_version c-ares
856 if test "x$ac_cv_path_GUNZIP" = "x" ; then
857 tar xfz c-ares.tar.gz
858 else
859 cp c-ares.tar.gz c-ares.tar.gz.bak
860 gunzip -f c-ares.tar.gz
861 cp c-ares.tar.gz.bak c-ares.tar.gz
862 tar xf c-ares.tar
863 fi
864 AC_MSG_RESULT(configuring c-ares library)
865 cd c-ares-$cares_version
866 save_cflags="$CFLAGS"
867 CFLAGS="$orig_cflags"
868 export CFLAGS
869 ./configure --prefix=$cur_dir/extras/c-ares --libdir=$PRIVATELIBDIR --enable-shared || exit 1
870 CFLAGS="$save_cflags"
871 AC_MSG_RESULT(compiling c-ares resolver library)
872 $ac_cv_prog_MAKER || exit 1
873 AC_MSG_RESULT(installing c-ares resolver library)
874 $ac_cv_prog_MAKER install || exit 1
875 CARES_CFLAGS="-I$cur_dir/extras/c-ares/include"
876 AC_SUBST(CARES_CFLAGS)
877 CARES_LIBS="-L$PRIVATELIBDIR"
878
879 dnl Set default library parameters for when pkg-config is not available
880 dnl Ugly cd'ing out of extras/c-ares-xxx ;)
881 dnl Note: must be a full path, not relative path.
882 cd ../..
883 CARESLIBSALT="$PRIVATELIBDIR/libcares.so"
884 cd -
885 case `uname -s` in
886 *FreeBSD*)
887 CARESLIBSALT="$CARESLIBSALT"
888 ;;
889 *Linux*)
890 CARESLIBSALT="$CARESLIBSALT -lrt"
891 ;;
892 *SunOS*)
893 CARESLIBSALT="$CARESLIBSALT -lrt"
894 ;;
895 esac
896
897 dnl Use pkg-config for c-ares libraries, and if not available use defaults
898 dnl from above (also if pkg-config returns an empty result).
899 if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
900 CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
901 else
902 CARES_LIBSPRE="$CARES_LIBS"
903 dnl the sed expression forces an absolute path to the .so file to be generated
904 dnl because this is what libtool would do. If this wasn't done and /usr/lib*/libcares.so
905 dnl exists, then unrealircd would still try to link against the system c-ares.
906 dnl The [] quotation is needed because the sed expression has [] in it.
907 [CARES_LIBS="$CARES_LIBS `$ac_cv_path_PKGCONFIG --libs libcares.pc | sed -e 's,-L\([^ ]\+lib\) -lcares,\1/libcares.so,'`"]
908 if test "$CARES_LIBS" = "$CARES_LIBSPRE " ; then
909 CARES_LIBS="$CARES_LIBS $CARESLIBSALT"
910 fi
911 fi
912 AC_SUBST(CARES_LIBS)
913 cd $cur_dir
914 ])
915
916 AX_PTHREAD()
917
918 CHECK_LIBCURL
919
920 UNRLINCDIR="`pwd`/include"
921
922 dnl Moved to the very end to ensure it doesn't affect any libs or tests.
923 if test "$ac_cv_werror" = "yes" ; then
924 CFLAGS="$CFLAGS -Werror"
925 fi
926
927 AC_SUBST(UNRLINCDIR)
928
929 AC_CONFIG_FILES([Makefile
930 src/Makefile
931 src/modules/Makefile
932 src/modules/chanmodes/Makefile
933 src/modules/usermodes/Makefile
934 src/modules/snomasks/Makefile
935 src/modules/extbans/Makefile
936 src/modules/cap/Makefile
937 src/modules/third/Makefile
938 unrealircd])
939 AC_OUTPUT
940 chmod 0700 unrealircd