]> jfr.im git - irc/evilnet/x3.git/blob - configure.in
mod-python: generalised the setting of the PYTHONPATH environment variable
[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.6],[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 AC_C_INLINE
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 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 ,,)
76
77 dnl portability stuff, hurray! -Jedi
78 AC_CHECK_MEMBER([struct sockaddr.sa_len],
79 [AC_DEFINE([HAVE_SOCKADDR_SA_LEN],,[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],,[Define if struct addrinfo declared])],
84 [],[#include <sys/types.h>
85 #include <sys/socket.h>
86 #include <netdb.h>])
87
88 AC_CHECK_FUNCS(gettimeofday)
89 if test $ac_cv_func_gettimeofday = no; then
90 AC_CHECK_FUNCS(ftime,,AC_MSG_ERROR([ftime or gettimeofday required. X3 build will fail.]))
91 fi
92
93 dnl We have fallbacks in case these are missing, so just check for them.
94 AC_CHECK_FUNCS(freeaddrinfo getaddrinfo getnameinfo getpagesize memcpy memset strdup strerror strsignal localtime_r setrlimit getopt getopt_long sysconf,,)
95
96 dnl Check for absolutely required library functions.
97 AC_CHECK_FUNCS(select socket strcspn strspn strtod strtoul,,AC_MSG_ERROR([a required function was not found. X3 build will fail.]))
98
99 dnl Check for functions (and how to get them).
100 AC_FUNC_ALLOCA
101 AC_FUNC_MMAP
102
103 AC_CACHE_CHECK([for sin_len], ac_cv_sin_len,
104 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
105 #include <netinet/in.h>],[struct sockaddr_in *sin; sin->sin_len = 0;])],
106 ac_cv_sin_len="yes", ac_cv_sin_len="no")])
107 if test $ac_cv_sin_len = yes ; then
108 AC_DEFINE(HAVE_SIN_LEN, 1, [Define if struct sockaddr_in contains a sin_len field])
109 fi
110
111 dnl Check for socklen_t. In traditional BSD this is an int, but some
112 dnl OSes use a different type. Test until we find something that will
113 dnl work properly. Test borrowed from a patch submitted for Python.
114 AC_CHECK_TYPE([socklen_t], ,[
115 AC_MSG_CHECKING([for socklen_t equivalent])
116 AC_CACHE_VAL([curl_cv_socklen_t_equiv],
117 [
118 dnl Systems have either "struct sockaddr*" or "void*" as second
119 dnl arg to getpeername.
120 curl_cv_socklen_t_equiv=
121 for arg2 in "struct sockaddr" void ; do
122 for t in int size_t unsigned long "unsigned long" ; do
123 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
124 #include <sys/socket.h>
125 int getpeername (int $arg2 *, $t *);]], [[$t len;
126 getpeername(0, 0, &len);]])],[curl_cv_socklen_t_equiv="$t"
127 break],[])
128 done
129 done
130 ])
131 AC_MSG_RESULT($curl_cv_socklen_t_equiv)
132 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
133 [type to use in place of socklen_t if not defined])],
134 [#include <sys/types.h>
135 #include<sys/socket.h>])
136
137 dnl Can only check with -Werror, but the rest of configure doesn't like -Werror
138 OLD_CFLAGS=$CFLAGS
139 CFLAGS="$CFLAGS -W -Wall -Werror"
140
141 dnl Now figure out how to printf() a time_t
142 AC_MSG_CHECKING(for time_t format)
143 AC_CACHE_VAL(ac_cv_fmt_time_t, [
144 ac_cv_fmt_time_t=no
145 AC_COMPILE_IFELSE([#include <sys/types.h>
146 #include <stdio.h>
147 void myfunc(void) {
148 time_t test=0;
149 printf("%li", test);
150 }], ac_cv_fmt_time_t="\"%li\"")
151 if test $ac_cv_fmt_time_t = no; then
152 AC_COMPILE_IFELSE([#include <sys/types.h>
153 #include <stdio.h>
154 void myfunc(void) {
155 time_t test=0;
156 printf("%i", test);
157 }], ac_cv_fmt_time_t="\"%i\"")
158 fi
159 if test $ac_cv_fmt_time_t = no; then
160 AC_MSG_ERROR([Cannot detect format string for time_t
161 Please check sys/types.h for the typedef of time_t and submit to a developer])
162 fi
163 ])
164 AC_DEFINE_UNQUOTED(FMT_TIME_T, $ac_cv_fmt_time_t, [Define to printf format for a time_t variable])
165 AC_MSG_RESULT($ac_cv_fmt_time_t)
166
167 dnl How to copy one va_list to another?
168 AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy, [AC_LINK_IFELSE(
169 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; va_copy(ap1, ap2);])],
170 [ac_cv_c_va_copy="yes"],
171 [ac_cv_c_va_copy="no"]
172 )])
173 if test "$ac_cv_c_va_copy" = "yes" ; then
174 AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy])
175 fi
176
177 AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy, [AC_LINK_IFELSE(
178 [AC_LANG_PROGRAM([#include <stdarg.h>], [va_list ap1, ap2; __va_copy(ap1, ap2);])],
179 [ac_cv_c___va_copy="yes"],
180 [ac_cv_c___va_copy="no"]
181 )])
182 if test "$ac_cv_c___va_copy" = "yes" ; then
183 AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy])
184 fi
185
186 dnl Now fix things back up
187 CFLAGS=$OLD_CFLAGS
188
189 dnl Optional features.
190 AC_MSG_CHECKING(which malloc to use)
191 AC_ARG_WITH(malloc,
192 [ --with-malloc=type Enables use of a special malloc library; one of:
193 system (the default), boehm-gc, dmalloc, mpatrol, x3, slab],
194 [],
195 [withval="system"])
196 if test "x$withval" = "xsystem" ; then
197 AC_MSG_RESULT(system)
198 AC_DEFINE(WITH_MALLOC_SYSTEM, 1, [Define if using the system's malloc])
199 x3_malloc="System"
200 elif test "x$withval" = "xdmalloc" ; then
201 AC_MSG_RESULT(dmalloc)
202 AC_CHECK_HEADERS(dmalloc.h,,AC_MSG_ERROR([dmalloc header file missing. dmalloc build will fail.]))
203 AC_CHECK_LIB(dmalloc,malloc,,AC_MSG_ERROR([dmalloc library is missing. dmalloc build will fail.]))
204 AC_DEFINE(WITH_MALLOC_DMALLOC, 1, [Define if using the dmalloc debugging malloc package])
205 x3_malloc="DMalloc"
206 elif test "x$withval" = "xmpatrol" ; then
207 AC_MSG_RESULT(mpatrol)
208 AC_CHECK_HEADERS(mpatrol.h,,AC_MSG_ERROR([mpatrol header file missing. mpatrol build will fail.]))
209 dnl Using mpatrol requires linking against libelf, at least on Linux.
210 AC_CHECK_LIB(elf, elf_begin)
211 AC_CHECK_LIB(mpatrol,__mp_atexit,,AC_MSG_ERROR([mpatrol library is missing completely. mpatrol build will fail.]))
212 AC_DEFINE(WITH_MALLOC_MPATROL, 1, [Define if using the mpatrol malloc debugging package])
213 x3_malloc="MPatrol"
214 elif test "x$withval" = "xboehm-gc" ; then
215 AC_MSG_RESULT(boehm-gc)
216 AC_CHECK_HEADERS(gc/gc.h,,AC_MSG_ERROR([Boehm GC header file missing. boehm-gc build will fail.]))
217 AC_CHECK_LIB(dl, dlopen, , AC_MSG_ERROR([libdl library is missing. boehm-gc build will fail.]))
218 AC_CHECK_LIB(gc, GC_gcollect, , AC_MSG_ERROR([Boehm GC library is missing. boehm-gc build will fail.]))
219 AC_DEFINE(WITH_MALLOC_BOEHM_GC, 1, [Define if using the Boehm GC to garbage collect and check memory leaks])
220 x3_malloc="Boehm"
221 elif test "x$withval" = "xx3" ; then
222 AC_MSG_RESULT(x3)
223 AC_DEFINE(WITH_MALLOC_X3, 1, [Define if using the X3 internal debug allocator])
224 MODULE_OBJS="$MODULE_OBJS alloc-x3.\$(OBJEXT)"
225 x3_malloc="X3"
226 elif test "x$withval" = "xslab" ; then
227 AC_MSG_RESULT(slab)
228 AC_DEFINE(WITH_MALLOC_SLAB, 1, [Define if using the slab internal debug allocator])
229 MODULE_OBJS="$MODULE_OBJS alloc-slab.\$(OBJEXT)"
230 x3_malloc="Slab"
231 else
232 AC_MSG_ERROR([Unknown malloc type $withval])
233 fi
234
235 AC_MSG_CHECKING(which protocol to use)
236 AC_ARG_WITH(protocol,
237 [ --with-protocol=name Choose IRC dialect to support; one of:
238 p10 (the default)],
239 [],
240 [withval="p10"])
241 if test "x$withval" = "xp10" ; then
242 AC_MSG_RESULT(P10)
243 AC_DEFINE(WITH_PROTOCOL_P10, 1, [Define if using the P10 dialect of IRC])
244 MODULE_OBJS="$MODULE_OBJS proto-p10.\$(OBJEXT)"
245 PROTO_FILES=proto-p10.c
246 x3_ircd="P10"
247 else
248 AC_MSG_ERROR([Unknown IRC dialect $withval])
249 fi
250
251 AC_ARG_WITH(getopt,
252 [ --without-getopt Disables building of the GNU getopt library],
253 [if test "$withval" = no; then
254 AC_DEFINE(IGNORE_GETOPT, 1, [Define to disable built-in getopt library])
255 fi])
256
257 AC_MSG_CHECKING(whether to enable tokenization)
258 AC_ARG_ENABLE(tokens,
259 [ --disable-tokens Disables tokenization of P10 protocol output
260 (tokens required if linking to ircu 2.10.11)],
261 [],[enableval=yes])
262 if test "z$enableval" = zno ; then
263 AC_MSG_RESULT(no)
264 else
265 AC_DEFINE(ENABLE_TOKENS, 1, [Define if tokenized P10 desired])
266 AC_MSG_RESULT(yes)
267 fi
268
269 AC_MSG_CHECKING(whether to enable debug behaviors)
270 AC_ARG_ENABLE(debug,
271 [ --enable-debug Enables debugging behaviors],
272 [
273 CPPFLAGS="$CPPFLAGS"
274 AC_MSG_RESULT(yes)
275 x3_debug="Enabled"
276 ],
277 [
278 CPPFLAGS="$CPPFLAGS -DNDEBUG"
279 AC_MSG_RESULT(no)
280 x3_debug="Disabled"
281 ])
282
283 if test -e src ; then
284 if test ! -d src ; then
285 AC_MSG_ERROR([src exists but is not a directory; please move it out of the way.])
286 fi
287 else
288 mkdir src
289 fi
290 AC_MSG_CHECKING(for extra module files)
291 MODULE_DEFINES="src/modules-list.h"
292 echo > $MODULE_DEFINES
293 touch $MODULE_DEFINES
294 AC_ARG_ENABLE(modules,
295 [ --enable-modules=list,of,modules Enable extra modules],
296 [
297 OIFS="$IFS"
298 IFS=','
299 EXTRA_MODULE_OBJS=""
300 module_list=""
301 dnl Must use a separate file because autoconf can't stand newlines in an AC_SUBSTed variable.
302 for module in $enableval ; do
303 module=`echo $module | sed -e s/^mod-// -e s/\.c\$//`
304 EXTRA_MODULE_OBJS="$EXTRA_MODULE_OBJS mod-$module.\$(OBJEXT)"
305 module_list="$module_list $module"
306 echo "WITH_MODULE($module)" >> $MODULE_DEFINES
307 if test "x$module" = "xtrack" ; then
308 TRACK="-D HAVE_TRACK"
309 AC_DEFINE(HAVE_TRACK, 1, [Define this if you are using mod-track])
310 fi
311 if test "x$module" = "xhelpserv" ; then
312 TRACK="-D HAVE_HELPSERV"
313 AC_DEFINE(HAVE_HELPSERV, 1, [Define this if you are using mod-helpserv])
314 fi
315 done
316 IFS="$OIFS"
317 MODULE_OBJS="$MODULE_OBJS $EXTRA_MODULE_OBJS"
318 AC_MSG_RESULT($module_list)
319 ],
320 [
321 AC_MSG_RESULT(none)
322 ])
323
324 AC_ARG_ENABLE(python,
325 [ --disable-python don't build the python plugin],
326 python=$enableval, python=yes)
327
328
329 MY_SUBDIRS=""
330 RX_INCLUDES=""
331 RX_LIBS=""
332 if test "${BROKEN_REGEX}" = yes -o "${ac_cv_func_regcomp}" = no; then
333 MY_SUBDIRS="rx $MY_SUBDIRS"
334 RX_INCLUDES="-I../rx"
335 RX_LIBS="../rx/librx.a"
336 fi
337 MY_SUBDIRS="$MY_SUBDIRS src"
338 CFLAGS="$CFLAGS $ANSI_SRC -W -Wall"
339 if test "z$USE_MAINTAINER_MODE" = zyes ; then
340 CFLAGS="$CFLAGS -Werror"
341 fi
342
343 dnl I am not comfortable running make install from ./configure. This has to be done correctly or not at all. -Rubin
344 dnl REMEMBER TO CHANGE WITH A NEW TRE RELEASE!
345 dnl AC_MSG_RESULT(extracting TRE regex library)
346 dnl cur_dir=`pwd`
347 dnl cd tools
348 dnl remove old tre directory to force a recompile...
349 dnl rm -rf tre-$tre_version
350 dnl if test "x$ac_cv_path_GUNZIP" = "x" ; then
351 dnl tar xfz tre.tar.gz
352 dnl else
353 dnl cp tre.tar.gz tre.tar.gz.bak
354 dnl gunzip -f tre.tar.gz
355 dnl cp tre.tar.gz.bak tre.tar.gz
356 dnl tar xf tre.tar
357 dnl fi
358 dnl AC_MSG_RESULT(configuring TRE regex library)
359 dnl cd tre-$tre_version
360 dnl tre_prefix=$prefix
361 dnl if test $tre_prefix = "NONE"; then
362 dnl tre_prefix="$HOME"
363 dnl fi
364 dnl ./configure --disable-agrep --disable-shared --disable-system-abi --disable-wchar --disable-multibyte --prefix=$tre_prefix || exit 1
365 dnl
366 dnl AC_MSG_RESULT(compiling TRE regex library)
367 dnl $ac_cv_prog_MAKER || exit 1
368 dnl AC_MSG_RESULT(installing TRE regex library)
369 dnl $ac_cv_prog_MAKER install || exit 1
370 dnl TREINCDIR="$tre_prefix/include"
371 dnl AC_SUBST(TREINCDIR)
372 dnl if test "x$ac_cv_path_PKGCONFIG" = "x" ; then
373 dnl TRELIBS="-L$tre_prefix/lib -ltre"
374 dnl else
375 dnl TRELIBS=`$ac_cv_path_PKGCONFIG --libs tre.pc`
376 dnl fi
377 dnl AC_SUBST(TRELIBS)
378 dnl
379 dnl cd $cur_dir
380
381 dnl libTRE (regex library) checking
382 tre_version="0.7.5"
383 withval=''
384 AC_ARG_WITH(tre,
385 [ --with-tre=PATH Base path to where libtre is installed, such that
386 PATH/lib/libtre.so and PATH/include/tre/regex.h exist.], )
387 if test "x$withval" != "x"; then
388 AC_MSG_RESULT(Using include dir $withval to find libtre)
389 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
390 LIBS="$LIBS -L$withval/lib"
391 else
392 AC_MSG_RESULT([Looking for tre in system and home dirs (${HOME})...])
393 CPPFLAGS="$CPPFLAGS -I${HOME}/include -L${HOME}/lib"
394 LIBS="$LIBS -L${HOME}/lib"
395 fi
396 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.])],)
397 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.])])
398
399 dnl core dumper checking
400 core_version="1.1"
401 withval=''
402 AC_ARG_WITH(coredumper,
403 [ --with-coredumper=PATH Base path to where core dumper is installed, such
404 that PATH/lib/libcoredumper.so and
405 PATH/include/google/coredumper.h exist.], )
406 if test "x$withval" != "x"; then
407 AC_MSG_RESULT(Using include dir $withval to find coredumper)
408 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
409 LIBS="$LIBS -L$withval/lib"
410 else
411 AC_MSG_RESULT([Looking for coredumper in system and home dirs (${HOME})...])
412 CPPFLAGS="$CPPFLAGS -I${HOME}/include -L${HOME}/lib"
413 LIBS="$LIBS -Wl,--rpath -Wl,${HOME}/lib"
414 fi
415 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.])],)
416 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.])])
417
418 dnl openssl checking
419 withval=''
420 AC_ARG_WITH(ssl,
421 [ --with-ssl=PATH Base path to where openssl is installed],)
422 if test "x$withval" != "x"; then
423 AC_MSG_RESULT(Using include dir $withval to find openssl)
424 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
425 LIBS="$LIBS -L$withval/lib"
426 else
427 AC_MSG_RESULT([Looking for openssl in system ])
428 fi
429
430 AC_CHECK_LIB(ssl, BIO_new,
431 [
432 LIBS="-lssl $LIBS"
433 AC_CHECK_HEADERS(openssl/bio.h,
434 [
435 AC_DEFINE(WITH_SSL, 1, [Define if SSL libs are linked])
436 ssl_message="LDAP library: enabled"
437 ],
438 [
439 if test "x$withval" != "x"; then
440 AC_MSG_ERROR([ssl headers not found])
441 fi
442 ])
443 ],
444 [
445 if test "x$withval" != "x"; then
446 AC_MSG_ERROR([libldap not found or not valid])
447 fi
448 ]
449 )
450 AC_MSG_RESULT($LIBS)
451
452
453 dnl ldap checking
454 withval=''
455 AC_ARG_WITH(ldap,
456 [ --with-ldap=PATH Base path to where the ldap library and headers are installed,
457 such that PATH/include/ldap.h and PATH/lib/libldap.so exist.],)
458 if test "x$withval" != "x"; then
459 AC_MSG_RESULT(Using include dir $withval to find libldap)
460 CPPFLAGS="$CPPFLAGS -I$withval/include -L$withval/lib"
461 LIBS="$LIBS -L$withval/lib"
462 else
463 AC_MSG_RESULT([Looking for ldap in system ])
464 fi
465
466 AC_CHECK_LIB(ldap, ldap_simple_bind_s,
467 [
468 LIBS="-lldap $LIBS"
469 AC_CHECK_HEADERS(ldap.h,
470 [
471 AC_DEFINE(WITH_LDAP, 1, [Define if LDAP libs are linked])
472 ldap_message="LDAP library: enabled"
473 ],
474 [
475 if test "x$withval" != "x"; then
476 AC_MSG_ERROR([ldap.h not found])
477 fi
478 ])
479 ],
480 [
481 if test "x$withval" != "x"; then
482 AC_MSG_ERROR([libldap not found or not valid])
483 fi
484 ]
485 )
486
487 dnl *********************************************************************
488 dnl ** PYTHON ***********************************************************
489 dnl *********************************************************************
490
491 if test "$python" = yes; then
492 AC_PATH_PROG(pythonpath, python2)
493 if test "_$pythonpath" = _ ; then
494 AC_PATH_PROG(pythonpath, python)
495 fi
496 if test "_$pythonpath" = _ ; then
497 python=no
498 else
499 AC_MSG_CHECKING(Python version)
500 changequote(<<, >>)dnl
501 PY_VER=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("VERSION")[0];'`
502 PY_LIB=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1);'`
503 PY_INC=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("INCLUDEPY")[0];'`
504 $pythonpath -c "import sys; map(int,sys.version[:3].split('.')) >= [2,2] or sys.exit(1)"
505 changequote([, ])dnl
506 AC_MSG_RESULT($PY_VER)
507 if test "$?" != "1"; then
508 AC_MSG_CHECKING(Python compile flags)
509 PY_PREFIX=`$pythonpath -c 'import sys; print sys.prefix'`
510 PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print sys.exec_prefix'`
511 if test -f $PY_INC/Python.h; then
512 AC_DEFINE(WITH_PYTHON, 1, [Define if using python])
513 PY_LIBS="-L$PY_LIB/config -lpython$PY_VER -lpthread -lutil"
514 PY_CFLAGS="-I$PY_INC"
515 AC_MSG_RESULT(ok)
516 CFLAGS="$CFLAGS $PY_CFLAGS"
517 LIBS="$LIBS $PY_LIBS"
518 else
519 python=no
520 AC_MSG_RESULT([Can't find Python.h])
521 fi
522 else
523 echo "Python too old. Only 2.2 or above is supported."
524 python=no
525 fi
526 fi
527 fi
528
529 AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes")
530
531 AC_MSG_RESULT($LIBS)
532
533 AC_DEFINE_UNQUOTED(CODENAME, "${CODENAME}", [Code name for this release])
534 AC_SUBST(MODULE_OBJS)
535 AC_SUBST(MY_SUBDIRS)
536 AC_SUBST(RX_INCLUDES)
537 AC_SUBST(RX_LIBS)
538 AC_SUBST(TRACK)
539 AC_SUBST(PY_CFLAGS)
540 AC_SUBST(PY_LIBS)
541
542 AC_CONFIG_FILES(Makefile rx/Makefile src/Makefile)
543 AC_OUTPUT
544
545
546 dnl Print configuration summary
547
548 cat <<EOF
549
550 Configuration summary
551 =====================
552
553 X3 is now configured as follows:
554
555 * Compilation environment
556
557 CC = $CC
558 CFLAGS = $CFLAGS
559 CPP = $CPP
560 CPPFLAGS = $CPPFLAGS
561 LD = $LD
562 LDFLAGS = $LDFLAGS
563 LIBS = $LIBS
564
565 * X3 options
566
567 Debug: $x3_debug
568 Extra Modules: $module_list
569 Malloc: $x3_malloc
570 Protocol: $x3_ircd
571 Regexp Library TRE $tre_version
572 Coredumper Library Coredumper $core_version
573 $ldap_message
574 python: $python
575
576 Install to: $prefix
577
578 Now you can proceed with compiling X3
579
580 EOF
581