]> jfr.im git - irc/evilnet/x3.git/blame - configure.in
Added a means for Nefarious to supply X3 with the user@host:ip for users attempting...
[irc/evilnet/x3.git] / configure.in
CommitLineData
d76ed9a9 1dnl Process this file with autoconf to create a configure script.
2
3dnl General initialization.
4AC_REVISION([$Id$])
2f65da8f 5AC_PREREQ(2.61)
cbd0912f 6AC_INIT([X3],[1.9],[evilnet-devel@lists.sourceforge.net])
ceafd592 7CODENAME=X3
d76ed9a9 8AC_CONFIG_HEADERS(src/config.h)
9AC_CONFIG_SRCDIR(src/opserv.c)
10dnl AM_CANONICAL_TARGET must be before AM_INIT_AUTOMAKE() or autoconf whines
11AC_CANONICAL_TARGET
12AM_INIT_AUTOMAKE([gnu 1.6])
13AM_MAINTAINER_MODE
14
15dnl Compiler/runtime feature checks.
16AC_TYPE_SIGNAL
17AC_C_CONST
1136f709 18dnl "const" *should* be in the -Werror section, but that breaks Linux. gg gcc.
d76ed9a9 19
20dnl Checks for programs.
21AC_PROG_AWK
22AC_PROG_CC
d76ed9a9 23AC_PROG_INSTALL
0f6fe38c 24
07559983 25AC_PATH_PROG(CP, cp)
26
35305a49 27AC_PROG_RANLIB
0f6fe38c 28dnl AC_PROG_LIBTOOL
35305a49 29
d76ed9a9 30AC_PROG_LN_S
31AC_PROG_MAKE_SET
32AC_PROG_GCC_TRADITIONAL
5b1166fd 33AC_CHECK_PROG(MAKER, gmake, gmake, make)
d76ed9a9 34
35dnl nice that unixes can all follow a standard.
36case $target in
37 *-freebsd2* | *-freebsdelf2* | *-freebsd*out3*)
38 ANSI_SRC=""
39 ;;
40 *-freebsd3* | *-freebsdelf3* | *-freebsd*out3*)
41 ANSI_SRC=""
d76ed9a9 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 ;;
58esac
59CFLAGS="$CFLAGS $EXTRA_DEFINE"
60
61dnl Checks for libraries.
62AC_CHECK_LIB(socket, socket)
63AC_CHECK_LIB(nsl, gethostbyname)
d8cf9c21 64AC_CHECK_LIB(m, main)
21f6caee 65AC_CHECK_LIB(GeoIP, GeoIP_open)
d76ed9a9 66
67dnl Checks for header files.
68AC_HEADER_STDC
69
70dnl will be used for portability stuff
71AC_HEADER_TIME
72AC_STRUCT_TM
73
74dnl Would rather not bail on headers, BSD has alot of the functions elsewhere. -Jedi
1136f709 75AC_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,,)
d76ed9a9 76
d76ed9a9 77dnl portability stuff, hurray! -Jedi
2f61d1d7 78AC_CHECK_MEMBER([struct sockaddr.sa_len],
e9df2b7d 79 [AC_DEFINE([HAVE_SOCKADDR_SA_LEN],[1],[Define if struct sockaddr has sa_len field])],
2f61d1d7 80 [],[#include <sys/types.h>
81#include <sys/socket.h>])
82AC_CHECK_MEMBER([struct addrinfo.ai_flags],
e9df2b7d 83 [AC_DEFINE([HAVE_STRUCT_ADDRINFO],[1],[Define if struct addrinfo declared])],
2f61d1d7 84 [],[#include <sys/types.h>
85#include <sys/socket.h>
86#include <netdb.h>])
21f6caee 87
1136f709 88dnl We have fallbacks in case these are missing, so just check for them.
89AC_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
92dnl Check for the fallbacks for functions missing above.
d76ed9a9 93if test $ac_cv_func_gettimeofday = no; then
2f61d1d7 94 AC_CHECK_FUNCS(ftime,,AC_MSG_ERROR([ftime or gettimeofday required. X3 build will fail.]))
d76ed9a9 95fi
96
d76ed9a9 97dnl Check for absolutely required library functions.
1136f709 98AC_CHECK_FUNCS(socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. X3 build will fail.]))
d76ed9a9 99
100dnl Check for functions (and how to get them).
101AC_FUNC_ALLOCA
102AC_FUNC_MMAP
103
104AC_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;])],
107ac_cv_sin_len="yes", ac_cv_sin_len="no")])
108if test $ac_cv_sin_len = yes ; then
109 AC_DEFINE(HAVE_SIN_LEN, 1, [Define if struct sockaddr_in contains a sin_len field])
110fi
111
697f4c9a 112dnl Check for socklen_t. In traditional BSD this is an int, but some
113dnl OSes use a different type. Test until we find something that will
114dnl work properly. Test borrowed from a patch submitted for Python.
115AC_CHECK_TYPE([socklen_t], ,[
116 AC_MSG_CHECKING([for socklen_t equivalent])
117 AC_CACHE_VAL([curl_cv_socklen_t_equiv],
118 [
119dnl Systems have either "struct sockaddr*" or "void*" as second
120dnl 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>
126int 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
d76ed9a9 138dnl Can only check with -Werror, but the rest of configure doesn't like -Werror
139OLD_CFLAGS=$CFLAGS
140CFLAGS="$CFLAGS -W -Wall -Werror"
141
1136f709 142if test "z$USE_MAINTAINER_MODE" = zyes ; then
143 CFLAGS="$CFLAGS -ansi"
144fi
145
146dnl Check for post-C89 keywords
147AC_C_INLINE
148
d76ed9a9 149dnl Now figure out how to printf() a time_t
150AC_MSG_CHECKING(for time_t format)
151AC_CACHE_VAL(ac_cv_fmt_time_t, [
152ac_cv_fmt_time_t=no
153AC_COMPILE_IFELSE([#include <sys/types.h>
154#include <stdio.h>
155void myfunc(void) {
156 time_t test=0;
157 printf("%li", test);
158}], ac_cv_fmt_time_t="\"%li\"")
159if test $ac_cv_fmt_time_t = no; then
160AC_COMPILE_IFELSE([#include <sys/types.h>
161#include <stdio.h>
162void myfunc(void) {
163 time_t test=0;
164 printf("%i", test);
165}], ac_cv_fmt_time_t="\"%i\"")
166fi
167if test $ac_cv_fmt_time_t = no; then
168AC_MSG_ERROR([Cannot detect format string for time_t
169Please check sys/types.h for the typedef of time_t and submit to a developer])
170fi
171])
172AC_DEFINE_UNQUOTED(FMT_TIME_T, $ac_cv_fmt_time_t, [Define to printf format for a time_t variable])
173AC_MSG_RESULT($ac_cv_fmt_time_t)
174
175dnl How to copy one va_list to another?
176AC_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)])
181if test "$ac_cv_c_va_copy" = "yes" ; then
182 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
183fi
184
185AC_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)])
190if test "$ac_cv_c___va_copy" = "yes" ; then
191 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
192fi
193
194dnl Now fix things back up
195CFLAGS=$OLD_CFLAGS
196
197dnl Optional features.
198AC_MSG_CHECKING(which malloc to use)
199AC_ARG_WITH(malloc,
200[ --with-malloc=type Enables use of a special malloc library; one of:
b8cb2a14 201 system (the default), boehm-gc, dmalloc, mpatrol, x3, slab],
d76ed9a9 202[],
203[withval="system"])
204if test "x$withval" = "xsystem" ; then
205 AC_MSG_RESULT(system)
206 AC_DEFINE(WITH_MALLOC_SYSTEM, 1, [Define if using the system's malloc])
5b1166fd 207 x3_malloc="System"
d76ed9a9 208elif 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])
5b1166fd 213 x3_malloc="DMalloc"
d76ed9a9 214elif 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])
5b1166fd 221 x3_malloc="MPatrol"
d76ed9a9 222elif 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])
5b1166fd 228 x3_malloc="Boehm"
b8cb2a14 229elif test "x$withval" = "xx3" ; then
230 AC_MSG_RESULT(x3)
2f61d1d7 231 AC_DEFINE(WITH_MALLOC_X3, 1, [Define if using the X3 internal debug allocator])
b8cb2a14 232 MODULE_OBJS="$MODULE_OBJS alloc-x3.\$(OBJEXT)"
5b1166fd 233 x3_malloc="X3"
0d16e639 234elif 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)"
5b1166fd 238 x3_malloc="Slab"
d76ed9a9 239else
240 AC_MSG_ERROR([Unknown malloc type $withval])
241fi
242
243AC_MSG_CHECKING(which protocol to use)
244AC_ARG_WITH(protocol,
245[ --with-protocol=name Choose IRC dialect to support; one of:
7827220c 246 p10 (the default)],
d76ed9a9 247[],
248[withval="p10"])
249if test "x$withval" = "xp10" ; then
0f6fe38c 250 AC_MSG_RESULT(P10)
d76ed9a9 251 AC_DEFINE(WITH_PROTOCOL_P10, 1, [Define if using the P10 dialect of IRC])
2f61d1d7 252 MODULE_OBJS="$MODULE_OBJS proto-p10.\$(OBJEXT)"
0f6fe38c 253 PROTO_FILES=proto-p10.c
5b1166fd 254 x3_ircd="P10"
d76ed9a9 255else
256 AC_MSG_ERROR([Unknown IRC dialect $withval])
257fi
258
1136f709 259AC_MSG_CHECKING(how to send mail)
260AC_ARG_WITH(mail,
261[ --with-mail=name How to send mail; one of:
262 sendmail (the default), smtp],
263[],
264[withval="sendmail"])
265if test -r "${srcdir}/src/mail-${withval}.c" ; then
266 AC_MSG_RESULT([$withval])
267 MODULE_OBJS="$MODULE_OBJS mail-${withval}.\$(OBJEXT)"
268else
269 AC_MSG_ERROR([Unknown mail method $withval])
270fi
271
272AC_MSG_CHECKING([I/O multiplexing backends])
273IOMUXES=""
274
275if 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"
279fi
280
281AC_ARG_WITH([epoll],
282[ --without-epoll Disables the epoll_*() I/O backend],
283[],
284[withval="$ac_cv_func_epoll_create"])
285if 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"
289fi
290
291AC_ARG_WITH([kevent],
292[ --without-kevent Disables the kevent() I/O backend],
293[],
294[withval="$ac_cv_func_kevent"])
295if 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"
299fi
300
301IOMUXES=`echo $IOMUXES | sed 's/^ +//'`
302AC_MSG_RESULT($IOMUXES)
303if test "x$IOMUXES" = "x" ; then
304 AC_MSG_ERROR([No supported I/O multiplexing backend found])
305else
306 AC_MSG_RESULT($IOMUXES)
307fi
308
d76ed9a9 309AC_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])
313fi])
314
315AC_MSG_CHECKING(whether to enable tokenization)
316AC_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])
320if test "z$enableval" = zno ; then
321 AC_MSG_RESULT(no)
322else
323 AC_DEFINE(ENABLE_TOKENS, 1, [Define if tokenized P10 desired])
324 AC_MSG_RESULT(yes)
325fi
326
327AC_MSG_CHECKING(whether to enable debug behaviors)
328AC_ARG_ENABLE(debug,
329[ --enable-debug Enables debugging behaviors],
330[
331 CPPFLAGS="$CPPFLAGS"
332 AC_MSG_RESULT(yes)
5b1166fd 333 x3_debug="Enabled"
d76ed9a9 334],
335[
336 CPPFLAGS="$CPPFLAGS -DNDEBUG"
337 AC_MSG_RESULT(no)
5b1166fd 338 x3_debug="Disabled"
d76ed9a9 339])
340
341if 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
345else
346 mkdir src
347fi
348AC_MSG_CHECKING(for extra module files)
349MODULE_DEFINES="src/modules-list.h"
350echo > $MODULE_DEFINES
351touch $MODULE_DEFINES
352AC_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\$//`
2f61d1d7 362 EXTRA_MODULE_OBJS="$EXTRA_MODULE_OBJS mod-$module.\$(OBJEXT)"
d76ed9a9 363 module_list="$module_list $module"
364 echo "WITH_MODULE($module)" >> $MODULE_DEFINES
ec311f39 365 if test "x$module" = "xtrack" ; then
366 TRACK="-D HAVE_TRACK"
8de34abd 367 AC_DEFINE(HAVE_TRACK, 1, [Define this if you are using mod-track])
ec311f39 368 fi
3da28d8e 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
d76ed9a9 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
2f65da8f 382AC_ARG_ENABLE(python,
383[ --disable-python don't build the python plugin],
384 python=$enableval, python=yes)
385
386
d76ed9a9 387MY_SUBDIRS=""
388RX_INCLUDES=""
389RX_LIBS=""
390if 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"
394fi
395MY_SUBDIRS="$MY_SUBDIRS src"
396CFLAGS="$CFLAGS $ANSI_SRC -W -Wall"
397if test "z$USE_MAINTAINER_MODE" = zyes ; then
0f6fe38c 398 CFLAGS="$CFLAGS -Werror"
d76ed9a9 399fi
400
35305a49 401dnl I am not comfortable running make install from ./configure. This has to be done correctly or not at all. -Rubin
5b1166fd 402dnl REMEMBER TO CHANGE WITH A NEW TRE RELEASE!
35305a49 403dnl AC_MSG_RESULT(extracting TRE regex library)
404dnl cur_dir=`pwd`
405dnl cd tools
5b1166fd 406dnl remove old tre directory to force a recompile...
35305a49 407dnl rm -rf tre-$tre_version
408dnl if test "x$ac_cv_path_GUNZIP" = "x" ; then
409dnl tar xfz tre.tar.gz
410dnl else
411dnl cp tre.tar.gz tre.tar.gz.bak
412dnl gunzip -f tre.tar.gz
413dnl cp tre.tar.gz.bak tre.tar.gz
414dnl tar xf tre.tar
415dnl fi
416dnl AC_MSG_RESULT(configuring TRE regex library)
417dnl cd tre-$tre_version
418dnl tre_prefix=$prefix
419dnl if test $tre_prefix = "NONE"; then
420dnl tre_prefix="$HOME"
421dnl fi
422dnl ./configure --disable-agrep --disable-shared --disable-system-abi --disable-wchar --disable-multibyte --prefix=$tre_prefix || exit 1
423dnl
424dnl AC_MSG_RESULT(compiling TRE regex library)
425dnl $ac_cv_prog_MAKER || exit 1
426dnl AC_MSG_RESULT(installing TRE regex library)
427dnl $ac_cv_prog_MAKER install || exit 1
428dnl TREINCDIR="$tre_prefix/include"
429dnl AC_SUBST(TREINCDIR)
430dnl if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
431dnl TRELIBS="-L$tre_prefix/lib -ltre"
432dnl else
433dnl TRELIBS=`$ac_cv_path_PKGCONFIG --libs tre.pc`
434dnl fi
435dnl AC_SUBST(TRELIBS)
436dnl
437dnl cd $cur_dir
438
439dnl libTRE (regex library) checking
a8b2ad8d 440tre_version="0.7.5"
35305a49 441withval=''
a8b2ad8d 442AC_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.], )
35305a49 445if test "x$withval" != "x"; then
446 AC_MSG_RESULT(Using include dir $withval to find libtre)
39edf54a 447 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
0754f993 448 LIBS="$LIBS -L$withval/lib"
5b1166fd 449else
35305a49 450 AC_MSG_RESULT([Looking for tre in system and home dirs (${HOME})...])
39edf54a 451 CPPFLAGS="$CPPFLAGS -I${HOME}/include -L${HOME}/lib"
0754f993 452 LIBS="$LIBS -L${HOME}/lib"
5b1166fd 453fi
0bd0bef6 454AC_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.])],)
455AC_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.])])
5b1166fd 456
a8b2ad8d 457dnl core dumper checking
2784452e 458core_version="1.1"
a8b2ad8d 459withval=''
460AC_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.], )
464if test "x$withval" != "x"; then
465 AC_MSG_RESULT(Using include dir $withval to find coredumper)
39edf54a 466 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
a8b2ad8d 467 LIBS="$LIBS -L$withval/lib"
468else
469 AC_MSG_RESULT([Looking for coredumper in system and home dirs (${HOME})...])
39edf54a 470 CPPFLAGS="$CPPFLAGS -I${HOME}/include -L${HOME}/lib"
2784452e 471 LIBS="$LIBS -Wl,--rpath -Wl,${HOME}/lib"
a8b2ad8d 472fi
0bd0bef6 473AC_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.])],)
474AC_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.])])
a8b2ad8d 475
73d4cc91 476dnl openssl checking
477withval=''
478AC_ARG_WITH(ssl,
479[ --with-ssl=PATH Base path to where openssl is installed],)
480if 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"
484else
485 AC_MSG_RESULT([Looking for openssl in system ])
486fi
487
488AC_CHECK_LIB(ssl, BIO_new,
489[
490LIBS="-lssl $LIBS"
491AC_CHECK_HEADERS(openssl/bio.h,
492[
493AC_DEFINE(WITH_SSL, 1, [Define if SSL libs are linked])
494ssl_message="LDAP library: enabled"
495],
496[
497if test "x$withval" != "x"; then
498 AC_MSG_ERROR([ssl headers not found])
499fi
500])
501],
502[
503if test "x$withval" != "x"; then
504 AC_MSG_ERROR([libldap not found or not valid])
505fi
506]
507)
508AC_MSG_RESULT($LIBS)
509
510
8da89711 511dnl ldap checking
512withval=''
513AC_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.],)
516if 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"
520else
521 AC_MSG_RESULT([Looking for ldap in system ])
522fi
523
39edf54a 524AC_CHECK_LIB(ldap, ldap_simple_bind_s,
8da89711 525[
39edf54a 526LIBS="-lldap $LIBS"
8da89711 527AC_CHECK_HEADERS(ldap.h,
528[
529AC_DEFINE(WITH_LDAP, 1, [Define if LDAP libs are linked])
530ldap_message="LDAP library: enabled"
531],
532[
db9a9a8a 533if test "x$withval" != "x"; then
8da89711 534 AC_MSG_ERROR([ldap.h not found])
535fi
536])
537],
538[
db9a9a8a 539if test "x$withval" != "x"; then
8da89711 540 AC_MSG_ERROR([libldap not found or not valid])
541fi
542]
543)
2f65da8f 544
545dnl *********************************************************************
546dnl ** PYTHON ***********************************************************
547dnl *********************************************************************
548
549if 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)
cbfd323c 574 CFLAGS="$CFLAGS $PY_CFLAGS"
575 LIBS="$LIBS $PY_LIBS"
2f65da8f 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
585fi
586
587AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes")
588
39edf54a 589AC_MSG_RESULT($LIBS)
8da89711 590
d76ed9a9 591AC_DEFINE_UNQUOTED(CODENAME, "${CODENAME}", [Code name for this release])
592AC_SUBST(MODULE_OBJS)
593AC_SUBST(MY_SUBDIRS)
594AC_SUBST(RX_INCLUDES)
595AC_SUBST(RX_LIBS)
ec311f39 596AC_SUBST(TRACK)
2f65da8f 597AC_SUBST(PY_CFLAGS)
598AC_SUBST(PY_LIBS)
599
d76ed9a9 600AC_CONFIG_FILES(Makefile rx/Makefile src/Makefile)
601AC_OUTPUT
5b1166fd 602
603
604dnl Print configuration summary
605
606cat <<EOF
607
608Configuration summary
609=====================
610
611X3 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
a8b2ad8d 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
8da89711 631 $ldap_message
2f65da8f 632 python: $python
5b1166fd 633
a8b2ad8d 634 Install to: $prefix
35305a49 635
5b1166fd 636Now you can proceed with compiling X3
637
638EOF
639