]> jfr.im git - irc/evilnet/znc.git/blob - configure.ac
Initial commit for evilnet modifications to znc 1.6.2
[irc/evilnet/znc.git] / configure.ac
1 dnl This redefines AC_PROG_CC to a version which errors out instead. This is
2 dnl because all our tests should be done with the C++ compiler. This should
3 dnl catch stuff which accidentally uses the C compiler.
4 AC_DEFUN([AC_PROG_CC], [m4_errprint(__file__:__line__[: Something is trying to use the C compiler. Since this is a C++ project, this should not happen!
5 ])m4_exit(1)])
6
7 dnl Needed for AC_PATH_PROGS_FEATURE_CHECK which was added in 2.62
8 AC_PREREQ([2.62])
9 dnl Keep the version number in sync with version.h!
10 AC_INIT([znc], [1.6.2])
11 AC_CONFIG_MACRO_DIR([m4])
12 AC_CONFIG_SRCDIR([src/znc.cpp])
13 AC_LANG([C++])
14 AC_CONFIG_HEADERS([include/znc/zncconfig.h])
15 AH_TOP([#ifndef ZNCCONFIG_H
16 #define ZNCCONFIG_H])
17 AH_BOTTOM([#endif /* ZNCCONFIG_H */])
18
19 AC_DEFUN([ZNC_AUTO_FAIL], [
20 # This looks better in the summary at the end
21 $1="not found"
22 if test "x$old_$1" != "xauto" ; then
23 AC_MSG_ERROR([$2])
24 else
25 AC_MSG_WARN([$3])
26 fi
27 ])
28
29 # AC_PROG_CXX sets CXXFLAGS to "-O2 -g" if it is unset which we don't want
30 CXXFLAGS="$CXXFLAGS "
31 AC_PROG_CXX
32 # "Optional" because we want custom error message
33 AX_CXX_COMPILE_STDCXX_11([noext], [optional])
34 if test x"$HAVE_CXX11" != x1; then
35 AC_MSG_ERROR([Upgrade your compiler. GCC 4.7+ and Clang 3.2+ are known to work.])
36 fi
37
38 AC_PROG_INSTALL
39 AC_PROG_GREP
40 AC_PROG_SED
41 AC_CANONICAL_HOST
42 AC_SYS_LARGEFILE
43 ZNC_VISIBILITY
44 AC_PATH_PROG([GIT], [git])
45
46 appendLib () {
47 if test "$LIBS" != ""; then
48 LIBS="$LIBS $*"
49 else
50 LIBS=$*
51 fi
52 }
53
54 appendCXX () {
55 if test "$CXXFLAGS" != ""; then
56 CXXFLAGS="$CXXFLAGS $*"
57 else
58 CXXFLAGS=$*
59 fi
60 }
61
62 appendMod () {
63 if test "$MODFLAGS" != ""; then
64 MODFLAGS="$MODFLAGS $*"
65 else
66 MODFLAGS=$*
67 fi
68 }
69
70 appendLD () {
71 if test "$LDFLAGS" != ""; then
72 LDFLAGS="$LDFLAGS $*"
73 else
74 LDFLAGS=$*
75 fi
76 }
77
78 case "${host_os}" in
79 freebsd*)
80 # -D__GNU_LIBRARY__ makes this work on fbsd 4.11
81 appendCXX -I/usr/local/include -D__GNU_LIBRARY__
82 appendLib -L/usr/local/lib -lcompat
83 appendMod -L/usr/local/lib
84 ;;
85 solaris*)
86 appendLib -lsocket -lnsl -lresolv
87 ISSUN=1
88 ;;
89 cygwin)
90 # We don't want to use -std=gnu++11 instead of -std=c++11, but among other things, -std=c++11 defines __STRICT_ANSI__ which makes cygwin not to compile: undefined references to strerror_r, to fdopen, to strcasecmp, etc (their declarations in system headers are between ifdef)
91 appendCXX -U__STRICT_ANSI__
92 ISCYGWIN=1
93 ;;
94 darwin*)
95 ISDARWIN=1
96 ;;
97 esac
98
99 PKG_PROG_PKG_CONFIG()
100
101 AC_ARG_WITH( [openssl],
102 AS_HELP_STRING([--with-openssl=DIR], [openssl installation prefix]),
103 [OPENSSL=$withval],)
104 AC_ARG_ENABLE( [debug],
105 AS_HELP_STRING([--enable-debug], [enable debugging]),
106 [DEBUG="$enableval"],
107 [DEBUG="no"])
108 AC_ARG_ENABLE( [ipv6],
109 AS_HELP_STRING([--disable-ipv6], [disable ipv6 support]),
110 [IPV6="$enableval"],
111 [IPV6="yes"])
112 AC_ARG_ENABLE( [openssl],
113 AS_HELP_STRING([--disable-openssl], [disable openssl]),
114 [SSL="$enableval"],
115 [SSL="auto"])
116 AC_ARG_ENABLE( [zlib],
117 AS_HELP_STRING([--disable-zlib], [disable zlib]),
118 [ZLIB="$enableval"],
119 [ZLIB="auto"])
120 AC_ARG_ENABLE( [perl],
121 AS_HELP_STRING([--enable-perl], [enable perl]),
122 [PERL="$enableval"],
123 [PERL="no"])
124 AC_ARG_ENABLE( [python],
125 AS_HELP_STRING([--enable-python[[[=python3]]]], [enable python.
126 By default python3.pc of pkg-config is used, but you can use
127 another name, for example python-3.1]),
128 [PYTHON="$enableval"],
129 [PYTHON="no"])
130 AC_ARG_ENABLE( [swig],
131 AS_HELP_STRING([--enable-swig], [Enable automatic generation of source files needed for modperl/modpython.
132 This value is ignored if perl and python are disabled.
133 Usually no need to enable it.
134 ]),
135 [USESWIG="$enableval"],
136 [USESWIG="auto"])
137 AC_ARG_ENABLE( [cyrus],
138 AS_HELP_STRING([--enable-cyrus], [enable cyrus]),
139 [if test "$enableval" = "yes" ; then CYRUS=1; fi],)
140 AC_ARG_ENABLE( [optimization],
141 AS_HELP_STRING([--disable-optimization], [Disable some compiler optimizations to
142 decrease memory usage while compiling]),
143 [OPTIMIZE="$enableval"],
144 [OPTIMIZE="yes"])
145 AC_ARG_ENABLE( [tdns],
146 AS_HELP_STRING([--disable-tdns], [disable threads usage for DNS resolving]),
147 [TDNS="$enableval"],
148 [TDNS="auto"])
149 AC_ARG_ENABLE( [run-from-source],
150 AS_HELP_STRING([--enable-run-from-source], [ZNC will be runnable without installation]),
151 [if test "x$enableval" = "xyes" ; then
152 AC_DEFINE([RUN_FROM_SOURCE], [1],
153 [Define if ZNC should be runnable without installation])
154 fi
155 RUNFROMSOURCE="$enableval"],
156 [RUNFROMSOURCE="no"])
157 AC_ARG_ENABLE( [poll],
158 AS_HELP_STRING([--disable-poll], [use select() instead of poll()]),
159 [POLL="$enableval"],
160 [POLL="yes"])
161 AC_ARG_WITH( [gtest],
162 AS_HELP_STRING([--with-gtest=DIR], [Path to directory with src/gtest-all.cc and src/gtest_main.cc files.
163 If not specified, "make test" will download gtest tarball and use it.]))
164
165 AC_ARG_WITH([systemdsystemunitdir],
166 AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
167 [
168 if test x"$with_systemdsystemunitdir" = xyes; then
169 with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
170 fi
171 ])
172 if test "x$with_gtest" != xno; then
173 AC_SUBST([GTEST_DIR], [$with_gtest])
174 fi
175 if test "x$with_systemdsystemunitdir" != xno; then
176 AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
177 fi
178 AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
179
180 # In old times needed to define _FORTIFY_SOURCE to 2 ourself.
181 # Then GCC started to define it itself to 2. It was ok.
182 # But then GCC 4.7 started to define it to 0 or 2 depending on optimization level, and it started to conflict with our define.
183 AC_MSG_CHECKING([whether compiler predefines _FORTIFY_SOURCE])
184 AC_COMPILE_IFELSE([
185 AC_LANG_PROGRAM([[
186 ]], [[
187 #ifndef _FORTIFY_SOURCE
188 #error "Just checking, nothing fatal here"
189 #endif
190 ]])
191 ], [
192 AC_MSG_RESULT([yes])
193 ], [
194 AC_MSG_RESULT([no])
195 appendCXX "-D_FORTIFY_SOURCE=2"
196 ])
197
198 if test "$DEBUG" != "no"; then
199 appendCXX -ggdb3
200 AC_DEFINE([_DEBUG], [1], [Define for debugging])
201 if test "x$ISCYGWIN" != x1; then
202 # These enable some debug options in g++'s STL, e.g. invalid use of iterators
203 # But they cause crashes on cygwin while loading modules
204 AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++])
205 AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++])
206 fi
207 else
208 if test "x$OPTIMIZE" = "xyes"; then
209 appendCXX -O2
210 fi
211 fi
212
213 if test "$IPV6" != "no"; then
214 AC_DEFINE([HAVE_IPV6], [1], [Define if IPv6 support is enabled])
215 fi
216
217 if test "x$GXX" = "xyes"; then
218 appendCXX -Wall -W -Wno-unused-parameter -Woverloaded-virtual -Wshadow
219 fi
220
221 if test "$POLL" = "yes"; then
222 # poll() is broken on Mac OS, it fails with POLLNVAL for pipe()s.
223 if test -n "$ISDARWIN"
224 then
225 # Did they give us --enable-poll?
226 if test -n "$enable_poll"
227 then
228 # Yes, they asked for this.
229 AC_MSG_WARN([poll() is known to be broken on Mac OS X. You have been warned.])
230 else
231 # No, our default value of "yes" got applied.
232 AC_MSG_WARN([poll() is known to be broken on Mac OS X. Using select() instead.])
233 AC_MSG_WARN([Use --enable-poll for forcing poll() to be used.])
234 POLL=no
235 fi
236 fi
237 if test "$POLL" = "yes"; then
238 AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()])
239 fi
240 fi
241
242 AC_CHECK_LIB( gnugetopt, getopt_long,)
243 AC_CHECK_FUNCS([lstat getopt_long getpassphrase])
244
245 # ----- Check for dlopen
246
247 AC_SEARCH_LIBS([dlopen], [dl], [],
248 [AC_MSG_ERROR([Could not find dlopen. ZNC will not work on this box until you upgrade this ancient system or at least install the necessary system libraries.])])
249
250 # ----- Check for pthreads
251
252 DNS_TEXT=blocking
253 if test "x$TDNS" != "xno"; then
254 old_TDNS=$TDNS
255 AX_PTHREAD([
256 AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.])
257 appendCXX "$PTHREAD_CFLAGS"
258 appendLib "$PTHREAD_LIBS"
259 AC_MSG_CHECKING([whether getaddrinfo() supports AI_ADDRCONFIG])
260 AC_COMPILE_IFELSE([
261 AC_LANG_PROGRAM([[
262 #include <sys/types.h>
263 #include <sys/socket.h>
264 #include <netdb.h>
265 ]], [[
266 int x = AI_ADDRCONFIG;
267 (void) x;
268 ]])
269 ], [
270 AC_MSG_RESULT([yes])
271 TDNS=yes
272 ], [
273 AC_MSG_RESULT([no])
274 TDNS=no
275 # Note that broken systems, such as OpenBSD, NetBSD, which don't support AI_ADDRCONFIG,
276 # also have thread-unsafe getaddrinfo().
277 ])
278 ], [
279 TDNS=no
280 ])
281 if test "x$TDNS" = "xyes"; then
282 DNS_TEXT=threads
283 AC_DEFINE([HAVE_THREADED_DNS], [1], [Define if threaded DNS is enabled])
284 else
285 ZNC_AUTO_FAIL([TDNS],
286 [support for threaded DNS not found. Try --disable-tdns.
287 Disabling it may result in a slight performance decrease but will not have any other side-effects],
288 [support for threaded DNS not found, so DNS resolving will be blocking])
289 fi
290 fi
291
292 # ----- Check for openssl
293
294 SSL_TEXT="$SSL"
295 if test "x$SSL" != "xno"; then
296 if test -n "$OPENSSL"; then
297 appendLib -L${OPENSSL}/lib
298 appendLib -L${OPENSSL}/lib64
299 appendCXX -I${OPENSSL}/include
300 PKG_CONFIG_PATH="$OPENSSL/lib/pkgconfig/:$OPENSSL/lib64/pkgconfig/:$PKG_CONFIG_PATH"
301 fi
302
303 old_SSL=$SSL
304 PKG_CHECK_MODULES([openssl], [openssl], [
305 appendLib "$openssl_LIBS"
306 appendCXX "$openssl_CFLAGS"
307 ], [
308 # Don't reorder this!
309 # On some arches libssl depends on libcrypto without linking to it :(
310 AC_CHECK_LIB( crypto, BIO_new,, SSL=no ; SSL_TEXT="no (libcrypt not found)" )
311 AC_CHECK_LIB( ssl, SSL_shutdown,, SSL=no ; SSL_TEXT="no (libssl not found)" )
312 ])
313
314 if test "x$SSL" != "xno"; then
315 AC_MSG_CHECKING([whether openssl is usable])
316 AC_LINK_IFELSE([
317 AC_LANG_PROGRAM([[
318 #include <openssl/ssl.h>
319 ]], [[
320 SSL_CTX* ctx = SSL_CTX_new(TLSv1_method());
321 SSL* ssl = SSL_new(ctx);
322 DH* dh = DH_new();
323 DH_free(dh);
324 SSL_free(ssl);
325 SSL_CTX_free(ctx);
326 ]])
327 ], [
328 AC_MSG_RESULT([yes])
329 ], [
330 AC_MSG_RESULT([no])
331 SSL=no
332 SSL_TEXT="no (openssl not usable)"
333 ])
334
335 fi
336
337 if test "x$SSL" = "xno" ; then
338 ZNC_AUTO_FAIL([SSL],
339 [OpenSSL not found. Try --disable-openssl.],
340 [OpenSSL was not found and thus disabled])
341 NOSSL=1
342 else
343 AC_DEFINE([HAVE_LIBSSL], [1], [Define if openssl is enabled])
344 SSL=yes
345 SSL_TEXT=yes
346 fi
347 else
348 NOSSL=1
349 SSL_TEXT="no (explicitly disabled)"
350 fi
351
352 # ----- Check for zlib
353
354 old_ZLIB="$ZLIB"
355 ZLIB_TEXT="$ZLIB"
356 if test "x$ZLIB" != "xno"; then
357 AC_MSG_CHECKING([whether zlib is usable])
358 my_saved_LIBS="$LIBS"
359 appendLib "-lz"
360 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
361 #include "zlib.h"
362 ]], [[
363 z_stream zs;
364 (void) deflateInit2(&zs, 0, 0, 0, 0, 0);
365 (void) deflate(&zs, 0);
366 ]])
367 ], [
368 AC_MSG_RESULT([yes])
369 ZLIB=yes
370 ZLIB_TEXT=yes
371 ], [
372 AC_MSG_RESULT([no])
373 ZLIB=no
374 ZLIB_TEXT="no (libz not found)"
375 ])
376 if test "x$ZLIB" = "xno"; then
377 ZNC_AUTO_FAIL([ZLIB],
378 [zlib was not found. Try --disable-zlib],
379 [zlib was not found and thus disabled])
380 LIBS="$my_saved_LIBS"
381 else
382 AC_DEFINE([HAVE_ZLIB], [1], [Define if zlib is available])
383 fi
384 fi
385
386 AC_ARG_ENABLE( [charset],
387 AS_HELP_STRING([--disable-charset], [disable ICU support]),
388 [HAVE_ICU="$enableval"],
389 [HAVE_ICU="auto"])
390 if test "x$HAVE_ICU" != "xno"
391 then
392 old_HAVE_ICU="$HAVE_ICU"
393 PKG_CHECK_MODULES([icu], [icu-uc], [
394 appendLib "$icu_LIBS"
395 appendCXX "$icu_CFLAGS"
396 HAVE_ICU=yes
397 AC_DEFINE([HAVE_ICU], [1], [Enable ICU library for Unicode handling])
398 AC_DEFINE([U_USING_ICU_NAMESPACE], [0], [Do not clutter global namespace with ICU C++ stuff])
399 ], [
400 ZNC_AUTO_FAIL([HAVE_ICU],
401 [support for charset conversion not found. Try --disable-charset.],
402 [support for charset conversion not found and thus disabled])
403 HAVE_ICU="no (icu-uc not found via pkg-config)"
404 ])
405 fi
406
407 AC_ARG_WITH( [module-prefix],
408 AS_HELP_STRING([--with-module-prefix], [module object code [LIBDIR/znc]]),
409 [MODDIR=$withval],
410 [MODDIR="${libdir}/znc"] )
411
412 AC_ARG_WITH( [module-data-prefix],
413 AS_HELP_STRING([--with-module-data-prefix=DIR],
414 [static module data (webadmin skins) [DATADIR/znc]]),
415 [DATADIR=$withval],
416 [DATADIR="${datadir}/znc"] )
417
418 appendMod "$CXXFLAGS"
419 appendMod "$CFLAG_VISIBILITY"
420
421 if test -z "$ISSUN" -a -z "$ISDARWIN" -a -z "$ISCYGWIN"; then
422 # This is an unknown compiler flag on some OS
423 appendLD -Wl,--export-dynamic
424 fi
425
426 if test -z "$ISCYGWIN" ; then
427 # cygwin doesn't need -fPIC, everything else does (for modules)
428 # warning: -fPIC ignored for target (all code is position independent)
429 appendMod -fPIC
430 else
431 # But cygwin does want most of ZNC in a shared lib
432 LIBZNC="libznc.dll"
433 LIBZNCDIR="$bindir"
434 fi
435
436 if test -z "$ISDARWIN"; then
437 MODLINK="-shared"
438 else
439 # Mac OS X differentiates between shared libs (-dynamiclib)
440 # and loadable modules (-bundle).
441 MODLINK="-bundle -flat_namespace -undefined suppress"
442 # TODO test if -twolevel_namespace and/or
443 # -undefined dynamic_lookup work
444 # (dynamic_lookup might only work on 10.4 and later)
445 fi
446
447 if test "x$PERL" != xno -o "x$PYTHON" != xno; then
448 old_USESWIG="$USESWIG"
449 if test "x$USESWIG" != "xno"; then
450 AC_PROG_SWIG([3.0.0])
451 test -z "$SWIG" && USESWIG=no
452 if test "x$USESWIG" = xno -a "x$old_USESWIG" = yes; then
453 AC_MSG_ERROR([Could not found appropriate SWIG installation. Check config.log for details.])
454 fi
455 fi
456 if test -r "$srcdir/modules/modperl/ZNC.cpp" -a -r "$srcdir/modules/modpython/_znc_core.cpp"; then
457 AC_MSG_NOTICE([modperl/modpython files are found, disabling SWIG])
458 USESWIG=no
459 fi
460 if test "x$USESWIG" = xno; then
461 if test ! -r "$srcdir/modules/modperl/ZNC.cpp" -o ! -r "$srcdir/modules/modpython/_znc_core.cpp"; then
462 AC_MSG_ERROR([Can not build modperl/modpython. Either install SWIG, or build ZNC from a tarball, or disable modperl/modpython. Check config.log for details.])
463 else
464 AC_MSG_NOTICE([modperl/modpython files are found, no SWIG needed])
465 fi
466 USESWIG="not needed"
467 SWIG=""
468 else
469 USESWIG=yes
470 fi
471 else
472 if test "x$USESWIG" = "xyes"; then
473 AC_MSG_WARN([swig is used only for perl and python, but both are disabled. Disabling swig.])
474 fi
475 USESWIG='not needed'
476 fi
477
478 PERL_TEXT="$PERL"
479 if test "x$PERL" != "xno"; then
480 old_PERL="$PERL"
481 AC_PATH_PROG([PERL_BINARY], [perl], [])
482 if test -n "$PERL_BINARY" && eval "$PERL_BINARY -e'use 5.010'"; then
483 my_saved_LDFLAGS="$LDFLAGS"
484 appendLD `$PERL_BINARY -MExtUtils::Embed -e ccopts -e ldopts`
485 AC_CHECK_LIB(perl, perl_alloc,
486 [: No, we do not want autoconf to do sth automatically],
487 PERL="no" ; PERL_TEXT="no (libperl not found)")
488 LDFLAGS="$my_saved_LDFLAGS"
489 else
490 PERL="no"
491 PERL_TEXT="no (perl binary not found or too old)"
492 fi
493 if test "x$PERL" = "xno"; then
494 ZNC_AUTO_FAIL([PERL],
495 [perl not found. Try --disable-perl.],
496 [perl was not found and thus disabled])
497 PERL_BINARY=""
498 else
499 PERL="yes"
500 PERL_TEXT="yes"
501 fi
502 fi
503
504 PYTHON_TEXT="$PYTHON"
505 if test "x$PYTHON" != "xno"; then
506 # Default value for just --enable-python
507 if test "x$PYTHON" = "xyes"; then
508 PYTHON="python3"
509 fi
510 old_PYTHON="$PYTHON"
511 if test -z "$PKG_CONFIG"; then
512 AC_MSG_ERROR([pkg-config is required for modpython.])
513 fi
514 PKG_CHECK_MODULES([python], [$PYTHON >= 3.0],, AC_MSG_ERROR([$PYTHON.pc not found or is wrong. Try --disable-python or install python3.]))
515 my_saved_LIBS="$LIBS"
516 my_saved_CXXFLAGS="$CXXFLAGS"
517 appendLib $python_LIBS
518 appendCXX $python_CFLAGS
519 AC_CHECK_FUNC([Py_Initialize], [], [PYTHON="no" ; PYTHON_TEXT="no (libpython not found)"])
520 if test "x$PYTHON" != "xno"; then
521 # Yes, modpython depends on perl.
522 AC_PATH_PROG([PERL_BINARY], [perl])
523 if test -z "$PERL_BINARY"; then
524 AC_MSG_ERROR([To compile modpython you need to be able to execute perl scripts. Try --disable-python or install perl.])
525 fi
526 LIBS="$my_saved_LIBS"
527 CXXFLAGS="$my_saved_CXXFLAGS"
528 fi
529 if test "x$PYTHON" = "xno"; then
530 ZNC_AUTO_FAIL([PYTHON],
531 [python not found. Try --disable-python.],
532 [python was not found and thus disabled])
533 PYTHONCFG_BINARY=""
534 else
535 PYTHON="yes"
536 PYTHON_TEXT="yes"
537 fi
538 fi
539
540 if test -n "$CYRUS"; then
541 AC_CHECK_LIB( sasl2, sasl_server_init,
542 [: Dont let autoconf add -lsasl2, Makefile handles that],
543 AC_MSG_ERROR([could not find libsasl2. Try --disable-cyrus.]))
544 fi
545
546 # Check if we want modtcl
547 AC_ARG_ENABLE( [tcl],
548 AS_HELP_STRING([--enable-tcl], [enable modtcl]),
549 [TCL="$enableval"],
550 [TCL="no"])
551
552 AC_ARG_WITH( [tcl-flags],
553 AS_HELP_STRING([--with-tcl-flags=FLAGS],
554 [The flags needed for compiling and linking modtcl]),
555 [TCL_FLAGS="$withval"],)
556
557 if test x"$TCL" = "xyes"
558 then
559 AC_ARG_WITH( [tcl],
560 AS_HELP_STRING([--with-tcl=DIR],
561 [directory containing tclConfig.sh]),
562 TCL_DIR="${withval}")
563
564 # This will need to be extended in the future, but I don't think
565 # it's a good idea to stuff a shitload of random stuff in here right now
566 for path in $TCL_DIR /usr/lib /usr/lib/tcl8.4 /usr/lib/tcl8.5
567 do
568 file="${path}/tclConfig.sh"
569 AC_MSG_CHECKING([for ${file}])
570 if test -r ${file}
571 then
572 TCL_CONF=${file}
573 AC_MSG_RESULT([yes])
574 break
575 fi
576 AC_MSG_RESULT([no])
577 done
578
579 if test x"${TCL_CONF}" = x
580 then
581 # They --enable-tcl'd, so give them some sane default
582 TCL_FLAGS="-I/usr/include/tcl -ltcl"
583 AC_MSG_WARN([Could not find tclConfig.sh, using some sane defaults.])
584 else
585 AC_MSG_CHECKING([modtcl flags])
586 . ${TCL_CONF}
587 # eval because those vars depend on other vars in there
588 eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
589 eval "TCL_INCLUDE_SPEC=\"${TCL_INCLUDE_SPEC}\""
590 TCL_FLAGS="$TCL_INCLUDE_SPEC $TCL_LIB_SPEC"
591 AC_MSG_RESULT([$TCL_FLAGS])
592 fi
593 my_saved_LIBS="$LIBS"
594 appendLib "$TCL_FLAGS"
595 AC_CHECK_FUNC([Tcl_CreateInterp], [TCL_TEST=yes], [TCL_TEST=no])
596 if test x"$TCL_TEST" = "xno"; then
597 AC_MSG_ERROR([tcl not found, try --disable-tcl, or install tcl properly. If tcl is installed to a non-standard path, use --enable-tcl --with-tcl=/path])
598 fi
599 LIBS="$my_saved_LIBS"
600 fi
601
602 AC_CACHE_CHECK([for GNU make], [ac_cv_path_GNUMAKE], [
603 AC_PATH_PROGS_FEATURE_CHECK([GNUMAKE], [make gmake], [[
604 if $ac_path_GNUMAKE --version | $GREP GNU > /dev/null; then
605 ac_cv_path_GNUMAKE=$ac_path_GNUMAKE
606 ac_path_GNUMAKE_found=:
607 fi
608 ]], [AC_MSG_ERROR([could not find GNU make])]
609 )
610 ])
611 GNUMAKE_DIRNAME=`AS_DIRNAME(["$ac_cv_path_GNUMAKE"])`
612 GNUMAKE=`echo $ac_cv_path_GNUMAKE | $SED "s%$GNUMAKE_DIRNAME/%%"`
613
614 # this is in the end, for not trying to include it when it doesn't exist yet
615 appendCXX "-include znc/zncconfig.h"
616 appendMod "-include znc/zncconfig.h"
617
618 AC_SUBST([CXXFLAGS])
619 AC_SUBST([CPPFLAGS])
620 AC_SUBST([MODFLAGS])
621 AC_SUBST([LDFLAGS])
622 AC_SUBST([LIBS])
623 AC_SUBST([LIBZNC])
624 AC_SUBST([LIBZNCDIR])
625 AC_SUBST([ISCYGWIN])
626 AC_SUBST([MODLINK])
627 AC_SUBST([NOSSL])
628 AC_SUBST([TCL_FLAGS])
629 AC_SUBST([CYRUS])
630 AC_SUBST([MODDIR])
631 AC_SUBST([DATADIR])
632 AC_SUBST([PERL])
633 AC_SUBST([PYTHON])
634 AC_SUBST([SWIG])
635 AC_SUBST([python_CFLAGS])
636 AC_SUBST([python_LIBS])
637 AC_CONFIG_FILES([Makefile])
638 AC_CONFIG_FILES([znc-buildmod])
639 AC_CONFIG_FILES([man/Makefile])
640 AC_CONFIG_FILES([znc.pc])
641 AC_CONFIG_FILES([znc-uninstalled.pc])
642 AC_CONFIG_FILES([modules/Makefile])
643 AC_OUTPUT
644
645 if test "x$ISCYGWIN" = x1; then
646 # Side effect of undefining __STRICT_ANSI__
647 # http://llvm.org/bugs/show_bug.cgi?id=13530
648 echo >> include/znc/zncconfig.h
649 echo '#ifndef ZNCCONFIG_H_ADDITIONS' >> include/znc/zncconfig.h
650 echo '#define ZNCCONFIG_H_ADDITIONS' >> include/znc/zncconfig.h
651 echo '#ifdef __clang__' >> include/znc/zncconfig.h
652 echo 'struct __float128;' >> include/znc/zncconfig.h
653 echo '#endif' >> include/znc/zncconfig.h
654 echo '#endif' >> include/znc/zncconfig.h
655 fi
656
657 echo
658 echo ZNC AC_PACKAGE_VERSION configured
659 echo
660 echo "prefix: $prefix"
661 echo "debug: $DEBUG"
662 echo "ipv6: $IPV6"
663 echo "openssl: $SSL_TEXT"
664 echo "dns: $DNS_TEXT"
665 echo "perl: $PERL_TEXT"
666 echo "python: $PYTHON_TEXT"
667 echo "swig: $USESWIG"
668 if test x"$CYRUS" = "x" ; then
669 echo "cyrus: no"
670 else
671 echo "cyrus: yes"
672 fi
673 if test x"$TCL_FLAGS" = "x" ; then
674 echo "tcl: no"
675 else
676 echo "tcl: yes"
677 fi
678 echo "charset: $HAVE_ICU"
679 echo "zlib: $ZLIB_TEXT"
680 echo "run from src: $RUNFROMSOURCE"
681 echo
682 echo "Now you can run \"$GNUMAKE\" to compile ZNC"
683