]> jfr.im git - irc/evilnet/x3.git/blob - configure.in
Added a new line to NickServ.accountinfo to show new email address for email change...
[irc/evilnet/x3.git] / configure.in
1 dnl Process this file with autoconf to create a configure script.
2
3 dnl General initialization.
4 AC_REVISION([$Id$])
5 AC_PREREQ(2.61)
6 AC_INIT([X3],[1.8],[evilnet-devel@lists.sourceforge.net])
7 CODENAME=X3
8 AC_CONFIG_HEADERS(src/config.h)
9 AC_CONFIG_SRCDIR(src/opserv.c)
10 dnl AM_CANONICAL_TARGET must be before AM_INIT_AUTOMAKE() or autoconf whines
11 AC_CANONICAL_TARGET
12 AM_INIT_AUTOMAKE([gnu 1.6])
13 AM_MAINTAINER_MODE
14
15 dnl Compiler/runtime feature checks.
16 AC_TYPE_SIGNAL
17 AC_C_CONST
18 dnl "const" *should* be in the -Werror section, but that breaks Linux. gg gcc.
19
20 dnl Checks for programs.
21 AC_PROG_AWK
22 AC_PROG_CC
23 AC_PROG_INSTALL
24
25 AC_PATH_PROG(CP, cp)
26
27 AC_PROG_RANLIB
28 dnl AC_PROG_LIBTOOL
29
30 AC_PROG_LN_S
31 AC_PROG_MAKE_SET
32 AC_PROG_GCC_TRADITIONAL
33 AC_CHECK_PROG(MAKER, gmake, gmake, make)
34
35 dnl nice that unixes can all follow a standard.
36 case $target in
37 *-freebsd2* | *-freebsdelf2* | *-freebsd*out3*)
38 ANSI_SRC=""
39 ;;
40 *-freebsd3* | *-freebsdelf3* | *-freebsd*out3*)
41 ANSI_SRC=""
42 ;;
43 *-solaris*)
44 EXTRA_DEFINE="-D__SOLARIS__"
45 ANSI_SRC="-fno-builtin"
46 ;;
47 *-cygwin)
48 ANSI_SRC="-fno-builtin"
49 ;;
50 *-linux*)
51 dnl -D_GNU_SOURCE needed for strsignal()
52 EXTRA_DEFINE="-D_GNU_SOURCE"
53 ANSI_SRC=""
54 ;;
55 *)
56 ANSI_SRC=""
57 ;;
58 esac
59 CFLAGS="$CFLAGS $EXTRA_DEFINE"
60
61 dnl Checks for libraries.
62 AC_CHECK_LIB(socket, socket)
63 AC_CHECK_LIB(nsl, gethostbyname)
64 AC_CHECK_LIB(m, main)
65 AC_CHECK_LIB(GeoIP, GeoIP_open)
66
67 dnl Checks for header files.
68 AC_HEADER_STDC
69
70 dnl will be used for portability stuff
71 AC_HEADER_TIME
72 AC_STRUCT_TM
73
74 dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi
75 AC_CHECK_HEADERS(GeoIP.h GeoIPCity.h arpa/inet.h fcntl.h math.h tgmath.h malloc.h netdb.h netinet/in.h sys/resource.h sys/timeb.h sys/times.h sys/param.h sys/socket.h sys/time.h sys/types.h sys/wait.h unistd.h getopt.h memory.h arpa/inet.h sys/mman.h sys/stat.h dirent.h sys/epoll.h sys/event.h,,)
76
77 dnl portability stuff, hurray! -Jedi
78 AC_CHECK_MEMBER([struct sockaddr.sa_len],
79 [AC_DEFINE([HAVE_SOCKADDR_SA_LEN],[1],[Define if struct sockaddr has sa_len field])],
80 [],[#include <sys/types.h>
81 #include <sys/socket.h>])
82 AC_CHECK_MEMBER([struct addrinfo.ai_flags],
83 [AC_DEFINE([HAVE_STRUCT_ADDRINFO],[1],[Define if struct addrinfo declared])],
84 [],[#include <sys/types.h>
85 #include <sys/socket.h>
86 #include <netdb.h>])
87
88 dnl We have fallbacks in case these are missing, so just check for them.
89 AC_CHECK_FUNCS(freeaddrinfo getaddrinfo gai_strerror getnameinfo getpagesize memcpy memset strdup strerror strsignal localtime_r setrlimit getopt getopt_long regcomp regexec regfree sysconf inet_aton epoll_create kqueue kevent select gettimeofday times GetProcessTimes mprotect,,)
90
91
92 dnl Check for the fallbacks for functions missing above.
93 if test $ac_cv_func_gettimeofday = no; then
94 AC_CHECK_FUNCS(ftime,,AC_MSG_ERROR([ftime or gettimeofday required. X3 build will fail.]))
95 fi
96
97 dnl Check for absolutely required library functions.
98 AC_CHECK_FUNCS(socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. X3 build will fail.]))
99
100 dnl Check for functions (and how to get them).
101 AC_FUNC_ALLOCA
102 AC_FUNC_MMAP
103
104 AC_CACHE_CHECK([for sin_len], ac_cv_sin_len,
105 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
106 #include <netinet/in.h>],[struct sockaddr_in *sin; sin->sin_len = 0;])],
107 ac_cv_sin_len="yes", ac_cv_sin_len="no")])
108 if test $ac_cv_sin_len = yes ; then
109 AC_DEFINE(HAVE_SIN_LEN, 1, [Define if struct sockaddr_in contains a sin_len field])
110 fi
111
112 dnl Check for socklen_t. In traditional BSD this is an int, but some
113 dnl OSes use a different type. Test until we find something that will
114 dnl work properly. Test borrowed from a patch submitted for Python.
115 AC_CHECK_TYPE([socklen_t], ,[
116 AC_MSG_CHECKING([for socklen_t equivalent])
117 AC_CACHE_VAL([curl_cv_socklen_t_equiv],
118 [
119 dnl Systems have either "struct sockaddr*" or "void*" as second
120 dnl arg to getpeername.
121 curl_cv_socklen_t_equiv=
122 for arg2 in "struct sockaddr" void ; do
123 for t in int size_t unsigned long "unsigned long" ; do
124 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
125 #include <sys/socket.h>
126 int getpeername (int $arg2 *, $t *);]], [[$t len;
127 getpeername(0, 0, &len);]])],[curl_cv_socklen_t_equiv="$t"
128 break],[])
129 done
130 done
131 ])
132 AC_MSG_RESULT($curl_cv_socklen_t_equiv)
133 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
134 [type to use in place of socklen_t if not defined])],
135 [#include <sys/types.h>
136 #include<sys/socket.h>])
137
138 dnl Can only check with -Werror, but the rest of configure doesn't like -Werror
139 OLD_CFLAGS=$CFLAGS
140 CFLAGS="$CFLAGS -W -Wall -Werror"
141
142 if test "z$USE_MAINTAINER_MODE" = zyes ; then
143 CFLAGS="$CFLAGS -ansi"
144 fi
145
146 dnl Check for post-C89 keywords
147 AC_C_INLINE
148
149 dnl Now figure out how to printf() a time_t
150 AC_MSG_CHECKING(for time_t format)
151 AC_CACHE_VAL(ac_cv_fmt_time_t, [
152 ac_cv_fmt_time_t=no
153 AC_COMPILE_IFELSE([#include <sys/types.h>
154 #include <stdio.h>
155 void myfunc(void) {
156 time_t test=0;
157 printf("%li", test);
158 }], ac_cv_fmt_time_t="\"%li\"")
159 if test $ac_cv_fmt_time_t = no; then
160 AC_COMPILE_IFELSE([#include <sys/types.h>
161 #include <stdio.h>
162 void myfunc(void) {
163 time_t test=0;
164 printf("%i", test);
165 }], ac_cv_fmt_time_t="\"%i\"")
166 fi
167 if test $ac_cv_fmt_time_t = no; then
168 AC_MSG_ERROR([Cannot detect format string for time_t
169 Please check sys/types.h for the typedef of time_t and submit to a developer])
170 fi
171 ])
172 AC_DEFINE_UNQUOTED(FMT_TIME_T, $ac_cv_fmt_time_t, [Define to printf format for a time_t variable])
173 AC_MSG_RESULT($ac_cv_fmt_time_t)
174
175 dnl How to copy one va_list to another?
176 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy, [AC_LINK_IFELSE(
177 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
178 [ac_cv_c_va_copy="yes"],
179 [ac_cv_c_va_copy="no"]
180 )])
181 if test "$ac_cv_c_va_copy" = "yes" ; then
182 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
183 fi
184
185 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy, [AC_LINK_IFELSE(
186 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
187 [ac_cv_c___va_copy="yes"],
188 [ac_cv_c___va_copy="no"]
189 )])
190 if test "$ac_cv_c___va_copy" = "yes" ; then
191 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
192 fi
193
194 dnl Now fix things back up
195 CFLAGS=$OLD_CFLAGS
196
197 dnl Optional features.
198 AC_MSG_CHECKING(which malloc to use)
199 AC_ARG_WITH(malloc,
200 [ --with-malloc=type Enables use of a special malloc library; one of:
201 system (the default), boehm-gc, dmalloc, mpatrol, x3, slab],
202 [],
203 [withval="system"])
204 if test "x$withval" = "xsystem" ; then
205 AC_MSG_RESULT(system)
206 AC_DEFINE(WITH_MALLOC_SYSTEM, 1, [Define if using the system's malloc])
207 x3_malloc="System"
208 elif test "x$withval" = "xdmalloc" ; then
209 AC_MSG_RESULT(dmalloc)
210 AC_CHECK_HEADERS(dmalloc.h,,AC_MSG_ERROR([dmalloc header file missing. dmalloc build will fail.]))
211 AC_CHECK_LIB(dmalloc,malloc,,AC_MSG_ERROR([dmalloc library is missing. dmalloc build will fail.]))
212 AC_DEFINE(WITH_MALLOC_DMALLOC, 1, [Define if using the dmalloc debugging malloc package])
213 x3_malloc="DMalloc"
214 elif test "x$withval" = "xmpatrol" ; then
215 AC_MSG_RESULT(mpatrol)
216 AC_CHECK_HEADERS(mpatrol.h,,AC_MSG_ERROR([mpatrol header file missing. mpatrol build will fail.]))
217 dnl Using mpatrol requires linking against libelf, at least on Linux.
218 AC_CHECK_LIB(elf, elf_begin)
219 AC_CHECK_LIB(mpatrol,__mp_atexit,,AC_MSG_ERROR([mpatrol library is missing completely. mpatrol build will fail.]))
220 AC_DEFINE(WITH_MALLOC_MPATROL, 1, [Define if using the mpatrol malloc debugging package])
221 x3_malloc="MPatrol"
222 elif test "x$withval" = "xboehm-gc" ; then
223 AC_MSG_RESULT(boehm-gc)
224 AC_CHECK_HEADERS(gc/gc.h,,AC_MSG_ERROR([Boehm GC header file missing. boehm-gc build will fail.]))
225 AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR([libdl library is missing. boehm-gc build will fail.]))
226 AC_CHECK_LIB(gc, GC_gcollect, , AC_MSG_ERROR([Boehm GC library is missing. boehm-gc build will fail.]))
227 AC_DEFINE(WITH_MALLOC_BOEHM_GC, 1, [Define if using the Boehm GC to garbage collect and check memory leaks])
228 x3_malloc="Boehm"
229 elif test "x$withval" = "xx3" ; then
230 AC_MSG_RESULT(x3)
231 AC_DEFINE(WITH_MALLOC_X3, 1, [Define if using the X3 internal debug allocator])
232 MODULE_OBJS="$MODULE_OBJS alloc-x3.\$(OBJEXT)"
233 x3_malloc="X3"
234 elif test "x$withval" = "xslab" ; then
235 AC_MSG_RESULT(slab)
236 AC_DEFINE(WITH_MALLOC_SLAB, 1, [Define if using the slab internal debug allocator])
237 MODULE_OBJS="$MODULE_OBJS alloc-slab.\$(OBJEXT)"
238 x3_malloc="Slab"
239 else
240 AC_MSG_ERROR([Unknown malloc type $withval])
241 fi
242
243 AC_MSG_CHECKING(which protocol to use)
244 AC_ARG_WITH(protocol,
245 [ --with-protocol=name Choose IRC dialect to support; one of:
246 p10 (the default)],
247 [],
248 [withval="p10"])
249 if test "x$withval" = "xp10" ; then
250 AC_MSG_RESULT(P10)
251 AC_DEFINE(WITH_PROTOCOL_P10, 1, [Define if using the P10 dialect of IRC])
252 MODULE_OBJS="$MODULE_OBJS proto-p10.\$(OBJEXT)"
253 PROTO_FILES=proto-p10.c
254 x3_ircd="P10"
255 else
256 AC_MSG_ERROR([Unknown IRC dialect $withval])
257 fi
258
259 AC_MSG_CHECKING(how to send mail)
260 AC_ARG_WITH(mail,
261 [ --with-mail=name How to send mail; one of:
262 sendmail (the default), smtp],
263 [],
264 [withval="sendmail"])
265 if test -r "${srcdir}/src/mail-${withval}.c" ; then
266 AC_MSG_RESULT([$withval])
267 MODULE_OBJS="$MODULE_OBJS mail-${withval}.\$(OBJEXT)"
268 else
269 AC_MSG_ERROR([Unknown mail method $withval])
270 fi
271
272 AC_MSG_CHECKING([I/O multiplexing backends])
273 IOMUXES=""
274
275 if test "x$ac_cv_func_select" = xyes ; then
276 AC_DEFINE(WITH_IOSET_SELECT, 1, [Define if using the select() I/O backend])
277 MODULE_OBJS="$MODULE_OBJS ioset-select.\$(OBJEXT)"
278 IOMUXES="$IOMUXES select"
279 fi
280
281 AC_ARG_WITH([epoll],
282 [ --without-epoll Disables the epoll_*() I/O backend],
283 [],
284 [withval="$ac_cv_func_epoll_create"])
285 if test "x$withval" = xyes ; then
286 AC_DEFINE(WITH_IOSET_EPOLL, 1, [Define if using the epoll I/O backend])
287 MODULE_OBJS="$MODULE_OBJS ioset-epoll.\$(OBJEXT)"
288 IOMUXES="$IOMUXES epoll"
289 fi
290
291 AC_ARG_WITH([kevent],
292 [ --without-kevent Disables the kevent() I/O backend],
293 [],
294 [withval="$ac_cv_func_kevent"])
295 if test "x$withval" = xyes ; then
296 AC_DEFINE(WITH_IOSET_KEVENT, 1, [Define if using the kevent I/O backend])
297 MODULE_OBJS="$MODULE_OBJS ioset-kevent.\$(OBJEXT)"
298 IOMUXES="$IOMUXES kevent"
299 fi
300
301 IOMUXES=`echo $IOMUXES | sed 's/^ +//'`
302 AC_MSG_RESULT($IOMUXES)
303 if test "x$IOMUXES" = "x" ; then
304 AC_MSG_ERROR([No supported I/O multiplexing backend found])
305 else
306 AC_MSG_RESULT($IOMUXES)
307 fi
308
309 AC_ARG_WITH(getopt,
310 [ --without-getopt Disables building of the GNU getopt library],
311 [if test "$withval" = no; then
312 AC_DEFINE(IGNORE_GETOPT, 1, [Define to disable built-in getopt library])
313 fi])
314
315 AC_MSG_CHECKING(whether to enable tokenization)
316 AC_ARG_ENABLE(tokens,
317 [ --disable-tokens Disables tokenization of P10 protocol output
318 (tokens required if linking to ircu 2.10.11)],
319 [],[enableval=yes])
320 if test "z$enableval" = zno ; then
321 AC_MSG_RESULT(no)
322 else
323 AC_DEFINE(ENABLE_TOKENS, 1, [Define if tokenized P10 desired])
324 AC_MSG_RESULT(yes)
325 fi
326
327 AC_MSG_CHECKING(whether to enable debug behaviors)
328 AC_ARG_ENABLE(debug,
329 [ --enable-debug Enables debugging behaviors],
330 [
331 CPPFLAGS="$CPPFLAGS"
332 AC_MSG_RESULT(yes)
333 x3_debug="Enabled"
334 ],
335 [
336 CPPFLAGS="$CPPFLAGS -DNDEBUG"
337 AC_MSG_RESULT(no)
338 x3_debug="Disabled"
339 ])
340
341 if test -e src ; then
342 if test ! -d src ; then
343 AC_MSG_ERROR([src exists but is not a directory; please move it out of the way.])
344 fi
345 else
346 mkdir src
347 fi
348 AC_MSG_CHECKING(for extra module files)
349 MODULE_DEFINES="src/modules-list.h"
350 echo > $MODULE_DEFINES
351 touch $MODULE_DEFINES
352 AC_ARG_ENABLE(modules,
353 [ --enable-modules=list,of,modules Enable extra modules],
354 [
355 OIFS="$IFS"
356 IFS=','
357 EXTRA_MODULE_OBJS=""
358 module_list=""
359 dnl Must use a separate file because autoconf can't stand newlines in an AC_SUBSTed variable.
360 for module in $enableval ; do
361 module=`echo $module | sed -e s/^mod-// -e s/\.c\$//`
362 EXTRA_MODULE_OBJS="$EXTRA_MODULE_OBJS mod-$module.\$(OBJEXT)"
363 module_list="$module_list $module"
364 echo "WITH_MODULE($module)" >> $MODULE_DEFINES
365 if test "x$module" = "xtrack" ; then
366 TRACK="-D HAVE_TRACK"
367 AC_DEFINE(HAVE_TRACK, 1, [Define this if you are using mod-track])
368 fi
369 if test "x$module" = "xhelpserv" ; then
370 TRACK="-D HAVE_HELPSERV"
371 AC_DEFINE(HAVE_HELPSERV, 1, [Define this if you are using mod-helpserv])
372 fi
373 done
374 IFS="$OIFS"
375 MODULE_OBJS="$MODULE_OBJS $EXTRA_MODULE_OBJS"
376 AC_MSG_RESULT($module_list)
377 ],
378 [
379 AC_MSG_RESULT(none)
380 ])
381
382 AC_ARG_ENABLE(python,
383 [ --disable-python don't build the python plugin],
384 python=$enableval, python=yes)
385
386
387 MY_SUBDIRS=""
388 RX_INCLUDES=""
389 RX_LIBS=""
390 if test "${BROKEN_REGEX}" = yes -o "${ac_cv_func_regcomp}" = no; then
391 MY_SUBDIRS="rx $MY_SUBDIRS"
392 RX_INCLUDES="-I../rx"
393 RX_LIBS="../rx/librx.a"
394 fi
395 MY_SUBDIRS="$MY_SUBDIRS src"
396 CFLAGS="$CFLAGS $ANSI_SRC -W -Wall"
397 if test "z$USE_MAINTAINER_MODE" = zyes ; then
398 CFLAGS="$CFLAGS -Werror"
399 fi
400
401 dnl I am not comfortable running make install from ./configure. This has to be done correctly or not at all. -Rubin
402 dnl REMEMBER TO CHANGE WITH A NEW TRE RELEASE!
403 dnl AC_MSG_RESULT(extracting TRE regex library)
404 dnl cur_dir=`pwd`
405 dnl cd tools
406 dnl remove old tre directory to force a recompile...
407 dnl rm -rf tre-$tre_version
408 dnl if test "x$ac_cv_path_GUNZIP" = "x" ; then
409 dnl tar xfz tre.tar.gz
410 dnl else
411 dnl cp tre.tar.gz tre.tar.gz.bak
412 dnl gunzip -f tre.tar.gz
413 dnl cp tre.tar.gz.bak tre.tar.gz
414 dnl tar xf tre.tar
415 dnl fi
416 dnl AC_MSG_RESULT(configuring TRE regex library)
417 dnl cd tre-$tre_version
418 dnl tre_prefix=$prefix
419 dnl if test $tre_prefix = "NONE"; then
420 dnl tre_prefix="$HOME"
421 dnl fi
422 dnl ./configure --disable-agrep --disable-shared --disable-system-abi --disable-wchar --disable-multibyte --prefix=$tre_prefix || exit 1
423 dnl
424 dnl AC_MSG_RESULT(compiling TRE regex library)
425 dnl $ac_cv_prog_MAKER || exit 1
426 dnl AC_MSG_RESULT(installing TRE regex library)
427 dnl $ac_cv_prog_MAKER install || exit 1
428 dnl TREINCDIR="$tre_prefix/include"
429 dnl AC_SUBST(TREINCDIR)
430 dnl if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
431 dnl TRELIBS="-L$tre_prefix/lib -ltre"
432 dnl else
433 dnl TRELIBS=`$ac_cv_path_PKGCONFIG --libs tre.pc`
434 dnl fi
435 dnl AC_SUBST(TRELIBS)
436 dnl
437 dnl cd $cur_dir
438
439 dnl libTRE (regex library) checking
440 tre_version="0.7.5"
441 withval=''
442 AC_ARG_WITH(tre,
443 [ --with-tre=PATH Base path to where libtre is installed, such that
444 PATH/lib/libtre.so and PATH/include/tre/regex.h exist.], )
445 if test "x$withval" != "x"; then
446 AC_MSG_RESULT(Using include dir $withval to find libtre)
447 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
448 LIBS="$LIBS -L$withval/lib"
449 else
450 AC_MSG_RESULT([Looking for tre in system and home dirs (${HOME})...])
451 CPPFLAGS="$CPPFLAGS -I${HOME}/include -L${HOME}/lib"
452 LIBS="$LIBS -L${HOME}/lib"
453 fi
454 AC_CHECK_HEADER(tre/regex.h, , [AC_MSG_ERROR([tre/regex.h, the TRE regex headers, were not found. Install tre or use --with-tre=PATH to tell me how to find it, where PATH/include/tre/regex.h exists. For convenience, just type 'tools/tre_install.sh' now, to install tre in your home directory.])],)
455 AC_CHECK_LIB(tre, regexec, , [AC_MSG_ERROR([TRE regex library not found. Install tre, or use --with-tre=PATH to tell me how to find it, where PATH/lib/libtre.so exists. For convenience, just type 'tools/tre_install.sh' now, to install tre in your home directory.])])
456
457 dnl core dumper checking
458 core_version="1.1"
459 withval=''
460 AC_ARG_WITH(coredumper,
461 [ --with-coredumper=PATH Base path to where core dumper is installed, such
462 that PATH/lib/libcoredumper.so and
463 PATH/include/google/coredumper.h exist.], )
464 if test "x$withval" != "x"; then
465 AC_MSG_RESULT(Using include dir $withval to find coredumper)
466 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
467 LIBS="$LIBS -L$withval/lib"
468 else
469 AC_MSG_RESULT([Looking for coredumper in system and home dirs (${HOME})...])
470 CPPFLAGS="$CPPFLAGS -I${HOME}/include -L${HOME}/lib"
471 LIBS="$LIBS -Wl,--rpath -Wl,${HOME}/lib"
472 fi
473 AC_CHECK_HEADER(google/coredumper.h, , [AC_MSG_RESULT([google/coredumper.h, the coredumper headers, were not found. Install coredumper or use --with-coredumper=PATH to tell me how to find it, where PATH/include/google/coredumper.h exists. For convenience, just type 'tools/core_install.sh' now, to install coredumper in your home directory.])],)
474 AC_CHECK_LIB(coredumper, WriteCoreDump, , [AC_MSG_RESULT([Coredumper library not found. Install coredumper, or use --with-coredumper=PATH to tell me how to find it, where PATH/lib/libcoredumper.so exists. For convenience, just type 'tools/core_install.sh' now, to install coredumper in your home directory.])])
475
476 dnl openssl checking
477 withval=''
478 AC_ARG_WITH(ssl,
479 [ --with-ssl=PATH Base path to where openssl is installed],)
480 if test "x$withval" != "x"; then
481 AC_MSG_RESULT(Using include dir $withval to find openssl)
482 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
483 LIBS="$LIBS -L$withval/lib"
484 else
485 AC_MSG_RESULT([Looking for openssl in system ])
486 fi
487
488 AC_CHECK_LIB(ssl, BIO_new,
489 [
490 LIBS="-lssl $LIBS"
491 AC_CHECK_HEADERS(openssl/bio.h,
492 [
493 AC_DEFINE(WITH_SSL, 1, [Define if SSL libs are linked])
494 ssl_message="LDAP library: enabled"
495 ],
496 [
497 if test "x$withval" != "x"; then
498 AC_MSG_ERROR([ssl headers not found])
499 fi
500 ])
501 ],
502 [
503 if test "x$withval" != "x"; then
504 AC_MSG_ERROR([libldap not found or not valid])
505 fi
506 ]
507 )
508 AC_MSG_RESULT($LIBS)
509
510
511 dnl ldap checking
512 withval=''
513 AC_ARG_WITH(ldap,
514 [ --with-ldap=PATH Base path to where the ldap library and headers are installed,
515 such that PATH/include/ldap.h and PATH/lib/libldap.so exist.],)
516 if test "x$withval" != "x"; then
517 AC_MSG_RESULT(Using include dir $withval to find libldap)
518 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
519 LIBS="$LIBS -L$withval/lib"
520 else
521 AC_MSG_RESULT([Looking for ldap in system ])
522 fi
523
524 AC_CHECK_LIB(ldap, ldap_simple_bind_s,
525 [
526 LIBS="-lldap $LIBS"
527 AC_CHECK_HEADERS(ldap.h,
528 [
529 AC_DEFINE(WITH_LDAP, 1, [Define if LDAP libs are linked])
530 ldap_message="LDAP library: enabled"
531 ],
532 [
533 if test "x$withval" != "x"; then
534 AC_MSG_ERROR([ldap.h not found])
535 fi
536 ])
537 ],
538 [
539 if test "x$withval" != "x"; then
540 AC_MSG_ERROR([libldap not found or not valid])
541 fi
542 ]
543 )
544
545 dnl *********************************************************************
546 dnl ** PYTHON ***********************************************************
547 dnl *********************************************************************
548
549 if test "$python" = yes; then
550 AC_PATH_PROG(pythonpath, python2)
551 if test "_$pythonpath" = _ ; then
552 AC_PATH_PROG(pythonpath, python)
553 fi
554 if test "_$pythonpath" = _ ; then
555 python=no
556 else
557 AC_MSG_CHECKING(Python version)
558 changequote(<<, >>)dnl
559 PY_VER=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("VERSION")[0];'`
560 PY_LIB=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1);'`
561 PY_INC=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("INCLUDEPY")[0];'`
562 $pythonpath -c "import sys; map(int,sys.version[:3].split('.')) >= [2,2] or sys.exit(1)"
563 changequote([, ])dnl
564 AC_MSG_RESULT($PY_VER)
565 if test "$?" != "1"; then
566 AC_MSG_CHECKING(Python compile flags)
567 PY_PREFIX=`$pythonpath -c 'import sys; print sys.prefix'`
568 PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print sys.exec_prefix'`
569 if test -f $PY_INC/Python.h; then
570 AC_DEFINE(WITH_PYTHON, 1, [Define if using python])
571 PY_LIBS="-L$PY_LIB/config -lpython$PY_VER -lpthread -lutil"
572 PY_CFLAGS="-I$PY_INC"
573 AC_MSG_RESULT(ok)
574 CFLAGS="$CFLAGS $PY_CFLAGS"
575 LIBS="$LIBS $PY_LIBS"
576 else
577 python=no
578 AC_MSG_RESULT([Can't find Python.h])
579 fi
580 else
581 echo "Python too old. Only 2.2 or above is supported."
582 python=no
583 fi
584 fi
585 fi
586
587 AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes")
588
589 AC_MSG_RESULT($LIBS)
590
591 AC_DEFINE_UNQUOTED(CODENAME, "${CODENAME}", [Code name for this release])
592 AC_SUBST(MODULE_OBJS)
593 AC_SUBST(MY_SUBDIRS)
594 AC_SUBST(RX_INCLUDES)
595 AC_SUBST(RX_LIBS)
596 AC_SUBST(TRACK)
597 AC_SUBST(PY_CFLAGS)
598 AC_SUBST(PY_LIBS)
599
600 AC_CONFIG_FILES(Makefile rx/Makefile src/Makefile)
601 AC_OUTPUT
602
603
604 dnl Print configuration summary
605
606 cat <<EOF
607
608 Configuration summary
609 =====================
610
611 X3 is now configured as follows:
612
613 * Compilation environment
614
615 CC = $CC
616 CFLAGS = $CFLAGS
617 CPP = $CPP
618 CPPFLAGS = $CPPFLAGS
619 LD = $LD
620 LDFLAGS = $LDFLAGS
621 LIBS = $LIBS
622
623 * X3 options
624
625 Debug: $x3_debug
626 Extra Modules: $module_list
627 Malloc: $x3_malloc
628 Protocol: $x3_ircd
629 Regexp Library TRE $tre_version
630 Coredumper Library Coredumper $core_version
631 $ldap_message
632 python: $python
633
634 Install to: $prefix
635
636 Now you can proceed with compiling X3
637
638 EOF
639