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!
1
7
dnl Needed for AC_PATH_PROGS_FEATURE_CHECK which was added in 2.62
3
9
dnl Keep the version number in sync with main.h!
4
AC_INIT([znc], [0.206])
5
11
AC_CONFIG_MACRO_DIR([m4])
6
AC_CONFIG_SRCDIR([znc.cpp])
12
AC_CONFIG_SRCDIR([src/znc.cpp])
8
AC_CONFIG_HEADERS([zncconfig.h])
14
AC_CONFIG_HEADERS([include/znc/zncconfig.h])
9
15
AH_TOP([#ifndef ZNCCONFIG_H
10
16
#define ZNCCONFIG_H])
11
17
AH_BOTTOM([#endif /* ZNCCONFIG_H */])
86
95
AC_ARG_WITH( [openssl],
87
96
AS_HELP_STRING([--with-openssl=DIR], [openssl installation prefix]),
88
97
[OPENSSL=$withval],)
89
AC_ARG_ENABLE( [extra],
90
AS_HELP_STRING([--enable-extra], [enable some extra modules]),
93
98
AC_ARG_ENABLE( [debug],
94
99
AS_HELP_STRING([--enable-debug], [enable debugging]),
95
100
[DEBUG="$enableval"],
113
118
[PYTHON="$enableval"],
115
120
AC_ARG_ENABLE( [swig],
116
AS_HELP_STRING([--disable-swig], [Disable automatic generation of source files needed for modperl/modpython.
117
This value is ignored if perl and python are disabled. If you disable swig,
118
but still want to use these modules, please download the necessary files to modules/modperl and/or to modules/modpython.
119
Check http://en.znc.in/wiki/Modperl and http://en.znc.in/wiki/Modpython for details.]),
121
AS_HELP_STRING([--enable-swig], [Enable automatic generation of source files needed for modperl/modpython.
122
This value is ignored if perl and python are disabled.
123
Usually no need to enable it.
120
125
[USESWIG="$enableval"],
121
126
[USESWIG="auto"])
122
AC_ARG_ENABLE( [sasl],
123
AS_HELP_STRING([--enable-sasl], [enable sasl]),
124
[if test "$enableval" = "yes" ; then SASL=1; fi],)
127
AC_ARG_ENABLE( [cyrus],
128
AS_HELP_STRING([--enable-cyrus], [enable cyrus]),
129
[if test "$enableval" = "yes" ; then CYRUS=1; fi],)
125
130
AC_ARG_ENABLE( [optimization],
126
131
AS_HELP_STRING([--disable-optimization], [Disable some compiler optimizations to
127
132
decrease memory usage while compiling]),
128
133
[OPTIMIZE="$enableval"],
129
134
[OPTIMIZE="yes"])
130
AC_ARG_ENABLE( [c-ares],
131
AS_HELP_STRING([--disable-c-ares], [disable c-ares usage]),
135
AC_ARG_ENABLE( [tdns],
136
AS_HELP_STRING([--disable-tdns], [disable threads usage for DNS resolving]),
134
139
AC_ARG_ENABLE( [run-from-source],
135
AS_HELP_STRING([--enable-run-from-source], [znc will be runnable without installation]),
140
AS_HELP_STRING([--enable-run-from-source], [ZNC will be runnable without installation]),
136
141
[if test "x$enableval" = "xyes" ; then
137
142
AC_DEFINE([RUN_FROM_SOURCE], [1],
138
143
[Define if ZNC should be runnable without installation])
144
149
[POLL="$enableval"],
152
AC_ARG_WITH([systemdsystemunitdir],
153
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
155
if test x"$with_systemdsystemunitdir" = xyes; then
156
with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
159
if test "x$with_systemdsystemunitdir" != xno; then
160
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
162
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
147
164
if test "$DEBUG" != "no"; then
149
166
AC_DEFINE([_DEBUG], [1], [Define for debugging])
150
# These enable some debug options in g++'s STL, e.g. invalid use of iterators
151
AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++])
152
AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++])
153
AC_DEFINE([_GLIBCXX_CONCEPT_CHECKS], [1], [Enable extra debugging checks in libstdc++])
167
if test "x$ISCYGWIN" != x1; then
168
# These enable some debug options in g++'s STL, e.g. invalid use of iterators
169
# But they cause crashes on cygwin while loading modules
170
AC_DEFINE([_GLIBCXX_DEBUG], [1], [Enable extra debugging checks in libstdc++])
171
AC_DEFINE([_GLIBCXX_DEBUG_PEDANTIC], [1], [Enable extra debugging checks in libstdc++])
172
AC_DEFINE([_GLIBCXX_CONCEPT_CHECKS], [1], [Enable extra debugging checks in libstdc++])
155
175
if test "x$OPTIMIZE" = "xyes"; then
189
209
AC_CHECK_LIB( gnugetopt, getopt_long,)
190
210
AC_CHECK_FUNCS([lstat getopt_long getphassphrase])
191
PKG_PROG_PKG_CONFIG()
193
212
# ----- Check for dlopen
195
214
AC_SEARCH_LIBS([dlopen], [dl], [],
196
215
[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.])])
198
# ----- Check for c-ares
217
# ----- Check for pthreads
200
if test "x$ARES" != "xno"; then
202
if test -z "$PKG_CONFIG"
205
ZNC_AUTO_FAIL([ARES],
206
[pkg-config not found. Try --disable-c-ares.
207
Disabling c-ares may result in a slight performance decrease but will not have any other side-effects],
208
[pkg-config was not found and thus c-ares was disabled])
220
if test "x$TDNS" != "xno"; then
223
AC_MSG_CHECKING([whether getaddrinfo() supports AI_ADDRCONFIG])
226
#include <sys/types.h>
227
#include <sys/socket.h>
230
int x = AI_ADDRCONFIG;
239
# Note that broken systems, such as OpenBSD, NetBSD, which don't support AI_ADDRCONFIG,
240
# also have thread-unsafe getaddrinfo().
245
if test "x$TDNS" = "xyes"; then
247
AC_DEFINE([HAVE_THREADED_DNS], [1], [Define if threaded DNS is enabled])
248
appendCXX "$PTHREAD_CFLAGS"
249
appendLib "$PTHREAD_LIBS"
210
PKG_CHECK_MODULES([c_ares], [libcares >= 1.5.0],, ARES=no)
212
if test "x$ARES" = "xno" ; then
213
ZNC_AUTO_FAIL([ARES],
214
[c-ares not found. Try --disable-c-ares.
215
Disabling c-ares may result in a slight performance decrease but will not have any other side-effects],
216
[c-ares was not found and thus disabled])
218
AC_DEFINE([HAVE_C_ARES], [1], [Define if c-ares is enabled])
219
appendCXX $c_ares_CFLAGS
220
appendLib $c_ares_LIBS
251
ZNC_AUTO_FAIL([TDNS],
252
[support for threaded DNS not found. Try --disable-tdns.
253
Disabling it may result in a slight performance decrease but will not have any other side-effects],
254
[support for threaded DNS not found, so DNS resolving will be blocking])
244
276
AC_CHECK_LIB( ssl, SSL_shutdown,, SSL=no )
279
if test "x$SSL" != "xno"; then
280
AC_MSG_CHECKING([whether openssl is usable])
283
#include <openssl/ssl.h>
285
SSL_CTX* ctx = SSL_CTX_new(TLSv1_method());
286
SSL* ssl = SSL_new(ctx);
247
301
if test "x$SSL" = "xno" ; then
248
302
ZNC_AUTO_FAIL([SSL],
249
303
[OpenSSL not found. Try --disable-openssl.],
300
354
if test "x$PERL" != xno -o "x$PYTHON" != xno; then
301
355
old_USESWIG="$USESWIG"
302
356
if test "x$USESWIG" != "xno"; then
303
AC_PROG_SWIG([1.3.40])
357
AC_PROG_SWIG([2.0.4])
304
358
test -z "$SWIG" && USESWIG=no
359
if test "x$USESWIG" = xno -a "x$old_USESWIG" = yes; then
360
AC_MSG_ERROR([Could not found appropriate SWIG installation. Check config.log for details.])
363
if test -r "$srcdir/modules/modperl/ZNC.cpp" -a -r "$srcdir/modules/modpython/_znc_core.cpp"; then
364
AC_MSG_NOTICE([modperl/modpython files are found, disabling SWIG])
306
367
if test "x$USESWIG" = xno; then
368
if test ! -r "$srcdir/modules/modperl/ZNC.cpp" -o ! -r "$srcdir/modules/modpython/_znc_core.cpp"; then
369
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.])
371
AC_MSG_NOTICE([modperl/modpython files are found, no SWIG needed])
308
AC_MSG_WARN([$SWIG_ERROR])
309
if test "x$old_USESWIG" = xno; then
310
USESWIG="no, need manual download for perl/python bindings"
311
AC_MSG_WARN([swig was disabled, so you should put needed sources to modules/
312
Please check http://en.znc.in/wiki/Modperl or http://en.znc.in/wiki/Modpython for details.])
314
AC_MSG_ERROR([swig was not found. Try --disable-perl --disable-python, or download the necessary sources and use --disable-swig.
315
Please check http://en.znc.in/wiki/Modperl or http://en.znc.in/wiki/Modpython for details.])
321
379
if test "x$USESWIG" = "xyes"; then
322
AC_MSG_WARN([swig is needed only for perl and python, but both are disabled. Disabling swig.])
380
AC_MSG_WARN([swig is used only for perl and python, but both are disabled. Disabling swig.])
327
385
if test "x$PERL" != "xno"; then
357
415
AC_MSG_ERROR([pkg-config is required for modpython.])
359
417
PKG_CHECK_MODULES([python], [$PYTHON >= 3.0],, AC_MSG_ERROR([$PYTHON.pc not found or is wrong. Try --disable-python or install python3.]))
360
if test "x$USESWIG" = xyes; then :
361
PKG_CHECK_MODULES([python32], [$PYTHON >= 3.2], [PYTHON_32=yes], [PYTHON_32=no])
362
if test "x$PYTHON_32" = xyes; then
363
AC_MSG_NOTICE([python 3.2+ found, requiring newer swig.])
364
AC_PROG_SWIG([2.0.4])
365
if test -z "$SWIG"; then
366
AC_MSG_ERROR([$SWIG_ERROR])
370
418
my_saved_LIBS="$LIBS"
371
419
my_saved_CXXFLAGS="$CXXFLAGS"
372
420
appendLib $python_LIBS
396
if test -n "$SASL"; then
444
if test -n "$CYRUS"; then
397
445
AC_CHECK_LIB( sasl2, sasl_server_init,
398
446
[: Dont let autoconf add -lsasl2, Makefile handles that],
399
AC_MSG_ERROR([could not find libsasl2. Try --disable-sasl.]))
447
AC_MSG_ERROR([could not find libsasl2. Try --disable-cyrus.]))
402
450
# Check if we want modtcl
455
503
LIBS="$my_saved_LIBS"
458
if test x"$EXTRA" = "xyes"
506
AC_CHECK_FUNC( iconv, CHARSET=1 )
507
AC_CHECK_LIB( iconv, iconv_open, LIBICONV=-liconv ; CHARSET=1 )
508
if test "x$CHARSET" = "x1"
460
AC_CHECK_FUNC( iconv, CHARSET=1 )
461
AC_CHECK_LIB( iconv, iconv_open, LIBICONV=-liconv ; CHARSET=1 )
462
if test "x$CHARSET" = "x1"
464
AC_MSG_CHECKING([whether iconv expects a const second argument])
469
const char input[] = "X"; const char *inptr = input; size_t inbytes = 1;
470
char buf[1]; char *outptr = buf; size_t outbytes = 1;
471
iconv_t ic = iconv_open("ISO8859-1", "UTF8");
472
iconv(ic, (char**)&inptr, &inbytes, &outptr, &outbytes);
475
appendMod -DICONV_CONST=
478
appendMod -DICONV_CONST=const
481
AC_MSG_WARN([libiconv was not found, disabling the charset module])
510
AC_MSG_CHECKING([whether iconv expects a const second argument])
515
const char input[] = "X"; const char *inptr = input; size_t inbytes = 1;
516
char buf[1]; char *outptr = buf; size_t outbytes = 1;
517
iconv_t ic = iconv_open("ISO8859-1", "UTF8");
518
iconv(ic, (char**)&inptr, &inbytes, &outptr, &outbytes);
521
appendMod -DICONV_CONST=
524
appendMod -DICONV_CONST=const
527
AC_MSG_WARN([libiconv was not found, disabling the charset module])
485
530
AC_CACHE_CHECK([for GNU make], [ac_cv_path_GNUMAKE], [
516
561
AC_SUBST([python_CFLAGS])
517
562
AC_SUBST([python_LIBS])
518
563
AC_CONFIG_FILES([Makefile])
519
AC_CONFIG_FILES([znc-config])
520
564
AC_CONFIG_FILES([znc-buildmod])
521
565
AC_CONFIG_FILES([man/Makefile])
522
566
AC_CONFIG_FILES([znc.pc])
529
echo znc AC_PACKAGE_VERSION configured
573
echo ZNC AC_PACKAGE_VERSION configured
531
575
echo "prefix: $prefix"
532
576
echo "debug: $DEBUG"
533
577
echo "ipv6: $IPV6"
534
578
echo "openssl: $SSL"
579
echo "dns: $DNS_TEXT"
536
580
echo "perl: $PERL"
537
581
echo "python: $PYTHON"
538
582
echo "swig: $USESWIG"
539
if test x"$SASL" = "x" ; then
583
if test x"$CYRUS" = "x" ; then
545
588
if test x"$TCL_FLAGS" = "x" ; then