]>
Commit | Line | Data |
---|---|---|
6f2335d5 US |
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 | ||
5ca6291f US |
7 | dnl Needed for AC_PATH_PROGS_FEATURE_CHECK which was added in 2.62 |
8 | AC_PREREQ([2.62]) | |
55b5c242 | 9 | dnl Keep the version number in sync with version.h! |
5cde1eb3 | 10 | AC_INIT([znc], [1.7.2]) |
2ed4d1b6 | 11 | LIBZNC_VERSION=1.7.2 |
7d912d1d | 12 | AC_CONFIG_MACRO_DIR([m4]) |
afeab4a9 | 13 | AC_CONFIG_SRCDIR([src/znc.cpp]) |
9c4a5a1d | 14 | AC_LANG([C++]) |
afeab4a9 | 15 | AC_CONFIG_HEADERS([include/znc/zncconfig.h]) |
3ecbf133 | 16 | AH_TOP([#ifndef ZNCCONFIG_H |
17 | #define ZNCCONFIG_H]) | |
18 | AH_BOTTOM([#endif /* ZNCCONFIG_H */]) | |
9c4a5a1d | 19 | |
226d8db5 | 20 | AC_DEFUN([ZNC_AUTO_FAIL], [ |
521695fb | 21 | # This looks better in the summary at the end |
22 | $1="not found" | |
16464664 | 23 | if test "x$old_$1" != "xauto" ; then |
521695fb | 24 | AC_MSG_ERROR([$2]) |
25 | else | |
26 | AC_MSG_WARN([$3]) | |
27 | fi | |
28 | ]) | |
29 | ||
9c4a5a1d | 30 | # AC_PROG_CXX sets CXXFLAGS to "-O2 -g" if it is unset which we don't want |
0a36695a | 31 | CXXFLAGS="$CXXFLAGS " |
d9591e95 | 32 | AC_PROG_CXX |
1f89b67a AS |
33 | # "Optional" because we want custom error message |
34 | AX_CXX_COMPILE_STDCXX_11([noext], [optional]) | |
35 | if test x"$HAVE_CXX11" != x1; then | |
79ec016f | 36 | AC_MSG_ERROR([Upgrade your compiler. GCC 4.8+ and Clang 3.2+ are known to work.]) |
1f89b67a AS |
37 | fi |
38 | ||
d1de3746 | 39 | appendLib () { |
d9591e95 | 40 | if test "$LIBS" != ""; then |
41 | LIBS="$LIBS $*" | |
42 | else | |
43 | LIBS=$* | |
44 | fi | |
45 | } | |
46 | ||
d1de3746 | 47 | appendCXX () { |
d9591e95 | 48 | if test "$CXXFLAGS" != ""; then |
49 | CXXFLAGS="$CXXFLAGS $*" | |
50 | else | |
51 | CXXFLAGS=$* | |
52 | fi | |
53 | } | |
0a622749 | 54 | |
90cf81e6 | 55 | appendMod () { |
56 | if test "$MODFLAGS" != ""; then | |
57 | MODFLAGS="$MODFLAGS $*" | |
58 | else | |
59 | MODFLAGS=$* | |
60 | fi | |
61 | } | |
62 | ||
d1de3746 | 63 | appendLD () { |
0a622749 | 64 | if test "$LDFLAGS" != ""; then |
65 | LDFLAGS="$LDFLAGS $*" | |
66 | else | |
67 | LDFLAGS=$* | |
68 | fi | |
69 | } | |
70 | ||
1cce7f69 AS |
71 | AC_PROG_INSTALL |
72 | AC_PROG_GREP | |
73 | AC_PROG_SED | |
74 | AC_CANONICAL_HOST | |
75 | AC_SYS_LARGEFILE | |
76 | ZNC_VISIBILITY | |
77 | AC_PATH_PROG([GIT], [git]) | |
524ec572 WK |
78 | PKG_PROG_PKG_CONFIG() |
79 | ||
759d11fc | 80 | AC_ARG_ENABLE( [debug], |
7e61148a | 81 | AS_HELP_STRING([--enable-debug], [enable debugging]), |
759d11fc | 82 | [DEBUG="$enableval"], |
83 | [DEBUG="no"]) | |
84 | AC_ARG_ENABLE( [ipv6], | |
f4e36a0b | 85 | AS_HELP_STRING([--disable-ipv6], [disable ipv6 support]), |
759d11fc | 86 | [IPV6="$enableval"], |
f4e36a0b | 87 | [IPV6="yes"]) |
759d11fc | 88 | AC_ARG_ENABLE( [openssl], |
9c4a5a1d | 89 | AS_HELP_STRING([--disable-openssl], [disable openssl]), |
f0232425 | 90 | [SSL="$enableval"], |
16464664 | 91 | [SSL="auto"]) |
ea947956 IR |
92 | AC_ARG_ENABLE( [zlib], |
93 | AS_HELP_STRING([--disable-zlib], [disable zlib]), | |
94 | [ZLIB="$enableval"], | |
95 | [ZLIB="auto"]) | |
759d11fc | 96 | AC_ARG_ENABLE( [perl], |
a44e6eaa | 97 | AS_HELP_STRING([--enable-perl], [enable perl]), |
16464664 | 98 | [PERL="$enableval"], |
a44e6eaa | 99 | [PERL="no"]) |
a564e25c | 100 | AC_ARG_ENABLE( [python], |
ba915eb9 AS |
101 | AS_HELP_STRING([--enable-python[[[=python3]]]], [enable python. |
102 | By default python3.pc of pkg-config is used, but you can use | |
103 | another name, for example python-3.1]), | |
a564e25c | 104 | [PYTHON="$enableval"], |
105 | [PYTHON="no"]) | |
a44e6eaa | 106 | AC_ARG_ENABLE( [swig], |
3d152b16 AS |
107 | AS_HELP_STRING([--enable-swig], [Enable automatic generation of source files needed for modperl/modpython. |
108 | This value is ignored if perl and python are disabled. | |
109 | Usually no need to enable it. | |
110 | ]), | |
7d912d1d AS |
111 | [USESWIG="$enableval"], |
112 | [USESWIG="auto"]) | |
63ab3c09 KF |
113 | AC_ARG_ENABLE( [cyrus], |
114 | AS_HELP_STRING([--enable-cyrus], [enable cyrus]), | |
115 | [if test "$enableval" = "yes" ; then CYRUS=1; fi],) | |
29dab181 | 116 | AC_ARG_ENABLE( [optimization], |
9c4a5a1d | 117 | AS_HELP_STRING([--disable-optimization], [Disable some compiler optimizations to |
29dab181 | 118 | decrease memory usage while compiling]), |
119 | [OPTIMIZE="$enableval"], | |
120 | [OPTIMIZE="yes"]) | |
717d0596 AS |
121 | AC_ARG_ENABLE( [tdns], |
122 | AS_HELP_STRING([--disable-tdns], [disable threads usage for DNS resolving]), | |
123 | [TDNS="$enableval"], | |
124 | [TDNS="auto"]) | |
fe6a930a | 125 | AC_ARG_ENABLE( [run-from-source], |
d252a2b4 | 126 | AS_HELP_STRING([--enable-run-from-source], [ZNC will be runnable without installation]), |
0f6c1f9e | 127 | [if test "x$enableval" = "xyes" ; then |
40a1bbac | 128 | AC_DEFINE([RUN_FROM_SOURCE], [1], |
129 | [Define if ZNC should be runnable without installation]) | |
d72fc441 | 130 | fi |
131 | RUNFROMSOURCE="$enableval"], | |
132 | [RUNFROMSOURCE="no"]) | |
0f9f2468 | 133 | AC_ARG_ENABLE( [poll], |
134 | AS_HELP_STRING([--disable-poll], [use select() instead of poll()]), | |
135 | [POLL="$enableval"], | |
136 | [POLL="yes"]) | |
6f40e5dd | 137 | |
17907784 | 138 | AC_ARG_WITH( [gtest], |
6f40e5dd AS |
139 | AS_HELP_STRING([--with-gtest=DIR], [Path to directory with src/gtest-all.cc file. |
140 | If not specified, git submodule will be used. | |
141 | If it is not available either, "make test" will fail.])) | |
142 | if test "x$with_gtest" != xno; then | |
143 | AC_SUBST([GTEST_DIR], [$with_gtest]) | |
144 | fi | |
145 | AC_ARG_WITH([gmock], | |
146 | AS_HELP_STRING([--with-gmock=DIR], [Path to directory with src/gmock-all.cc and src/gmock_main.cc files. | |
147 | If not specified, git submodule will be used. | |
148 | If it is not available either, "make test" will fail.])) | |
149 | if test "x$with_gmock" != xno; then | |
150 | AC_SUBST([GMOCK_DIR], [$with_gmock]) | |
151 | fi | |
152 | ||
74213c9a | 153 | |
40641b40 WK |
154 | AC_ARG_WITH([systemdsystemunitdir], |
155 | AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), | |
d5437282 AS |
156 | [ |
157 | if test x"$with_systemdsystemunitdir" = xyes; then | |
158 | with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) | |
159 | fi | |
160 | ]) | |
40641b40 WK |
161 | if test "x$with_systemdsystemunitdir" != xno; then |
162 | AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) | |
163 | fi | |
164 | AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) | |
165 | ||
1cce7f69 AS |
166 | case "${host_os}" in |
167 | freebsd*) | |
168 | # -D__GNU_LIBRARY__ makes this work on fbsd 4.11 | |
169 | appendCXX -I/usr/local/include -D__GNU_LIBRARY__ | |
170 | appendLib -L/usr/local/lib -lcompat | |
171 | appendMod -L/usr/local/lib | |
172 | ;; | |
173 | solaris*) | |
174 | appendLib -lsocket -lnsl -lresolv | |
175 | ISSUN=1 | |
176 | ;; | |
177 | cygwin) | |
178 | # 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) | |
179 | appendCXX -U__STRICT_ANSI__ | |
180 | ISCYGWIN=1 | |
181 | ;; | |
182 | darwin*) | |
183 | ISDARWIN=1 | |
184 | ||
1cce7f69 AS |
185 | AC_PATH_PROG([BREW], [brew]) |
186 | if test -n "$BREW"; then | |
187 | # add default homebrew paths | |
188 | ||
189 | if test "x$HAVE_ICU" != "xno"; then | |
190 | AC_MSG_CHECKING([icu4c via homebrew]) | |
191 | icu4c_prefix=`$BREW --prefix icu4c` | |
192 | if test -n "$icu4c_prefix"; then | |
a08d0497 | 193 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$icu4c_prefix/lib/pkgconfig" |
1cce7f69 AS |
194 | AC_MSG_RESULT([$icu4c_prefix]) |
195 | else | |
196 | AC_MSG_RESULT([no]) | |
197 | fi | |
198 | fi | |
199 | ||
200 | if test "x$PYTHON" != "xno"; then | |
201 | brew_python_pc="$PYTHON" | |
202 | # This is duplication of non-darwin python logic below... | |
203 | if test "x$brew_python_pc" = "xyes"; then | |
204 | brew_python_pc="python3" | |
205 | fi | |
206 | AC_MSG_CHECKING([python3 via homebrew]) | |
207 | python3_prefix=`$BREW --prefix python3` | |
208 | if test -n "$python3_prefix"; then | |
209 | python3_prefix=`find "$python3_prefix/" -name $brew_python_pc.pc | head -n1` | |
210 | if test -n "$python3_prefix"; then | |
211 | python3_prefix=`dirname "$python3_prefix"` | |
a08d0497 | 212 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$python3_prefix" |
1cce7f69 AS |
213 | AC_MSG_RESULT([$python3_prefix]) |
214 | else | |
215 | AC_MSG_RESULT([no $brew_python_pc.pc found]) | |
216 | fi | |
217 | else | |
218 | AC_MSG_RESULT([no]) | |
219 | fi | |
220 | fi | |
221 | ||
222 | if test "x$SSL" != "xno"; then | |
223 | AC_MSG_CHECKING([openssl via homebrew]) | |
f2936375 N |
224 | openssl_prefix=`$BREW --prefix openssl` |
225 | if test -n "$openssl_prefix"; then | |
226 | export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$openssl_prefix/lib/pkgconfig" | |
227 | AC_MSG_RESULT([$openssl_prefix]) | |
1cce7f69 | 228 | else |
f2936375 | 229 | AC_MSG_RESULT([no]) |
1cce7f69 AS |
230 | fi |
231 | fi | |
232 | fi | |
233 | ;; | |
234 | esac | |
235 | ||
759d11fc | 236 | if test "$DEBUG" != "no"; then |
02605581 | 237 | appendCXX -ggdb3 |
40a1bbac | 238 | AC_DEFINE([_DEBUG], [1], [Define for debugging]) |
a1e8b086 AS |
239 | if test "x$ISCYGWIN" != x1; then |
240 | # These enable some debug options in g++'s STL, e.g. invalid use of iterators | |
241 | # But they cause crashes on cygwin while loading modules | |
242 | AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++]) | |
243 | AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++]) | |
a1e8b086 | 244 | fi |
759d11fc | 245 | else |
29dab181 | 246 | if test "x$OPTIMIZE" = "xyes"; then |
247 | appendCXX -O2 | |
0734c6ac N |
248 | |
249 | # In old times needed to define _FORTIFY_SOURCE to 2 ourself. | |
250 | # Then GCC started to define it itself to 2. It was ok. | |
251 | # 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. | |
252 | AC_MSG_CHECKING([whether compiler predefines _FORTIFY_SOURCE]) | |
253 | AC_COMPILE_IFELSE([ | |
254 | AC_LANG_PROGRAM([[ | |
255 | ]], [[ | |
256 | #ifndef _FORTIFY_SOURCE | |
257 | #error "Just checking, nothing fatal here" | |
258 | #endif | |
259 | ]]) | |
260 | ], [ | |
261 | AC_MSG_RESULT([yes]) | |
262 | ], [ | |
263 | AC_MSG_RESULT([no]) | |
264 | appendCXX "-D_FORTIFY_SOURCE=2" | |
265 | ]) | |
29dab181 | 266 | fi |
759d11fc | 267 | fi |
268 | ||
269 | if test "$IPV6" != "no"; then | |
40a1bbac | 270 | AC_DEFINE([HAVE_IPV6], [1], [Define if IPv6 support is enabled]) |
759d11fc | 271 | fi |
d9591e95 | 272 | |
9f665430 | 273 | if test "x$GXX" = "xyes"; then |
7e34dd3b | 274 | appendCXX -Wall -W -Wno-unused-parameter -Woverloaded-virtual -Wshadow |
9f665430 | 275 | fi |
276 | ||
0f9f2468 | 277 | if test "$POLL" = "yes"; then |
72c1fa0c US |
278 | # poll() is broken on Mac OS, it fails with POLLNVAL for pipe()s. |
279 | if test -n "$ISDARWIN" | |
280 | then | |
281 | # Did they give us --enable-poll? | |
282 | if test -n "$enable_poll" | |
283 | then | |
284 | # Yes, they asked for this. | |
285 | AC_MSG_WARN([poll() is known to be broken on Mac OS X. You have been warned.]) | |
286 | else | |
287 | # No, our default value of "yes" got applied. | |
288 | AC_MSG_WARN([poll() is known to be broken on Mac OS X. Using select() instead.]) | |
289 | AC_MSG_WARN([Use --enable-poll for forcing poll() to be used.]) | |
290 | POLL=no | |
291 | fi | |
292 | fi | |
293 | if test "$POLL" = "yes"; then | |
294 | AC_DEFINE([CSOCK_USE_POLL], [1], [Use poll() instead of select()]) | |
295 | fi | |
0f9f2468 | 296 | fi |
297 | ||
7de2b935 | 298 | AC_CHECK_LIB( gnugetopt, getopt_long,) |
f3762e8b | 299 | AC_CHECK_FUNCS([lstat getopt_long getpassphrase clock_gettime tcsetattr]) |
6d957ed9 | 300 | |
e2c694c9 | 301 | # ----- Check for dlopen |
302 | ||
85a27066 | 303 | AC_SEARCH_LIBS([dlopen], [dl], [], |
304 | [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.])]) | |
e2c694c9 | 305 | |
717d0596 | 306 | # ----- Check for pthreads |
e2c694c9 | 307 | |
582cd635 AS |
308 | AX_PTHREAD([ |
309 | AC_DEFINE([HAVE_PTHREAD], [1], [Define if you have POSIX threads libraries and header files.]) | |
310 | appendCXX "$PTHREAD_CFLAGS" | |
311 | appendLib "$PTHREAD_LIBS" | |
312 | ], [ | |
313 | AC_MSG_ERROR([This compiler/OS doesn't seem to support pthreads.]) | |
314 | ]) | |
315 | ||
316 | # Note that old broken systems, such as OpenBSD, NetBSD, which don't support AI_ADDRCONFIG, also have thread-unsafe getaddrinfo(). | |
317 | # Gladly, they fixed thread-safety before support of AI_ADDRCONFIG, so this can be abused to detect the thread-safe getaddrinfo(). | |
318 | # | |
319 | # TODO: drop support of blocking DNS at some point. OpenBSD supports AI_ADDRCONFIG since Nov 2014, and their getaddrinfo() is thread-safe since Nov 2013. NetBSD's one is thread-safe since ages ago. | |
1d3ea7c6 | 320 | DNS_TEXT=blocking |
717d0596 AS |
321 | if test "x$TDNS" != "xno"; then |
322 | old_TDNS=$TDNS | |
582cd635 AS |
323 | AC_MSG_CHECKING([whether getaddrinfo() supports AI_ADDRCONFIG]) |
324 | AC_COMPILE_IFELSE([ | |
325 | AC_LANG_PROGRAM([[ | |
326 | #include <sys/types.h> | |
327 | #include <sys/socket.h> | |
328 | #include <netdb.h> | |
329 | ]], [[ | |
330 | int x = AI_ADDRCONFIG; | |
331 | (void) x; | |
332 | ]]) | |
333 | ], [ | |
334 | AC_MSG_RESULT([yes]) | |
335 | TDNS=yes | |
1d3ea7c6 | 336 | ], [ |
582cd635 | 337 | AC_MSG_RESULT([no]) |
1d3ea7c6 AS |
338 | TDNS=no |
339 | ]) | |
340 | if test "x$TDNS" = "xyes"; then | |
717d0596 AS |
341 | DNS_TEXT=threads |
342 | AC_DEFINE([HAVE_THREADED_DNS], [1], [Define if threaded DNS is enabled]) | |
1d3ea7c6 | 343 | else |
717d0596 | 344 | ZNC_AUTO_FAIL([TDNS], |
1d3ea7c6 AS |
345 | [support for threaded DNS not found. Try --disable-tdns. |
346 | Disabling it may result in a slight performance decrease but will not have any other side-effects], | |
347 | [support for threaded DNS not found, so DNS resolving will be blocking]) | |
348 | fi | |
f77e5266 | 349 | fi |
350 | ||
e2c694c9 | 351 | # ----- Check for openssl |
352 | ||
4676fa0a | 353 | SSL_TEXT="$SSL" |
f0232425 | 354 | if test "x$SSL" != "xno"; then |
521695fb | 355 | old_SSL=$SSL |
68c5ee59 | 356 | PKG_CHECK_MODULES([openssl], [openssl], [ |
357 | appendLib "$openssl_LIBS" | |
358 | appendCXX "$openssl_CFLAGS" | |
359 | ], [ | |
68c5ee59 | 360 | # Don't reorder this! |
361 | # On some arches libssl depends on libcrypto without linking to it :( | |
4676fa0a US |
362 | AC_CHECK_LIB( crypto, BIO_new,, SSL=no ; SSL_TEXT="no (libcrypt not found)" ) |
363 | AC_CHECK_LIB( ssl, SSL_shutdown,, SSL=no ; SSL_TEXT="no (libssl not found)" ) | |
68c5ee59 | 364 | ]) |
521695fb | 365 | |
f94cb24f AS |
366 | if test "x$SSL" != "xno"; then |
367 | AC_MSG_CHECKING([whether openssl is usable]) | |
368 | AC_LINK_IFELSE([ | |
369 | AC_LANG_PROGRAM([[ | |
370 | #include <openssl/ssl.h> | |
dddcef52 | 371 | #include <openssl/dh.h> |
f94cb24f | 372 | ]], [[ |
f6eb4367 | 373 | SSL_CTX* ctx = SSL_CTX_new(SSLv23_method()); |
f94cb24f AS |
374 | SSL* ssl = SSL_new(ctx); |
375 | DH* dh = DH_new(); | |
afb48300 US |
376 | DH_free(dh); |
377 | SSL_free(ssl); | |
378 | SSL_CTX_free(ctx); | |
f94cb24f AS |
379 | ]]) |
380 | ], [ | |
381 | AC_MSG_RESULT([yes]) | |
382 | ], [ | |
383 | AC_MSG_RESULT([no]) | |
384 | SSL=no | |
4676fa0a | 385 | SSL_TEXT="no (openssl not usable)" |
f94cb24f | 386 | ]) |
53e5e99d | 387 | |
f94cb24f AS |
388 | fi |
389 | ||
521695fb | 390 | if test "x$SSL" = "xno" ; then |
391 | ZNC_AUTO_FAIL([SSL], | |
16464664 | 392 | [OpenSSL not found. Try --disable-openssl.], |
393 | [OpenSSL was not found and thus disabled]) | |
521695fb | 394 | NOSSL=1 |
395 | else | |
40a1bbac | 396 | AC_DEFINE([HAVE_LIBSSL], [1], [Define if openssl is enabled]) |
16464664 | 397 | SSL=yes |
4676fa0a | 398 | SSL_TEXT=yes |
521695fb | 399 | fi |
f0232425 | 400 | else |
401 | NOSSL=1 | |
4676fa0a | 402 | SSL_TEXT="no (explicitly disabled)" |
d9591e95 | 403 | fi |
404 | ||
ea947956 IR |
405 | # ----- Check for zlib |
406 | ||
407 | old_ZLIB="$ZLIB" | |
4676fa0a | 408 | ZLIB_TEXT="$ZLIB" |
ea947956 IR |
409 | if test "x$ZLIB" != "xno"; then |
410 | AC_MSG_CHECKING([whether zlib is usable]) | |
411 | my_saved_LIBS="$LIBS" | |
412 | appendLib "-lz" | |
413 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
414 | #include "zlib.h" | |
415 | ]], [[ | |
416 | z_stream zs; | |
417 | (void) deflateInit2(&zs, 0, 0, 0, 0, 0); | |
418 | (void) deflate(&zs, 0); | |
419 | ]]) | |
420 | ], [ | |
421 | AC_MSG_RESULT([yes]) | |
422 | ZLIB=yes | |
4676fa0a | 423 | ZLIB_TEXT=yes |
ea947956 IR |
424 | ], [ |
425 | AC_MSG_RESULT([no]) | |
426 | ZLIB=no | |
4676fa0a | 427 | ZLIB_TEXT="no (libz not found)" |
ea947956 IR |
428 | ]) |
429 | if test "x$ZLIB" = "xno"; then | |
430 | ZNC_AUTO_FAIL([ZLIB], | |
431 | [zlib was not found. Try --disable-zlib], | |
432 | [zlib was not found and thus disabled]) | |
433 | LIBS="$my_saved_LIBS" | |
434 | else | |
435 | AC_DEFINE([HAVE_ZLIB], [1], [Define if zlib is available]) | |
436 | fi | |
437 | fi | |
438 | ||
1c07c384 N |
439 | AC_ARG_ENABLE( [charset], |
440 | AS_HELP_STRING([--disable-charset], [disable ICU support]), | |
441 | [HAVE_ICU="$enableval"], | |
442 | [HAVE_ICU="auto"]) | |
443 | if test "x$HAVE_ICU" != "xno" | |
444 | then | |
445 | old_HAVE_ICU="$HAVE_ICU" | |
446 | PKG_CHECK_MODULES([icu], [icu-uc], [ | |
447 | appendLib "$icu_LIBS" | |
448 | appendCXX "$icu_CFLAGS" | |
449 | HAVE_ICU=yes | |
450 | AC_DEFINE([HAVE_ICU], [1], [Enable ICU library for Unicode handling]) | |
451 | AC_DEFINE([U_USING_ICU_NAMESPACE], [0], [Do not clutter global namespace with ICU C++ stuff]) | |
452 | ], [ | |
453 | ZNC_AUTO_FAIL([HAVE_ICU], | |
454 | [support for charset conversion not found. Try --disable-charset.], | |
455 | [support for charset conversion not found and thus disabled]) | |
456 | HAVE_ICU="no (icu-uc not found via pkg-config)" | |
457 | ]) | |
458 | fi | |
459 | ||
90ae7853 AS |
460 | # For integration test only |
461 | PKG_CHECK_MODULES([qt], [Qt5Network >= 5.4], [], [:]) | |
462 | ||
759d11fc | 463 | AC_ARG_WITH( [module-prefix], |
65394f61 | 464 | AS_HELP_STRING([--with-module-prefix], [module object code [LIBDIR/znc]]), |
759d11fc | 465 | [MODDIR=$withval], |
608fbdbd | 466 | [MODDIR="${libdir}/znc"] ) |
467 | ||
468 | AC_ARG_WITH( [module-data-prefix], | |
9c4a5a1d | 469 | AS_HELP_STRING([--with-module-data-prefix=DIR], |
65394f61 | 470 | [static module data (webadmin skins) [DATADIR/znc]]), |
608fbdbd | 471 | [DATADIR=$withval], |
472 | [DATADIR="${datadir}/znc"] ) | |
473 | ||
57cfa950 | 474 | appendMod "$CXXFLAGS" |
ea589120 | 475 | appendMod "$CFLAG_VISIBILITY" |
6d957ed9 | 476 | |
37b70a29 | 477 | if test -z "$ISSUN" -a -z "$ISDARWIN" -a -z "$ISCYGWIN"; then |
57cfa950 | 478 | # This is an unknown compiler flag on some OS |
479 | appendLD -Wl,--export-dynamic | |
480 | fi | |
90cf81e6 | 481 | |
57cfa950 | 482 | if test -z "$ISCYGWIN" ; then |
483 | # cygwin doesn't need -fPIC, everything else does (for modules) | |
484 | # warning: -fPIC ignored for target (all code is position independent) | |
485 | appendMod -fPIC | |
486 | else | |
d252a2b4 | 487 | # But cygwin does want most of ZNC in a shared lib |
2dbd8378 | 488 | # See https://cygwin.com/ml/cygwin-apps/2015-07/msg00108.html for the reasoning behind the name. |
c336ef5e | 489 | LIBZNC="cygznc-${LIBZNC_VERSION}.dll" |
37b70a29 | 490 | LIBZNCDIR="$bindir" |
90ae7853 AS |
491 | # See above about __STRICT_ANSI__ |
492 | qt_CFLAGS="$qt_CFLAGS -U__STRICT_ANSI__" | |
57cfa950 | 493 | fi |
2814df8f | 494 | |
57cfa950 | 495 | if test -z "$ISDARWIN"; then |
496 | MODLINK="-shared" | |
497 | else | |
498 | # Mac OS X differentiates between shared libs (-dynamiclib) | |
499 | # and loadable modules (-bundle). | |
500 | MODLINK="-bundle -flat_namespace -undefined suppress" | |
501 | # TODO test if -twolevel_namespace and/or | |
502 | # -undefined dynamic_lookup work | |
503 | # (dynamic_lookup might only work on 10.4 and later) | |
504 | fi | |
34337d7b | 505 | |
a564e25c | 506 | if test "x$PERL" != xno -o "x$PYTHON" != xno; then |
7d912d1d AS |
507 | old_USESWIG="$USESWIG" |
508 | if test "x$USESWIG" != "xno"; then | |
1f89b67a | 509 | AC_PROG_SWIG([3.0.0]) |
7d912d1d | 510 | test -z "$SWIG" && USESWIG=no |
3d152b16 | 511 | if test "x$USESWIG" = xno -a "x$old_USESWIG" = yes; then |
16f510f8 | 512 | AC_MSG_ERROR([Could not found appropriate SWIG installation. Check config.log for details.]) |
3d152b16 | 513 | fi |
a564e25c | 514 | fi |
561a1805 | 515 | if test -r "$srcdir/modules/modperl/generated.tar.gz" -a -r "$srcdir/modules/modpython/generated.tar.gz"; then |
b1b92468 AS |
516 | AC_MSG_NOTICE([modperl/modpython files are found, disabling SWIG]) |
517 | USESWIG=no | |
518 | fi | |
7d912d1d | 519 | if test "x$USESWIG" = xno; then |
561a1805 | 520 | if test ! -r "$srcdir/modules/modperl/generated.tar.gz" -o ! -r "$srcdir/modules/modpython/generated.tar.gz"; then |
cc52a7d2 | 521 | 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.]) |
a564e25c | 522 | else |
cc52a7d2 | 523 | AC_MSG_NOTICE([modperl/modpython files are found, no SWIG needed]) |
a564e25c | 524 | fi |
44d8aaa1 | 525 | USESWIG="not needed" |
3d152b16 | 526 | SWIG="" |
a564e25c | 527 | else |
7d912d1d | 528 | USESWIG=yes |
a564e25c | 529 | fi |
530 | else | |
7d912d1d | 531 | if test "x$USESWIG" = "xyes"; then |
3d152b16 | 532 | AC_MSG_WARN([swig is used only for perl and python, but both are disabled. Disabling swig.]) |
a564e25c | 533 | fi |
54f558a4 | 534 | USESWIG='not needed' |
a564e25c | 535 | fi |
536 | ||
4676fa0a | 537 | PERL_TEXT="$PERL" |
57cfa950 | 538 | if test "x$PERL" != "xno"; then |
539 | old_PERL="$PERL" | |
540 | AC_PATH_PROG([PERL_BINARY], [perl], []) | |
0bc606a9 | 541 | if test -n "$PERL_BINARY" && eval "$PERL_BINARY -e'use 5.010'"; then |
57cfa950 | 542 | my_saved_LDFLAGS="$LDFLAGS" |
543 | appendLD `$PERL_BINARY -MExtUtils::Embed -e ccopts -e ldopts` | |
5f1a1d01 | 544 | AC_CHECK_LIB(perl, perl_alloc, |
545 | [: No, we do not want autoconf to do sth automatically], | |
4676fa0a | 546 | PERL="no" ; PERL_TEXT="no (libperl not found)") |
57cfa950 | 547 | LDFLAGS="$my_saved_LDFLAGS" |
90cf81e6 | 548 | else |
57cfa950 | 549 | PERL="no" |
4676fa0a | 550 | PERL_TEXT="no (perl binary not found or too old)" |
6d957ed9 | 551 | fi |
57cfa950 | 552 | if test "x$PERL" = "xno"; then |
553 | ZNC_AUTO_FAIL([PERL], | |
554 | [perl not found. Try --disable-perl.], | |
555 | [perl was not found and thus disabled]) | |
39a215f3 | 556 | PERL_BINARY="" |
57cfa950 | 557 | else |
a564e25c | 558 | PERL="yes" |
4676fa0a | 559 | PERL_TEXT="yes" |
a564e25c | 560 | fi |
561 | fi | |
562 | ||
4676fa0a | 563 | PYTHON_TEXT="$PYTHON" |
a564e25c | 564 | if test "x$PYTHON" != "xno"; then |
565 | # Default value for just --enable-python | |
566 | if test "x$PYTHON" = "xyes"; then | |
ba915eb9 | 567 | PYTHON="python3" |
a564e25c | 568 | fi |
569 | old_PYTHON="$PYTHON" | |
ba915eb9 AS |
570 | if test -z "$PKG_CONFIG"; then |
571 | AC_MSG_ERROR([pkg-config is required for modpython.]) | |
572 | fi | |
573 | PKG_CHECK_MODULES([python], [$PYTHON >= 3.0],, AC_MSG_ERROR([$PYTHON.pc not found or is wrong. Try --disable-python or install python3.])) | |
574 | my_saved_LIBS="$LIBS" | |
63250c2b | 575 | my_saved_CXXFLAGS="$CXXFLAGS" |
ba915eb9 AS |
576 | appendLib $python_LIBS |
577 | appendCXX $python_CFLAGS | |
4676fa0a | 578 | AC_CHECK_FUNC([Py_Initialize], [], [PYTHON="no" ; PYTHON_TEXT="no (libpython not found)"]) |
ba915eb9 AS |
579 | if test "x$PYTHON" != "xno"; then |
580 | # Yes, modpython depends on perl. | |
581 | AC_PATH_PROG([PERL_BINARY], [perl]) | |
582 | if test -z "$PERL_BINARY"; then | |
583 | AC_MSG_ERROR([To compile modpython you need to be able to execute perl scripts. Try --disable-python or install perl.]) | |
a44e6eaa | 584 | fi |
e17348ca | 585 | LIBS="$my_saved_LIBS" |
ba915eb9 | 586 | CXXFLAGS="$my_saved_CXXFLAGS" |
a564e25c | 587 | fi |
4fe4a45d AS |
588 | if test "x$HAVE_ICU" != "xyes"; then |
589 | AC_MSG_ERROR([Modpython requires ZNC to be compiled with charset support, but ICU library not found. Try --disable-python or install libicu.]) | |
590 | fi | |
a564e25c | 591 | if test "x$PYTHON" = "xno"; then |
592 | ZNC_AUTO_FAIL([PYTHON], | |
593 | [python not found. Try --disable-python.], | |
594 | [python was not found and thus disabled]) | |
595 | PYTHONCFG_BINARY="" | |
596 | else | |
597 | PYTHON="yes" | |
4676fa0a | 598 | PYTHON_TEXT="yes" |
6d957ed9 | 599 | fi |
57cfa950 | 600 | fi |
b0f94ba4 | 601 | |
63ab3c09 | 602 | if test -n "$CYRUS"; then |
57cfa950 | 603 | AC_CHECK_LIB( sasl2, sasl_server_init, |
604 | [: Dont let autoconf add -lsasl2, Makefile handles that], | |
63ab3c09 | 605 | AC_MSG_ERROR([could not find libsasl2. Try --disable-cyrus.])) |
57cfa950 | 606 | fi |
61449c6f | 607 | |
57cfa950 | 608 | # Check if we want modtcl |
609 | AC_ARG_ENABLE( [tcl], | |
610 | AS_HELP_STRING([--enable-tcl], [enable modtcl]), | |
611 | [TCL="$enableval"], | |
612 | [TCL="no"]) | |
613 | ||
614 | AC_ARG_WITH( [tcl-flags], | |
615 | AS_HELP_STRING([--with-tcl-flags=FLAGS], | |
616 | [The flags needed for compiling and linking modtcl]), | |
617 | [TCL_FLAGS="$withval"],) | |
618 | ||
619 | if test x"$TCL" = "xyes" | |
620 | then | |
621 | AC_ARG_WITH( [tcl], | |
622 | AS_HELP_STRING([--with-tcl=DIR], | |
623 | [directory containing tclConfig.sh]), | |
624 | TCL_DIR="${withval}") | |
625 | ||
626 | # This will need to be extended in the future, but I don't think | |
627 | # it's a good idea to stuff a shitload of random stuff in here right now | |
398e9dec | 628 | for path in $TCL_DIR /usr/lib /usr/lib/tcl8.4 /usr/lib/tcl8.5 /usr/lib/tcl8.6 |
57cfa950 | 629 | do |
630 | file="${path}/tclConfig.sh" | |
d9b4ba18 | 631 | AC_MSG_CHECKING([for ${file}]) |
632 | if test -r ${file} | |
633 | then | |
634 | TCL_CONF=${file} | |
635 | AC_MSG_RESULT([yes]) | |
636 | break | |
637 | fi | |
638 | AC_MSG_RESULT([no]) | |
57cfa950 | 639 | done |
640 | ||
641 | if test x"${TCL_CONF}" = x | |
61449c6f | 642 | then |
57cfa950 | 643 | # They --enable-tcl'd, so give them some sane default |
644 | TCL_FLAGS="-I/usr/include/tcl -ltcl" | |
645 | AC_MSG_WARN([Could not find tclConfig.sh, using some sane defaults.]) | |
646 | else | |
647 | AC_MSG_CHECKING([modtcl flags]) | |
648 | . ${TCL_CONF} | |
649 | # eval because those vars depend on other vars in there | |
650 | eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" | |
651 | eval "TCL_INCLUDE_SPEC=\"${TCL_INCLUDE_SPEC}\"" | |
652 | TCL_FLAGS="$TCL_INCLUDE_SPEC $TCL_LIB_SPEC" | |
653 | AC_MSG_RESULT([$TCL_FLAGS]) | |
61449c6f | 654 | fi |
e17348ca | 655 | my_saved_LIBS="$LIBS" |
656 | appendLib "$TCL_FLAGS" | |
89bd5275 | 657 | AC_CHECK_FUNC([Tcl_CreateInterp], [TCL_TEST=yes], [TCL_TEST=no]) |
658 | if test x"$TCL_TEST" = "xno"; then | |
7b9d7094 | 659 | 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]) |
89bd5275 | 660 | fi |
e17348ca | 661 | LIBS="$my_saved_LIBS" |
d9591e95 | 662 | fi |
663 | ||
797b0a7f AS |
664 | AC_CACHE_CHECK([for GNU make], [ac_cv_path_GNUMAKE], [ |
665 | AC_PATH_PROGS_FEATURE_CHECK([GNUMAKE], [make gmake], [[ | |
666 | if $ac_path_GNUMAKE --version | $GREP GNU > /dev/null; then | |
667 | ac_cv_path_GNUMAKE=$ac_path_GNUMAKE | |
668 | ac_path_GNUMAKE_found=: | |
669 | fi | |
670 | ]], [AC_MSG_ERROR([could not find GNU make])] | |
671 | ) | |
672 | ]) | |
a08d737c | 673 | GNUMAKE=`echo $ac_cv_path_GNUMAKE | $SED "s%.*/%%"` |
797b0a7f | 674 | |
1c06af3b AS |
675 | # this is in the end, for not trying to include it when it doesn't exist yet |
676 | appendCXX "-include znc/zncconfig.h" | |
a83c8239 | 677 | appendMod "-include znc/zncconfig.h" |
1c06af3b | 678 | |
d9591e95 | 679 | AC_SUBST([CXXFLAGS]) |
9c4a5a1d | 680 | AC_SUBST([CPPFLAGS]) |
49fb58f7 | 681 | AC_SUBST([MODFLAGS]) |
0a622749 | 682 | AC_SUBST([LDFLAGS]) |
d9591e95 | 683 | AC_SUBST([LIBS]) |
432a04e5 | 684 | AC_SUBST([LIBZNC]) |
685 | AC_SUBST([LIBZNCDIR]) | |
f94cb24f | 686 | AC_SUBST([ISCYGWIN]) |
90cf81e6 | 687 | AC_SUBST([MODLINK]) |
3e868c5c | 688 | AC_SUBST([NOSSL]) |
61449c6f | 689 | AC_SUBST([TCL_FLAGS]) |
63ab3c09 | 690 | AC_SUBST([CYRUS]) |
44c5f493 | 691 | AC_SUBST([MODDIR]) |
608fbdbd | 692 | AC_SUBST([DATADIR]) |
c7c0d171 | 693 | AC_SUBST([PERL]) |
ba915eb9 | 694 | AC_SUBST([PYTHON]) |
7d912d1d | 695 | AC_SUBST([SWIG]) |
ba915eb9 AS |
696 | AC_SUBST([python_CFLAGS]) |
697 | AC_SUBST([python_LIBS]) | |
90ae7853 AS |
698 | AC_SUBST([qt_CFLAGS]) |
699 | AC_SUBST([qt_LIBS]) | |
d9591e95 | 700 | AC_CONFIG_FILES([Makefile]) |
97a85e39 | 701 | AC_CONFIG_FILES([znc-buildmod]) |
f59b7122 | 702 | AC_CONFIG_FILES([man/Makefile]) |
bbb62bed | 703 | AC_CONFIG_FILES([znc.pc]) |
704 | AC_CONFIG_FILES([znc-uninstalled.pc]) | |
f72e2f8a | 705 | AC_CONFIG_FILES([modules/Makefile]) |
d9591e95 | 706 | AC_OUTPUT |
c3872985 | 707 | |
700c8996 AS |
708 | if test "x$ISCYGWIN" = x1; then |
709 | # Side effect of undefining __STRICT_ANSI__ | |
710 | # http://llvm.org/bugs/show_bug.cgi?id=13530 | |
711 | echo >> include/znc/zncconfig.h | |
712 | echo '#ifndef ZNCCONFIG_H_ADDITIONS' >> include/znc/zncconfig.h | |
713 | echo '#define ZNCCONFIG_H_ADDITIONS' >> include/znc/zncconfig.h | |
714 | echo '#ifdef __clang__' >> include/znc/zncconfig.h | |
715 | echo 'struct __float128;' >> include/znc/zncconfig.h | |
716 | echo '#endif' >> include/znc/zncconfig.h | |
717 | echo '#endif' >> include/znc/zncconfig.h | |
718 | fi | |
719 | ||
c3872985 | 720 | echo |
d252a2b4 | 721 | echo ZNC AC_PACKAGE_VERSION configured |
c3872985 | 722 | echo |
6d33c570 | 723 | echo "prefix: $prefix" |
d72fc441 | 724 | echo "debug: $DEBUG" |
725 | echo "ipv6: $IPV6" | |
4676fa0a | 726 | echo "openssl: $SSL_TEXT" |
717d0596 | 727 | echo "dns: $DNS_TEXT" |
4676fa0a US |
728 | echo "perl: $PERL_TEXT" |
729 | echo "python: $PYTHON_TEXT" | |
7d912d1d | 730 | echo "swig: $USESWIG" |
63ab3c09 KF |
731 | if test x"$CYRUS" = "x" ; then |
732 | echo "cyrus: no" | |
3f27be8b | 733 | else |
63ab3c09 | 734 | echo "cyrus: yes" |
3f27be8b | 735 | fi |
61449c6f | 736 | if test x"$TCL_FLAGS" = "x" ; then |
d72fc441 | 737 | echo "tcl: no" |
738 | else | |
739 | echo "tcl: yes" | |
740 | fi | |
cfc12271 | 741 | echo "charset: $HAVE_ICU" |
4676fa0a | 742 | echo "zlib: $ZLIB_TEXT" |
d72fc441 | 743 | echo "run from src: $RUNFROMSOURCE" |
797b0a7f AS |
744 | echo |
745 | echo "Now you can run \"$GNUMAKE\" to compile ZNC" | |
d72fc441 | 746 |