]>
Commit | Line | Data |
---|---|---|
1 | dnl $Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $ | |
2 | dnl Process this file with autoconf to produce a configure script. | |
3 | ||
4 | dnl TODO: clean up all the OpenSSL and shared module checking stuff; | |
5 | dnl the most major changes have already been made and it looks like | |
6 | dnl said functions need to be just about as complex as they already are. | |
7 | ||
8 | AC_PREREQ(2.57) | |
9 | ||
10 | dnl Sneaky way to get an Id tag into the configure script | |
11 | AC_COPYRIGHT([$Id: configure.ac 3516 2007-06-10 16:14:03Z jilles $]) | |
12 | ||
13 | AC_INIT([charybdis],[3.1]) | |
14 | ||
15 | AC_CONFIG_HEADER(include/setup.h) | |
16 | ||
17 | AC_PREFIX_DEFAULT($HOME/ircd) | |
18 | ||
19 | AC_GNU_SOURCE | |
20 | ||
21 | OLD_CFLAGS="$CFLAGS" | |
22 | dnl Checks for programs. | |
23 | AC_PROG_CC | |
24 | AC_LANG(C) | |
25 | ||
26 | dnl Make sure autoconf doesn't interfere with cflags -jmallett | |
27 | CFLAGS="$OLD_CFLAGS" | |
28 | ||
29 | AC_CONFIG_SUBDIRS(libratbox) | |
30 | ||
31 | dnl Check for various compilers. -jmallett | |
32 | dnl But if $CC turns out to be gcc, sure as hell it's, well, gcc. -joshk | |
33 | ||
34 | if test "$ac_cv_c_compiler_gnu" != yes; then | |
35 | ||
36 | SGS=no | |
37 | AC_MSG_CHECKING($CC -version for TenDRA or MIPSpro) | |
38 | case `$CC -version 2>&1` in | |
39 | *TenDRA*) | |
40 | AC_MSG_RESULT([yes, TenDRA]) | |
41 | IRC_CFLAGS="" | |
42 | CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include" | |
43 | SGS=yes | |
44 | TenDRA=yes | |
45 | ;; | |
46 | *MIPSpro*) | |
47 | AC_MSG_RESULT([yes, MIPSpro]) | |
48 | MIPSpro=yes | |
49 | SGS=yes | |
50 | ;; | |
51 | *) | |
52 | AC_MSG_RESULT(no) | |
53 | TenDRA=no | |
54 | MIPSpro=no | |
55 | ;; | |
56 | esac | |
57 | ||
58 | AC_MSG_CHECKING([$CC -V for Sun Workshop, Forte, HPUX or Tru64 cc]) | |
59 | case `$CC -V 2>&1` in | |
60 | *Sun*WorkShop* | *Forte*Developer*) | |
61 | AC_MSG_RESULT(Sun Workshop/Forte) | |
62 | IRC_CFLAGS="-fast -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString" | |
63 | SunWorkShop=yes | |
64 | SGS=yes | |
65 | ;; | |
66 | *Tru64*) | |
67 | AC_MSG_RESULT(Tru64 cc) | |
68 | IRC_CFLAGS="-O2" | |
69 | CPPFLAGS="-I/usr/local/include" | |
70 | Tru=yes | |
71 | ;; | |
72 | *HP*ANSI*) | |
73 | AC_MSG_RESULT(HPUX cc) | |
74 | HPUX=yes | |
75 | IRC_CFLAGS="+e" | |
76 | ;; | |
77 | *) | |
78 | AC_MSG_RESULT(no) | |
79 | ;; | |
80 | esac | |
81 | ||
82 | fi | |
83 | ||
84 | AC_MSG_CHECKING([uname -s for Cygwin, Solaris, AIX or HPUX]) | |
85 | OSNAME=`uname -s` | |
86 | case "$OSNAME" in | |
87 | HP-UX*) | |
88 | dnl only do this if we haven't already detected the newer one | |
89 | dnl and we're not already using gcc | |
90 | ||
91 | if test "$HPUX" != yes -a "$ac_cv_c_compiler_gnu" = no; then | |
92 | AC_MSG_RESULT(assuming old HPUX with its own cc) | |
93 | IRC_CFLAGS="$IRC_CFLAGS +e" | |
94 | HPUX=yes | |
95 | else | |
96 | AC_MSG_RESULT(already using newer HPUX) | |
97 | fi | |
98 | ;; | |
99 | CYGWIN*) | |
100 | AC_MSG_RESULT(Cygwin) | |
101 | CYGWIN=yes | |
102 | ;; | |
103 | SunOS*) | |
104 | AC_MSG_RESULT(SunOS or Solaris) | |
105 | AC_DEFINE(__EXTENSIONS__, 1, [This is needed to use strtok_r on Solaris.]) | |
106 | SUN=yes | |
107 | ;; | |
108 | AIX*) | |
109 | AC_MSG_RESULT(AIX - Sorry you poor bastard..really we are) | |
110 | IRC_CFLAGS="$IRC_CFLAGS -Wl,-brtl -Wl,-G" | |
111 | ;; | |
112 | *) | |
113 | AC_MSG_RESULT(no) | |
114 | ;; | |
115 | esac | |
116 | ||
117 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
118 | AC_MSG_CHECKING(if $CC is Apple GCC) | |
119 | ||
120 | case `$CC -v 2>&1 | tail -n 1` in | |
121 | *Apple*) | |
122 | AC_MSG_RESULT(yes) | |
123 | AppleGCC=yes | |
124 | ;; | |
125 | *) | |
126 | AC_MSG_RESULT(no) | |
127 | AppleGCC=no | |
128 | ;; | |
129 | esac | |
130 | ||
131 | IRC_CFLAGS="$IRC_CFLAGS -O0 -Wall -std=gnu99" | |
132 | fi | |
133 | ||
134 | dnl If we support -g, use it! | |
135 | if test "$ac_cv_prog_cc_g" = yes; then | |
136 | dnl Tru64 needs -g3 for -O2 | |
137 | if test "$Tru" = yes; then | |
138 | IRC_CFLAGS="$IRC_CFLAGS -g3" | |
139 | else | |
140 | IRC_CFLAGS="$IRC_CFLAGS -g" | |
141 | fi | |
142 | fi | |
143 | ||
144 | dnl SVR4 SGS based on what we know about the compiler -jmallett | |
145 | AC_MSG_CHECKING(if $CC supports the SVR4 SGS interfaces) | |
146 | if test "$SGS" = "yes"; then | |
147 | AC_MSG_RESULT(yes) | |
148 | else | |
149 | AC_MSG_RESULT(no) | |
150 | fi | |
151 | ||
152 | dnl We prefer gcc -MM because it's a lot less bloated | |
153 | AC_PATH_PROG(MKDEP, mkdep) | |
154 | AC_PATH_PROG(MAKEDEPEND, makedepend) | |
155 | ||
156 | AC_MSG_CHECKING(how to generate dependency info) | |
157 | ||
158 | STDOUT="> .depend" | |
159 | ||
160 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
161 | AC_MSG_RESULT(gcc -MM) | |
162 | MKDEP="$CC -MM" | |
163 | elif test ! -z "$MKDEP"; then | |
164 | AC_MSG_RESULT(mkdep) | |
165 | ||
166 | dnl Tru64's mkdep is very loud | |
167 | if test -z "$Tru"; then | |
168 | STDOUT="" | |
169 | else | |
170 | STDOUT=" 2> /dev/null" | |
171 | fi | |
172 | elif test "$SunWorkShop" = yes; then | |
173 | AC_MSG_RESULT($CC -xM) | |
174 | MKDEP="$CC -xM" | |
175 | STDOUT="> .depend 2> /dev/null" | |
176 | elif test ! -z "$MAKEDEPEND"; then | |
177 | AC_MSG_RESULT(makedepend) | |
178 | MKDEP="$MAKEDEPEND -f-" | |
179 | else | |
180 | AC_MSG_RESULT([nothing suitable.. forget it!]) | |
181 | MKDEP=":" | |
182 | fi | |
183 | ||
184 | AC_SUBST(MKDEP) | |
185 | AC_SUBST(STDOUT) | |
186 | ||
187 | dnl check for /dev/null so we can use it to hold evil fd's | |
188 | AC_MSG_CHECKING([for /dev/null]) | |
189 | if test -c /dev/null ; then | |
190 | AC_DEFINE(PATH_DEVNULL, "/dev/null", [Path to /dev/null]) | |
191 | AC_MSG_RESULT(yes) | |
192 | else | |
193 | AC_DEFINE(PATH_DEVNULL, "devnull.log", [Path to /dev/null]) | |
194 | AC_MSG_RESULT(no - using devnull.log) | |
195 | fi | |
196 | ||
197 | dnl jdc -- If CFLAGS is defined, best use it everywhere... | |
198 | dnl NOTE: jv says it must be added to the *END*, because things like | |
199 | dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid. | |
200 | if test ! -z "$CFLAGS"; then | |
201 | IRC_CFLAGS="$IRC_CFLAGS $CFLAGS" | |
202 | fi | |
203 | ||
204 | AC_ISC_POSIX | |
205 | AC_C_INLINE | |
206 | AC_PROG_GCC_TRADITIONAL | |
207 | AC_PROG_MAKE_SET | |
208 | AC_PROG_INSTALL | |
209 | AC_PATH_PROG(RM, rm) | |
210 | AC_PATH_PROG(CP, cp) | |
211 | AC_PATH_PROG(MV, mv) | |
212 | AC_PATH_PROG(LN, ln) | |
213 | AC_PATH_PROG(SED, sed) | |
214 | AC_PATH_PROG(AR, ar) | |
215 | AC_PATH_PROG(LD, ld) | |
216 | AC_PATH_PROG(RANLIB, ranlib) | |
217 | AC_PATH_PROG(TOUCH, touch) | |
218 | ||
219 | AC_PROG_YACC | |
220 | ||
221 | dnl AC_PROG_YACC defaults to yacc unconditionally if nothing can be found | |
222 | if test "$YACC" = "yacc" -a -z "`which $YACC 2>/dev/null`"; then | |
223 | AC_MSG_ERROR([could not locate a suitable parser generator; install bison, yacc, or byacc]) | |
224 | fi | |
225 | ||
226 | AC_PROG_LEX | |
227 | ||
228 | if test "$LEX" = ":"; then | |
229 | AC_MSG_ERROR([could not locate a suitable lexical generator, install flex or lex.]) | |
230 | fi | |
231 | ||
232 | dnl use directory structure of cached as default (hack) | |
233 | if test "$libexecdir" = '${exec_prefix}/libexec' && | |
234 | test "$localstatedir" = '${prefix}/var'; then | |
235 | libexecdir='${bindir}' | |
236 | localstatedir='${prefix}' | |
237 | fi | |
238 | ||
239 | dnl Checks for header files. | |
240 | AC_HEADER_STDC | |
241 | ||
242 | AC_CHECK_HEADERS([crypt.h sys/resource.h sys/param.h errno.h sys/syslog.h stddef.h sys/wait.h wait.h sys/epoll.h sys/uio.h machine/endian.h]) | |
243 | ||
244 | dnl Stuff that the memory manager (imalloc) depends on | |
245 | dnl ================================================== | |
246 | ||
247 | AC_C_CONST | |
248 | if test "$ac_cv_header_machine_endian_h" = "no" ; then | |
249 | AC_C_BIGENDIAN | |
250 | fi | |
251 | AC_TYPE_PID_T | |
252 | AC_TYPE_SIZE_T | |
253 | AC_CHECK_SIZEOF(short) | |
254 | AC_CHECK_SIZEOF(int) | |
255 | AC_CHECK_SIZEOF(long) | |
256 | AC_CHECK_SIZEOF(long long) | |
257 | ||
258 | dnl Networking Functions | |
259 | dnl ==================== | |
260 | ||
261 | AC_SEARCH_LIBS(socket, socket, , [AC_MSG_ERROR([You have no socket()! Aborting.])]) | |
262 | ||
263 | dnl SunOS/Solaris required libnsl for inet_ntoa() | |
264 | if test x"$SUN" = xyes; then | |
265 | AC_SEARCH_LIBS(inet_ntoa, nsl,, [AC_MSG_ERROR([libnsl not found! Aborting.])]) | |
266 | fi | |
267 | ||
268 | AC_CHECK_TYPE(socklen_t, , | |
269 | [AC_DEFINE([socklen_t], [unsigned int], | |
270 | [If we don't have a real socklen_t, unsigned int is good enough.])], | |
271 | [#include <sys/types.h> | |
272 | #include <sys/socket.h>]) | |
273 | ||
274 | AC_ARG_ENABLE(ipv6, | |
275 | AC_HELP_STRING([--enable-ipv6],[Enable IPv6 support]),[ipv6=$enableval],[ipv6=no]) | |
276 | ||
277 | AC_SEARCH_LIBS(crypt, [crypt descrypt],,) | |
278 | ||
279 | CRYPT_LIB=$ac_cv_search_crypt | |
280 | ||
281 | if test "$CRYPT_LIB" = "none required"; then | |
282 | unset CRYPT_LIB | |
283 | elif test "$CRYPT_LIB" = no; then | |
284 | unset CRYPT_LIB | |
285 | fi | |
286 | ||
287 | AC_SUBST(CRYPT_LIB) | |
288 | ||
289 | if test "$ac_cv_header_sys_wait_h" = yes -o "$ac_cv_header_wait_h" = yes; then | |
290 | VICONF=viconf | |
291 | dnl We need one of the above to build viconf. Just a sanity check, | |
292 | dnl we don't want to stop people from building the rest of ircd | |
293 | dnl just because they can't build viconf. | |
294 | else | |
295 | VICONF="" | |
296 | fi | |
297 | ||
298 | AC_SUBST(VICONF) | |
299 | ||
300 | dnl See whether we can include both string.h and strings.h. | |
301 | AC_CACHE_CHECK([whether string.h and strings.h may both be included], | |
302 | gcc_cv_header_string, | |
303 | [ | |
304 | AC_COMPILE_IFELSE( | |
305 | [#include <string.h> | |
306 | #include <strings.h>], | |
307 | [gcc_cv_header_string=yes], | |
308 | [gcc_cv_header_string=no]) | |
309 | ]) | |
310 | ||
311 | if test "$gcc_cv_header_string" = "yes"; then | |
312 | AC_DEFINE(STRING_WITH_STRINGS, 1, [Define to 1 if string.h may be included along with strings.h]) | |
313 | fi | |
314 | ||
315 | AC_C_BIGENDIAN | |
316 | ||
317 | dnl Check for stdarg.h - if we can't find it, halt configure | |
318 | AC_CHECK_HEADER(stdarg.h, , [AC_MSG_ERROR([** stdarg.h could not be found - ircd-ratbox will not compile without it **])]) | |
319 | ||
320 | dnl Checks for the existence of strlcat, strlcpy, basename... | |
321 | dnl This more reliable test only works with gcc though. | |
322 | ||
323 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
324 | ||
325 | AC_MSG_CHECKING(for strlcpy) | |
326 | save_CFLAGS=$CFLAGS | |
327 | CFLAGS="$CFLAGS -Wimplicit -Werror" | |
328 | ||
329 | AC_LINK_IFELSE( | |
330 | [AC_LANG_PROGRAM( | |
331 | [[#include <string.h> | |
332 | #include <stdlib.h>]], | |
333 | [[char *a = malloc(6); | |
334 | strlcpy(a, "hello", 6);]] | |
335 | )], | |
336 | [AC_MSG_RESULT(yes) | |
337 | AC_DEFINE(HAVE_STRLCPY, 1, [Define if strlcpy is available (most BSDs.)])], | |
338 | [AC_MSG_RESULT(no)] | |
339 | ) | |
340 | ||
341 | AC_MSG_CHECKING(for strlcat) | |
342 | AC_LINK_IFELSE( | |
343 | [AC_LANG_PROGRAM( | |
344 | [[#include <string.h> | |
345 | #include <stdlib.h>]], | |
346 | [[char *a = malloc(6); | |
347 | a[0] = '\0'; | |
348 | strlcat(a, "hello", 6);]] | |
349 | )], | |
350 | [AC_MSG_RESULT(yes) | |
351 | AC_DEFINE(HAVE_STRLCAT, 1, [Define if strlcat is available (most BSDs.)])], | |
352 | [AC_MSG_RESULT(no)] | |
353 | ) | |
354 | ||
355 | CFLAGS=$save_CFLAGS | |
356 | ||
357 | else | |
358 | ||
359 | dnl Better than nothing. The more complicated test above probably fixes powerpc, | |
360 | dnl so who cares. | |
361 | ||
362 | AC_CHECK_FUNCS([strlcat strlcpy]) | |
363 | ||
364 | fi | |
365 | ||
366 | AC_CHECK_TYPE([u_int32_t], [], | |
367 | [ | |
368 | AC_CHECK_TYPE([uint32_t], | |
369 | [ | |
370 | AC_DEFINE(u_int32_t, [uint32_t], [If system does not define u_int32_t, define a reasonable substitute.]) | |
371 | ], | |
372 | [ | |
373 | AC_MSG_WARN([system has no u_int32_t or uint32_t, default to unsigned long int]) | |
374 | AC_DEFINE(u_int32_t, [unsigned long int], [If system does not define u_int32_t, define to unsigned long int here.]) | |
375 | ]) | |
376 | ]) | |
377 | ||
378 | AC_CHECK_TYPE([u_int16_t], [], | |
379 | [ | |
380 | AC_CHECK_TYPE([uint16_t], | |
381 | [ | |
382 | AC_DEFINE(u_int16_t, [uint16_t], [If system does not define u_int16_t, define a usable substitute]) | |
383 | ], | |
384 | [ | |
385 | AC_MSG_WARN([system has no u_int16_t or uint16_t, default to unsigned short int]) | |
386 | AC_DEFINE(u_int16_t, [unsigned short int], [If system does not define u_int16_t, define a usable substitute.]) | |
387 | ]) | |
388 | ]) | |
389 | ||
390 | AC_CHECK_TYPE([in_port_t], [], | |
391 | [AC_DEFINE(in_port_t, [u_int16_t], [If system does not define in_port_t, define it to what it should be.])], | |
392 | [[#include <sys/types.h> | |
393 | #include <netinet/in.h>]]) | |
394 | ||
395 | AC_CHECK_TYPE([sa_family_t], [], | |
396 | [AC_DEFINE(sa_family_t, [u_int16_t], [If system does not define sa_family_t, define it here.])], | |
397 | [[#include <sys/types.h> | |
398 | #include <sys/socket.h>]]) | |
399 | ||
400 | AC_CHECK_TYPES([uintptr_t]) | |
401 | ||
402 | dnl check for various functions... | |
403 | AC_CHECK_FUNCS([socketpair vsnprintf mmap gettimeofday strdup strndup ]) | |
404 | ||
405 | AC_FUNC_ALLOCA | |
406 | ||
407 | dnl Specialized functions checks | |
408 | dnl ============================ | |
409 | ||
410 | dnl check for nanosleep | |
411 | AC_CHECK_FUNC(nanosleep,,[AC_CHECK_LIB(rt,nanosleep, | |
412 | LIBS="${LIBS} -lrt", | |
413 | [AC_CHECK_LIB(posix4,nanosleep, LIBS="${LIBS} -lposix4" | |
414 | )])]) | |
415 | if test x$ac_cv_func_nanosleep = xno && test x$ac_cv_lib_posix4_nanosleep = xno && test x$ac_cv_lib_rt_nanosleep = xno | |
416 | then | |
417 | AC_MSG_RESULT("nanosleep not found..using select for delay") | |
418 | else | |
419 | AC_DEFINE([HAVE_NANOSLEEP], 1, [Define if nanosleep exists]) | |
420 | fi | |
421 | ||
422 | dnl OpenSSL support | |
423 | AC_MSG_CHECKING(for OpenSSL) | |
424 | AC_ARG_ENABLE(openssl, | |
425 | [AC_HELP_STRING([--enable-openssl[=DIR]],[Enable OpenSSL support (DIR optional).]) | |
426 | AC_HELP_STRING([--disable-openssl],[Disable OpenSSL support.])], | |
427 | [cf_enable_openssl=$enableval], | |
428 | [cf_enable_openssl="auto"]) | |
429 | ||
430 | if test "$cf_enable_openssl" != "no" ; then | |
431 | cf_openssl_basedir="" | |
432 | if test "$cf_enable_openssl" != "auto" && | |
433 | test "$cf_enable_openssl" != "yes" ; then | |
434 | dnl Support for --enable-openssl=/some/place | |
435 | cf_openssl_basedir="`echo ${cf_enable_openssl} | sed 's/\/$//'`" | |
436 | else | |
437 | dnl Do the auto-probe here. Check some common directory paths. | |
438 | for dirs in /usr/local/ssl /usr/pkg /usr/local \ | |
439 | /usr/local/openssl ; do | |
440 | if test -f "${dirs}/include/openssl/opensslv.h" ; then | |
441 | cf_openssl_basedir="${dirs}" | |
442 | break | |
443 | fi | |
444 | done | |
445 | unset dirs | |
446 | fi | |
447 | dnl Now check cf_openssl_found to see if we found anything. | |
448 | if test ! -z "$cf_openssl_basedir"; then | |
449 | if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h" ; then | |
450 | SSL_INCLUDES="-I${cf_openssl_basedir}/include" | |
451 | SSL_LIBS="-L${cf_openssl_basedir}/lib" | |
452 | else | |
453 | dnl OpenSSL wasn't found in the directory specified. Naughty | |
454 | dnl administrator... | |
455 | cf_openssl_basedir="" | |
456 | fi | |
457 | else | |
458 | dnl Check for stock FreeBSD 4.x and 5.x systems, since their files | |
459 | dnl are in /usr/include and /usr/lib. In this case, we don't want to | |
460 | dnl change INCLUDES or LIBS, but still want to enable OpenSSL. | |
461 | dnl We can't do this check above, because some people want two versions | |
462 | dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl) | |
463 | dnl and they want /usr/local/ssl to have preference. | |
464 | if test -f "/usr/include/openssl/opensslv.h" ; then | |
465 | cf_openssl_basedir="/usr" | |
466 | fi | |
467 | fi | |
468 | ||
469 | dnl If we have a basedir defined, then everything is okay. Otherwise, | |
470 | dnl we have a problem. | |
471 | if test ! -z "$cf_openssl_basedir"; then | |
472 | AC_MSG_RESULT($cf_openssl_basedir) | |
473 | cf_enable_openssl="yes" | |
474 | else | |
475 | AC_MSG_RESULT([not found. Specify a correct path?]) | |
476 | cf_enable_openssl="no" | |
477 | fi | |
478 | unset cf_openssl_basedir | |
479 | else | |
480 | dnl If --disable-openssl was specified | |
481 | AC_MSG_RESULT(disabled) | |
482 | fi | |
483 | ||
484 | save_CPPFLAGS="$CPPFLAGS" | |
485 | CPPFLAGS="$CPPFLAGS $SSL_INCLUDES" | |
486 | save_LIBS="$LIBS" | |
487 | LIBS="$LIBS $SSL_LIBS" | |
488 | if test "$cf_enable_openssl" != no; then | |
489 | dnl Check OpenSSL version (must be 0.9.6 or above!) | |
490 | AC_MSG_CHECKING(for OpenSSL 0.9.6 or above) | |
491 | AC_RUN_IFELSE( | |
492 | AC_LANG_PROGRAM( | |
493 | [#include <openssl/opensslv.h> | |
494 | #include <stdlib.h>], | |
495 | [[if ( OPENSSL_VERSION_NUMBER >= 0x00906000) | |
496 | exit(0); else exit(1);]]), | |
497 | cf_openssl_version_ok=yes, | |
498 | cf_openssl_version_ok=no, | |
499 | cf_openssl_version_ok=no) | |
500 | ||
501 | if test "$cf_openssl_version_ok" = yes; then | |
502 | AC_MSG_RESULT(found) | |
503 | ||
504 | dnl Work around pmake/gmake conditional incompatibilities | |
505 | AC_SUBST(ENCSPEED, encspeed) | |
506 | ||
507 | dnl Do all the HAVE_LIBCRYPTO magic -- and check for ciphers | |
508 | CPPFLAGS="$CPPFLAGS $SSL_LIBS" | |
509 | AC_CHECK_LIB(crypto, RSA_free) | |
510 | SSL_LIBS="$SSL_LIBS -lcrypto" | |
511 | SSL_SRCS_ENABLE='$(SSL_SRCS)' | |
512 | else | |
513 | AC_MSG_RESULT(no - OpenSSL support disabled) | |
514 | fi | |
515 | fi | |
516 | ||
517 | CPPFLAGS="$save_CPPFLAGS" | |
518 | LIBS="$save_LIBS" | |
519 | ||
520 | dnl End OpenSSL detection | |
521 | ||
522 | ||
523 | dnl Specialized functions and libraries | |
524 | dnl =================================== | |
525 | ||
526 | AC_ARG_WITH(zlib-path, | |
527 | AC_HELP_STRING([--with-zlib-path=DIR],[Path to libz.so for ziplinks support.]), | |
528 | [LIBS="$LIBS -L$withval"],) | |
529 | ||
530 | AC_ARG_ENABLE(zlib, | |
531 | AC_HELP_STRING([--disable-zlib],[Disable ziplinks support]), | |
532 | [zlib=$enableval],[zlib=yes]) | |
533 | ||
534 | if test "$zlib" = yes; then | |
535 | ||
536 | AC_CHECK_HEADER(zlib.h, [ | |
537 | AC_CHECK_LIB(z, zlibVersion, | |
538 | [ | |
539 | AC_SUBST(ZLIB_LD, -lz) | |
540 | AC_DEFINE(HAVE_LIBZ, 1, [Define to 1 if zlib (-lz) is available.]) | |
541 | ], zlib=no) | |
542 | ], zlib=no) | |
543 | ||
544 | fi | |
545 | ||
546 | dnl IO Loop Selection | |
547 | dnl ================= | |
548 | ||
549 | AC_ARG_ENABLE(ports, AC_HELP_STRING([--enable-ports],[Force solaris I/O ports subsystem usage.]), | |
550 | [ if test $enableval = yes; then | |
551 | SELECT_TYPE_EXPLICIT="ports" | |
552 | else | |
553 | use_ports=no | |
554 | fi | |
555 | ],) | |
556 | ||
557 | AC_ARG_ENABLE(poll, AC_HELP_STRING([--enable-poll],[Force poll() usage.]), | |
558 | [ if test $enableval = yes; then | |
559 | SELECT_TYPE_EXPLICIT="poll" | |
560 | else | |
561 | use_poll=no | |
562 | fi | |
563 | ],) | |
564 | ||
565 | AC_ARG_ENABLE(select, AC_HELP_STRING([--enable-select],[Force select() usage.]), | |
566 | [ if test $enableval = yes; then | |
567 | SELECT_TYPE_EXPLICIT="select" | |
568 | else | |
569 | use_select=no | |
570 | fi | |
571 | ],) | |
572 | ||
573 | AC_ARG_ENABLE(kqueue, AC_HELP_STRING([--enable-kqueue],[Force kqueue() usage.]), | |
574 | [ if test $enableval = yes; then | |
575 | SELECT_TYPE_EXPLICIT="kqueue" | |
576 | else | |
577 | use_kqueue=no | |
578 | fi | |
579 | ],) | |
580 | ||
581 | AC_ARG_ENABLE(epoll, AC_HELP_STRING([--enable-epoll],[Force sys_epoll usage (Linux only).]), | |
582 | [ if test $enableval = yes; then | |
583 | SELECT_TYPE_EXPLICIT="epoll" | |
584 | AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no]) | |
585 | else | |
586 | use_epoll=no | |
587 | fi | |
588 | ],) | |
589 | ||
590 | dnl ********************************************************************** | |
591 | dnl Check for --with-confdir | |
592 | dnl ********************************************************************** | |
593 | ||
594 | AC_MSG_CHECKING([whether to modify confdir]) | |
595 | AC_ARG_WITH(confdir, | |
596 | AC_HELP_STRING([--with-confdir=DIR], | |
597 | [Directory to install config files.]), | |
598 | [ confdir=`echo $withval | sed 's/\/$//'` | |
599 | AC_MSG_RESULT(yes) | |
600 | AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.]) | |
601 | AC_SUBST_DIR([confdir]) ], | |
602 | [ confdir='${prefix}/etc' | |
603 | AC_MSG_RESULT(no) | |
604 | AC_DEFINE_DIR(ETC_DIR, confdir, [Prefix where config files are installed.]) | |
605 | AC_SUBST_DIR([confdir])] | |
606 | ) | |
607 | ||
608 | dnl ********************************************************************** | |
609 | dnl Check for --with-logdir | |
610 | dnl ********************************************************************** | |
611 | ||
612 | AC_MSG_CHECKING([whether to modify logdir]) | |
613 | AC_ARG_WITH(logdir, | |
614 | AC_HELP_STRING([--with-logdir=DIR], | |
615 | [Directory where to write logfiles.]), | |
616 | [ logdir=`echo $withval | sed 's/\/$//'` | |
617 | AC_MSG_RESULT(yes) | |
618 | AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.]) | |
619 | AC_SUBST_DIR([logdir]) ], | |
620 | [ logdir='${prefix}/logs' | |
621 | AC_MSG_RESULT(no) | |
622 | AC_DEFINE_DIR(LOG_DIR, logdir, [Prefix where to write logfiles.]) | |
623 | AC_SUBST_DIR([logdir])] | |
624 | ) | |
625 | ||
626 | dnl ********************************************************************** | |
627 | dnl Check for --with-helpdir | |
628 | dnl ********************************************************************** | |
629 | ||
630 | AC_MSG_CHECKING([whether to modify helpdir]) | |
631 | AC_ARG_WITH(helpdir, | |
632 | AC_HELP_STRING([--with-helpdir=DIR], | |
633 | [Directory to install help files.]), | |
634 | [ helpdir=`echo $withval | sed 's/\/$//'` | |
635 | AC_MSG_RESULT(yes) | |
636 | AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help files are installed.]) | |
637 | AC_SUBST_DIR([helpdir]) ], | |
638 | [ helpdir='${prefix}/help' | |
639 | AC_MSG_RESULT(no) | |
640 | AC_DEFINE_DIR(HELP_DIR, helpdir, [Prefix where help file are installed.]) | |
641 | AC_SUBST_DIR([helpdir])] | |
642 | ) | |
643 | ||
644 | dnl ********************************************************************** | |
645 | dnl Check for --with-moduledir | |
646 | dnl ********************************************************************** | |
647 | ||
648 | AC_MSG_CHECKING([whether to modify moduledir]) | |
649 | AC_ARG_WITH(moduledir, | |
650 | AC_HELP_STRING([--with-moduledir=DIR], | |
651 | [Directory to install modules.]), | |
652 | [ moduledir=`echo $withval | sed 's/\/$//'` | |
653 | AC_MSG_RESULT(yes) | |
654 | AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) | |
655 | AC_SUBST_DIR([moduledir]) ], | |
656 | [ moduledir='${prefix}/modules' | |
657 | AC_MSG_RESULT(no) | |
658 | AC_DEFINE_DIR(MODULE_DIR, moduledir, [Prefix where modules are installed.]) | |
659 | AC_SUBST_DIR([moduledir])] | |
660 | ) | |
661 | ||
662 | if test ! -z "$SELECT_TYPE_EXPLICIT"; then | |
663 | SELECT_TYPE="$SELECT_TYPE_EXPLICIT"; | |
664 | echo "Forcing $SELECT_TYPE to be enabled" | |
665 | else | |
666 | ||
667 | if test ! "x$use_ports" = "xno"; then | |
668 | AC_CHECK_FUNCS(port_getn, [haveports=yes], [haveports=no]) | |
669 | if test "x$haveports" = "xyes" ; then | |
670 | SELECT_TYPE="ports" | |
671 | fi | |
672 | fi | |
673 | ||
674 | if test ! "x$use_select" = "xno"; then | |
675 | AC_CHECK_FUNCS(select, [haveselect=yes], [haveselect=no]) | |
676 | if test "x$haveselect" = "xyes" ; then | |
677 | SELECT_TYPE="select" | |
678 | fi | |
679 | fi | |
680 | ||
681 | if test ! "x$use_poll" = "xno"; then | |
682 | AC_CHECK_FUNCS(poll, [havepoll=yes], [havepoll=no]) | |
683 | if test "x$havepoll" = "xyes" ; then | |
684 | SELECT_TYPE="poll" | |
685 | fi | |
686 | fi | |
687 | ||
688 | if test ! "x$use_kqueue" = "xno"; then | |
689 | AC_CHECK_FUNCS(kevent, [havekqueue=yes], [havekqueue=no]) | |
690 | if test "x$havekqueue" = "xyes" ; then | |
691 | SELECT_TYPE="kqueue" | |
692 | fi | |
693 | fi | |
694 | ||
695 | if test ! "x$use_epoll" = "xno"; then | |
696 | AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], [haveepoll=no]) | |
697 | if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then | |
698 | if test "x$haveepoll" = "xyes" ; then | |
699 | AC_MSG_CHECKING(for epoll support in kernel) | |
700 | AC_TRY_RUN( | |
701 | #include <stdint.h> | |
702 | #include <sys/param.h> | |
703 | #include <sys/types.h> | |
704 | #include <sys/epoll.h> | |
705 | #include <sys/syscall.h> | |
706 | #include <unistd.h> | |
707 | ||
708 | int | |
709 | main(int argc, char **argv) | |
710 | { | |
711 | int epfd; | |
712 | ||
713 | epfd = epoll_create(256); | |
714 | return (epfd == -1 ? 1 : 0); | |
715 | }, [AC_MSG_RESULT(yes) | |
716 | AC_DEFINE(HAVE_EPOLL, 1, | |
717 | [Define if your system supports the epoll system calls]) | |
718 | SELECT_TYPE="epoll"], | |
719 | AC_MSG_RESULT(no), AC_MSG_RESULT(no)) | |
720 | fi | |
721 | fi | |
722 | ||
723 | haveepollsyscall=no | |
724 | ||
725 | if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then | |
726 | if test "x$haveepoll" = "xno" ; then | |
727 | AC_MSG_CHECKING(for epoll system call) | |
728 | AC_TRY_RUN( | |
729 | #include <stdint.h> | |
730 | #include <sys/param.h> | |
731 | #include <sys/types.h> | |
732 | #include <sys/epoll.h> | |
733 | #include <sys/syscall.h> | |
734 | #include <unistd.h> | |
735 | ||
736 | int | |
737 | epoll_create(int size) | |
738 | { | |
739 | return (syscall(__NR_epoll_create, size)); | |
740 | } | |
741 | ||
742 | int | |
743 | main(int argc, char **argv) | |
744 | { | |
745 | int epfd; | |
746 | ||
747 | epfd = epoll_create(256); | |
748 | exit (epfd == -1 ? 1 : 0); | |
749 | }, [AC_MSG_RESULT(yes) | |
750 | AC_DEFINE(HAVE_EPOLL, 1, | |
751 | [Define if your system supports the epoll system calls]) | |
752 | SELECT_TYPE="epoll"], | |
753 | AC_MSG_RESULT(no), AC_MSG_RESULT(no)) | |
754 | fi | |
755 | fi | |
756 | ||
757 | fi | |
758 | ||
759 | fi | |
760 | ||
761 | if test -z "$SELECT_TYPE"; then | |
762 | AC_MSG_ERROR([Unable to find a usable IO interface],) | |
763 | fi | |
764 | ||
765 | echo "Using $SELECT_TYPE for select loop." | |
766 | ||
767 | AC_DEFINE_UNQUOTED(SELECT_TYPE, "$SELECT_TYPE", [This is the type of IO loop we are using]) | |
768 | AC_SUBST(SELECT_TYPE) | |
769 | ||
770 | ||
771 | dnl Debug-related options | |
772 | dnl ===================== | |
773 | ||
774 | AC_ARG_ENABLE(assert, | |
775 | AC_HELP_STRING([--enable-assert],[Enable assert(). Choose between soft(warnings) and hard(aborts the daemon)]), | |
776 | [assert=$enableval], [assert=no]) | |
777 | ||
778 | if test "$assert" = no; then | |
779 | AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) | |
780 | elif test "$assert" = soft; then | |
781 | AC_DEFINE(SOFT_ASSERT, 1, [Define this to enable soft asserts.]) | |
782 | AC_DEFINE(NDEBUG, 1, [Define this to disable debugging support.]) | |
783 | elif test "$assert" = yes; then | |
784 | assert = "hard"; | |
785 | fi | |
786 | ||
787 | AC_MSG_CHECKING(if you want IO Debugging hooks) | |
788 | AC_ARG_ENABLE(iodebug, | |
789 | AC_HELP_STRING([--enable-iodebug],[Enable IO Debugging hooks]), | |
790 | [iodebug=$enableval], [iodebug=no]) | |
791 | ||
792 | if test "$iodebug" = yes; then | |
793 | AC_DEFINE(USE_IODEBUG_HOOKS, 1, [Define this to enable IO Debug hooks.]) | |
794 | AC_MSG_RESULT(yes) | |
795 | else | |
796 | AC_MSG_RESULT(no) | |
797 | fi | |
798 | ||
799 | ||
800 | AC_MSG_CHECKING(if you want to do a profile build) | |
801 | AC_ARG_ENABLE(profile, | |
802 | AC_HELP_STRING([--enable-profile],[Enable profiling]), | |
803 | [profile=$enableval], [profile=no]) | |
804 | ||
805 | if test "$profile" = yes; then | |
806 | if test "$ac_cv_c_compiler_gnu" = yes; then | |
807 | IRC_CFLAGS="$IRC_CFLAGS -pg" | |
808 | AC_MSG_RESULT([yes, adding -pg]) | |
809 | AC_DEFINE(CHARYBDIS_PROFILE, 1, [Define this if you are profiling.]) | |
810 | else | |
811 | AC_MSG_RESULT([no, profile builds only work with gcc]) | |
812 | fi | |
813 | else | |
814 | AC_MSG_RESULT(no) | |
815 | fi | |
816 | ||
817 | AC_ARG_ENABLE(balloc, | |
818 | AC_HELP_STRING([--disable-balloc],[Disable the block allocator.]), | |
819 | [balloc=$enableval], [balloc=yes]) | |
820 | ||
821 | if test "$balloc" = no; then | |
822 | AC_DEFINE([NOBALLOC], 1, [Define to 1 if you wish to disable the block allocator.]) | |
823 | fi | |
824 | ||
825 | AC_ARG_ENABLE(small-net, | |
826 | AC_HELP_STRING([--enable-small-net],[Enable small network support.]), | |
827 | [small_net=$enableval], [small_net=no]) | |
828 | ||
829 | if test "$small_net" = yes; then | |
830 | dnl AC_DEFINE([HASHSIZE], 4096, [Max number of buckets in hash tables.]) | |
831 | AC_DEFINE([NICKNAMEHISTORYLENGTH], 1500, [Size of the WHOWAS array.]) | |
832 | AC_DEFINE([CHANNEL_HEAP_SIZE], 256, [Size of the channel heap.]) | |
833 | AC_DEFINE([BAN_HEAP_SIZE], 128, [Size of the ban heap.]) | |
834 | AC_DEFINE([CLIENT_HEAP_SIZE], 256, [Size of the client heap.]) | |
835 | AC_DEFINE([LCLIENT_HEAP_SIZE], 128, [Size of the local client heap.]) | |
836 | AC_DEFINE([PCLIENT_HEAP_SIZE], 32, [Size of the pre-client heap.]) | |
837 | AC_DEFINE([USER_HEAP_SIZE], 128, [Size of the user heap.]) | |
838 | AC_DEFINE([DNODE_HEAP_SIZE], 256, [Size of the dlink_node heap.]) | |
839 | AC_DEFINE([TOPIC_HEAP_SIZE], 256, [Size of the topic heap.]) | |
840 | AC_DEFINE([LINEBUF_HEAP_SIZE], 128, [Size of the linebuf heap.]) | |
841 | AC_DEFINE([MEMBER_HEAP_SIZE], 256, [Sizeof member heap.]) | |
842 | AC_DEFINE([ND_HEAP_SIZE], 128, [Size of the nick delay heap.]) | |
843 | AC_DEFINE([CONFITEM_HEAP_SIZE], 128, [Size of the confitem heap.]) | |
844 | AC_DEFINE([MONITOR_HEAP_SIZE], 128, [Size of the monitor heap.]) | |
845 | AC_DEFINE([FD_HEAP_SIZE], 128, [Size of fd heap.]) | |
846 | AC_DEFINE([AWAY_HEAP_SIZE], 128, [Size of away heap.]) | |
847 | else | |
848 | dnl These settings are for a large network like efnet..they will use lots of memory | |
849 | dnl so enable small net unless you really need this much support | |
850 | AC_DEFINE([NICKNAMEHISTORYLENGTH], 15000, [Size of the WHOWAS array.]) | |
851 | AC_DEFINE([CHANNEL_HEAP_SIZE], 8192, [Size of the channel heap.]) | |
852 | AC_DEFINE([BAN_HEAP_SIZE], 4096, [Size of the ban heap.]) | |
853 | AC_DEFINE([CLIENT_HEAP_SIZE], 8192, [Size of the client heap.]) | |
854 | AC_DEFINE([LCLIENT_HEAP_SIZE], 1024, [Size of the local client heap.]) | |
855 | AC_DEFINE([PCLIENT_HEAP_SIZE], 256, [Size of the pre-client heap.]) | |
856 | AC_DEFINE([USER_HEAP_SIZE], 8192, [Size of the user heap.]) | |
857 | AC_DEFINE([DNODE_HEAP_SIZE], 8192, [Size of the dlink_node heap.]) | |
858 | AC_DEFINE([TOPIC_HEAP_SIZE], 4096, [Size of the topic heap.]) | |
859 | AC_DEFINE([LINEBUF_HEAP_SIZE], 2048, [Size of the linebuf heap.]) | |
860 | AC_DEFINE([MEMBER_HEAP_SIZE], 32768, [Sizeof member heap.]) | |
861 | AC_DEFINE([ND_HEAP_SIZE], 512, [Size of the nick delay heap.]) | |
862 | AC_DEFINE([CONFITEM_HEAP_SIZE], 256, [Size of the confitem heap.]) | |
863 | AC_DEFINE([MONITOR_HEAP_SIZE], 1024, [Size of the monitor heap.]) | |
864 | AC_DEFINE([FD_HEAP_SIZE], 1024, [Size of fd heap.]) | |
865 | AC_DEFINE([AWAY_HEAP_SIZE], 512, [Size of away heap.]) | |
866 | fi | |
867 | ||
868 | AC_ARG_WITH(nicklen, | |
869 | AC_HELP_STRING([--with-nicklen=LENGTH],[Set the nick length to LENGTH (default 15, max 50)]), | |
870 | [ | |
871 | if test $withval -ge 50; then | |
872 | NICKLEN=50 | |
873 | AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50]) | |
874 | else | |
875 | NICKLEN="$withval" | |
876 | fi | |
877 | ], [NICKLEN=15]) | |
878 | ||
879 | AC_ARG_WITH(topiclen, | |
880 | AC_HELP_STRING([--with-topiclen=NUMBER],[Set the max topic length to NUMBER (default 390, max 390)]), | |
881 | [ | |
882 | if test $withval -ge 390; then | |
883 | TOPICLEN=390 | |
884 | AC_MSG_WARN([TOPICLEN has a hard limit of 390. Setting TOPICLEN=390]) | |
885 | else | |
886 | TOPICLEN=$withval | |
887 | fi | |
888 | ], [TOPICLEN=390]) | |
889 | ||
890 | AC_DEFINE_UNQUOTED(TOPICLEN, ${TOPICLEN}, [Maximum topic length (<=390)]) | |
891 | AC_DEFINE_UNQUOTED(NICKLEN, (${NICKLEN}+1), [Nickname length]) | |
892 | ||
893 | shared_modules="yes" | |
894 | dnl Some first-stage sanity checks. | |
895 | if test "$shared_modules" = yes; then | |
896 | ||
897 | if test "$CYGWIN" = yes; then | |
898 | AC_MSG_WARN([disabling shared modules; Cygwin is at present unable to build them.]) | |
899 | shared_modules="no" | |
900 | fi | |
901 | ||
902 | dnl TenDRA's cc is called tcc too. | |
903 | if test "$CC" = tcc -a "$TenDRA" = "no"; then | |
904 | AC_MSG_WARN([disabling shared modules: Tiny C Compiler can't create PIC]) | |
905 | shared_modules="no" | |
906 | fi | |
907 | fi | |
908 | ||
909 | dnl Second stage: check for functions and headers. | |
910 | if test "$shared_modules" = yes; then | |
911 | DYNLINK_C=dynlink.c | |
912 | AC_CHECK_HEADERS(dlfcn.h) | |
913 | AC_SEARCH_LIBS(shl_load, dld, | |
914 | [ | |
915 | AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if the shl_load function is available.]) | |
916 | SUFFIX=".sl" | |
917 | MOD_TARGET=hpux_shared | |
918 | SEDOBJ="s/\.o/.sl/g" | |
919 | ], | |
920 | dnl !shl_load: | |
921 | [ | |
922 | dnl standard dlopen | |
923 | AC_SEARCH_LIBS(dlopen, [dl c_r], | |
924 | [ | |
925 | AC_DEFINE(HAVE_DLOPEN, 1, [Define if the dlopen function is available.]) | |
926 | SUFFIX=".so" | |
927 | MOD_TARGET=shared_modules | |
928 | SEDOBJ="s/\.o/.so/g" | |
929 | if test "$AppleGCC" = yes; then | |
930 | AC_CHECK_HEADERS([mach-o/dyld.h]) | |
931 | fi | |
932 | AC_CHECK_FUNC(dlsym, , | |
933 | [ | |
934 | AC_MSG_WARN([dlsym is not available, shared modules disabled]) | |
935 | shared_modules=no | |
936 | ]) | |
937 | AC_CHECK_FUNCS(dlfunc) | |
938 | ], | |
939 | [ | |
940 | shared_modules=no | |
941 | ]) | |
942 | ]) | |
943 | fi | |
944 | ||
945 | AC_DEFINE_UNQUOTED(SHARED_SUFFIX, "$SUFFIX", [Suffix for shared libraries on this platform.]) | |
946 | ||
947 | dnl Third stage - wrangling the linker. | |
948 | if test "$shared_modules" = yes; then | |
949 | # The GNU linker requires the -export-dynamic option to make | |
950 | # all symbols visible in the dynamic symbol table. | |
951 | hold_ldflags=$LDFLAGS | |
952 | AC_MSG_CHECKING(for the ld -export-dynamic flag) | |
953 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic -Werror" | |
954 | AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no) | |
955 | LDFLAGS=$hold_ldflags | |
956 | ||
957 | if expr "`uname -s`" : ^IRIX >/dev/null 2>&1; then | |
958 | found="no, IRIX ld uses -B,dynamic" | |
959 | LDFLAGS="${LDFLAGS} -Wl,-B,dynamic" | |
960 | fi | |
961 | ||
962 | if expr "`uname -s`" : ^AIX >/dev/null 2>&1; then | |
963 | found="no, AIX ld uses -G -brtl" | |
964 | LDFLAGS="${LDFLAGS} -Wl,-G,-brtl" | |
965 | fi | |
966 | ||
967 | AC_MSG_RESULT($found) | |
968 | ||
969 | if test "$found" = yes; then | |
970 | LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" | |
971 | fi | |
972 | ||
973 | AC_MSG_CHECKING(for compiler option to produce PIC) | |
974 | dnl The order should be here to check for groups of compilers, | |
975 | dnl then for odd compilers, then if no PICFLAGS were set up, | |
976 | dnl check for GCC and set defaults, or else error. -jmallett | |
977 | if test "$SGS" = "yes"; then | |
978 | AC_MSG_RESULT([SVR4 SGS interfaces: -KPIC -DPIC -G]) | |
979 | PICFLAGS="-KPIC -DPIC -G" | |
980 | fi | |
981 | ||
982 | if test "$AppleGCC" = "yes"; then | |
983 | AC_MSG_RESULT([Darwin Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress]) | |
984 | PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress" | |
985 | fi | |
986 | dnl Please note, that on HPUX two different stages of module compilation occurs, since | |
987 | dnl while compiling modules, the compiler does not allow you to give arguments | |
988 | dnl to the linker. (I did not design this) | |
989 | dnl So we need -c in the first stage of module compilation. | |
990 | dnl In the second stage, we link the modules via ld -b. | |
991 | dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead. | |
992 | dnl -TimeMr14C | |
993 | if test "$HPUX" = "yes" -a "$CC" != gcc; then | |
994 | AC_MSG_RESULT(HP-UX cc: +z -r -q -n) | |
995 | PICFLAGS="+z -r -q -n -c" | |
996 | AC_MSG_CHECKING([if +ESfic is required on this platform]) | |
997 | ||
998 | if expr "`$CC +ESfic 2>&1`" : ".*neither supported.*" >/dev/null; then | |
999 | AC_MSG_RESULT(no) | |
1000 | else | |
1001 | AC_MSG_RESULT(yes) | |
1002 | PICFLAGS="$PICFLAGS +ESfic" | |
1003 | fi | |
1004 | ||
1005 | LDFLAGS="${LDFLAGS} -Wl,-E" | |
1006 | fi | |
1007 | if test "$Tru" = yes -a "$CC" != gcc; then | |
1008 | AC_MSG_RESULT([Tru64: -shared -expect_unresolved '*']) | |
1009 | PICFLAGS="-shared -expect_unresolved '*' " | |
1010 | LDFLAGS="-call_shared" | |
1011 | fi | |
1012 | if test -z "$PICFLAGS"; then | |
1013 | if test "$ac_cv_c_compiler_gnu" = "yes"; then | |
1014 | AC_MSG_RESULT(gcc: -fPIC -DPIC -shared) | |
1015 | PICFLAGS="-fPIC -DPIC -shared" | |
1016 | else | |
1017 | AC_MSG_RESULT(no) | |
1018 | shared_modules=no | |
1019 | fi | |
1020 | fi | |
1021 | fi | |
1022 | ||
1023 | # rpath, for finding libratbox.so at run time | |
1024 | hold_ldflags=$LDFLAGS | |
1025 | AC_MSG_CHECKING(for the ld -rpath flag) | |
1026 | LDFLAGS="${LDFLAGS} -Wl,-rpath=${libdir}" | |
1027 | AC_LINK_IFELSE(AC_LANG_PROGRAM([],[int i;]), found=yes, found=no) | |
1028 | LDFLAGS=$hold_ldflags | |
1029 | AC_MSG_RESULT($found) | |
1030 | if test "$found" = yes; then | |
1031 | LDFLAGS="${LDFLAGS} -Wl,-rpath=\${libdir}" | |
1032 | fi | |
1033 | ||
1034 | # This must be down here, or it will mess up checks like the ones | |
1035 | # for -Wl,-export-dynamic | |
1036 | # -- jilles | |
1037 | CWARNS="" | |
1038 | AC_ARG_ENABLE(warnings, | |
1039 | AC_HELP_STRING([--enable-warnings],[Enable all sorts of warnings for debugging.]), | |
1040 | [ | |
1041 | IRC_CFLAGS="$IRC_CFLAGS -O0" | |
1042 | CFLAGS="$IRC_CFLAGS" | |
1043 | ||
1044 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wall], charybdis_cv_c_gcc_w_all) | |
1045 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wpointer-arith], charybdis_cv_c_gcc_w_pointer_arith) | |
1046 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wimplicit -Wnested-externs], charybdis_cv_c_gcc_w_implicit) | |
1047 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-align], charybdis_cv_c_gcc_w_cast_align) | |
1048 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wcast-qual], charybdis_cv_c_gcc_w_cast_qual) | |
1049 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wwrite-strings], charybdis_cv_c_gcc_w_write_strings) | |
1050 | CHARYBDIS_C_GCC_TRY_FLAGS([-Werror-implicit-function-declaration], charybdis_cv_c_gcc_w_error_implicit_function_declaration) | |
1051 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations], charybdis_cv_c_gcc_prototypes) | |
1052 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wparenthesis], charybdis_cv_c_gcc_parenthesis) | |
1053 | CHARYBDIS_C_GCC_TRY_FLAGS([-W -Wno-unused], charybdis_cv_c_gcc_w) | |
1054 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wextra], charybdis_cv_c_gcc_w_extra) | |
1055 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wshadow], charybdis_cv_c_gcc_w_shadow) | |
1056 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wmissing-noreturn], charybdis_cv_c_gcc_w_missing_noreturn) | |
1057 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wundef], charybdis_cv_c_gcc_w_undef) | |
1058 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wpacked], charybdis_cv_c_gcc_w_packed) | |
1059 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wnested-externs], charybdis_cv_c_gcc_w_nested_externs) | |
1060 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wbad-function-cast], charybdis_cv_c_gcc_w_bad_function_cast) | |
1061 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wunused-function -Wunused-label -Wunused-value -Wunused-variable], charybdis_cv_c_gcc_w_unused) | |
1062 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wredundant-decls], charybdis_cv_c_gcc_w_redundant_decls) | |
1063 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wfloat-equal], charybdis_cv_c_gcc_w_float_equal) | |
1064 | CHARYBDIS_C_GCC_TRY_FLAGS([-Wformat -Wformat-y2k -Wformat-security], charybdis_cv_c_gcc_w_format) | |
1065 | CHARYBDIS_C_GCC_TRY_FLAGS([-pedantic], charybdis_cv_c_gcc_pedantic) | |
1066 | ||
1067 | IRC_CFLAGS="$CFLAGS" | |
1068 | ],[]) | |
1069 | ||
1070 | if test "$shared_modules" = no; then | |
1071 | DYNLINK_C="" | |
1072 | MOD_TARGET="libmodules.a" | |
1073 | MODULES_LIBS="../modules/libmodules.a" | |
1074 | SEDOBJ="" | |
1075 | AC_DEFINE(STATIC_MODULES, 1, [Define to 1 if dynamic modules can't be used.]) | |
1076 | AC_MSG_WARN([shared module support has been disabled!]) | |
1077 | fi | |
1078 | ||
1079 | dnl Stage 5 - underscores in front of symbol names. | |
1080 | if test "$shared_modules" = yes; then | |
1081 | ||
1082 | AC_CHECK_FUNC(nlist,, | |
1083 | AC_CHECK_LIB(dl, nlist, nlist_lib="-ldl", | |
1084 | AC_CHECK_LIB(elf, nlist, nlist_lib="-lelf",) | |
1085 | ) | |
1086 | ) | |
1087 | ||
1088 | dnl We need to find out whether underscores are appended to symbol | |
1089 | dnl names in executable files. First, though, we need to see | |
1090 | dnl where nlist.h is hiding. | |
1091 | AC_CHECK_HEADER(libelf/nlist.h, [ nlist_h="libelf/nlist.h" ], ) | |
1092 | AC_CHECK_HEADER(elf/nlist.h, [ nlist_h="elf/nlist.h" ], ) | |
1093 | AC_CHECK_HEADER(nlist.h, [ nlist_h="nlist.h" ], ) | |
1094 | if test x"$nlist_h" = "x"; then | |
1095 | AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "", [String containing extra underscores prepended to symbols loaded from modules.]) | |
1096 | else | |
1097 | AC_MSG_CHECKING(for extra underscores prepended to symbol names) | |
1098 | AC_CACHE_VAL(symbol_underscores, | |
1099 | [ | |
1100 | cat << EOF > conftest.c | |
1101 | #include <$nlist_h> | |
1102 | #include <stdio.h> | |
1103 | #include <stdlib.h> | |
1104 | void _modinit(void); | |
1105 | int main(int argc, char *argv[[]]) { | |
1106 | int i; | |
1107 | struct nlist nl[[5]]; | |
1108 | ||
1109 | /* fill the names in this way, so it'll work almost everywhere */ | |
1110 | nl[[0]].n_name = "_modinit"; | |
1111 | nl[[1]].n_name = "__modinit"; | |
1112 | nl[[2]].n_name = "___modinit"; | |
1113 | nl[[3]].n_name = "____modinit"; | |
1114 | nl[[0]].n_value = nl[[1]].n_value = nl[[2]].n_value = nl[[3]].n_value = nl[[4]].n_name = NULL; | |
1115 | ||
1116 | if(argc < 2 || (nlist(argv[[1]], nl)) == -1) exit(-1); | |
1117 | for(i = 0; i < 4; i++) { | |
1118 | if(nl[[i]].n_value != NULL) | |
1119 | { | |
1120 | int j; | |
1121 | for(j = 0; j < i; j++) | |
1122 | printf("_"); | |
1123 | exit(i); | |
1124 | } | |
1125 | } | |
1126 | exit(-1); | |
1127 | } | |
1128 | void _modinit(void) { return; } | |
1129 | EOF | |
1130 | $CC $CPPFLAGS $IRC_CFLAGS -o conftest conftest.c $nlist_lib >/dev/null 2>&1 | |
1131 | symbol_underscores=`./conftest conftest` | |
1132 | AC_MSG_RESULT($symbol_underscores) | |
1133 | $RM -f conftest conftest.c | |
1134 | ]) | |
1135 | AC_DEFINE_UNQUOTED(SYMBOL_PREFIX, "${symbol_underscores}", [String containing extra underscores prepended to symbols loaded from modules.]) | |
1136 | fi | |
1137 | fi | |
1138 | ||
1139 | IRC_CFLAGS="$IRC_CFLAGS $CWARNS" | |
1140 | ||
1141 | AC_SUBST(MODULES_LIBS) | |
1142 | AC_SUBST(MOD_TARGET) | |
1143 | ||
1144 | AC_SUBST(SSL_SRCS_ENABLE) | |
1145 | AC_SUBST(SSL_INCLUDES) | |
1146 | AC_SUBST(SSL_LIBS) | |
1147 | ||
1148 | AC_SUBST(LDFLAGS) | |
1149 | AC_SUBST(PICFLAGS) | |
1150 | AC_SUBST(IRC_CFLAGS) | |
1151 | AC_SUBST(SEDOBJ) | |
1152 | ||
1153 | ||
1154 | if test "$prefix" = "NONE"; then | |
1155 | AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$ac_default_prefix", [Prefix where the ircd is installed.]) | |
1156 | ||
1157 | else | |
1158 | ||
1159 | dnl Don't get bitten by Cygwin's stupidity if the user specified | |
1160 | dnl a custom prefix with a trailing slash | |
1161 | ||
1162 | prefix=`echo $prefix | sed 's/\/$//'` | |
1163 | AC_DEFINE_UNQUOTED(IRCD_PREFIX, "$prefix", [Prefix where the ircd is installed.]) | |
1164 | ||
1165 | fi | |
1166 | ||
1167 | AC_CONFIG_FILES( \ | |
1168 | Makefile \ | |
1169 | ssld/Makefile \ | |
1170 | extensions/Makefile \ | |
1171 | unsupported/Makefile \ | |
1172 | src/Makefile \ | |
1173 | modules/Makefile \ | |
1174 | tools/Makefile \ | |
1175 | doc/Makefile \ | |
1176 | help/Makefile \ | |
1177 | ) | |
1178 | ||
1179 | AC_OUTPUT | |
1180 | ||
1181 | if test "$cf_openssl_version_ok" = yes; then | |
1182 | openssl="yes" | |
1183 | else | |
1184 | openssl="no" | |
1185 | fi | |
1186 | ||
1187 | if test "$shared_modules" = yes; then | |
1188 | modules=shared | |
1189 | else | |
1190 | modules=static | |
1191 | fi | |
1192 | ||
1193 | echo " | |
1194 | Configuration: | |
1195 | Install directory : $prefix | |
1196 | ||
1197 | Ziplinks : $zlib | |
1198 | OpenSSL : $openssl | |
1199 | Socket Engine : $SELECT_TYPE | |
1200 | Small network : $small_net | |
1201 | Block allocator : $balloc | |
1202 | ||
1203 | Nickname length : $NICKLEN | |
1204 | Topic length : $TOPICLEN | |
1205 | ||
1206 | Use (g)make to compile Charybdis, then (g)make install to install it. | |
1207 | " |