~ubuntu-branches/ubuntu/quantal/znc/quantal-backports

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2013-01-01 19:39:47 UTC
  • mfrom: (21.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130101193947-zlqyse3v2mjxnhvw
Tags: 1.0-2~ubuntu12.10.1
No-change backport to quantal (LP: #1085731)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
1
7
dnl Needed for AC_PATH_PROGS_FEATURE_CHECK which was added in 2.62
2
8
AC_PREREQ([2.62])
3
9
dnl Keep the version number in sync with main.h!
4
 
AC_INIT([znc], [0.206])
 
10
AC_INIT([znc], [1.0])
5
11
AC_CONFIG_MACRO_DIR([m4])
6
 
AC_CONFIG_SRCDIR([znc.cpp])
 
12
AC_CONFIG_SRCDIR([src/znc.cpp])
7
13
AC_LANG([C++])
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 */])
28
34
AC_PROG_SED
29
35
AC_CANONICAL_HOST
30
36
AC_SYS_LARGEFILE
31
 
gl_VISIBILITY
 
37
ZNC_VISIBILITY
 
38
AC_PATH_PROG([GIT], [git])
32
39
 
33
40
appendLib () {
34
41
        if test "$LIBS" != ""; then
83
90
        ;;
84
91
esac
85
92
 
 
93
PKG_PROG_PKG_CONFIG()
 
94
 
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]),
91
 
        [EXTRA="$enableval"],
92
 
        [EXTRA="no"])
93
98
AC_ARG_ENABLE( [debug],
94
99
        AS_HELP_STRING([--enable-debug], [enable debugging]),
95
100
        [DEBUG="$enableval"],
113
118
        [PYTHON="$enableval"],
114
119
        [PYTHON="no"])
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.
 
124
                        ]),
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]),
132
 
        [ARES="$enableval"],
133
 
        [ARES="auto"])
 
135
AC_ARG_ENABLE( [tdns],
 
136
        AS_HELP_STRING([--disable-tdns], [disable threads usage for DNS resolving]),
 
137
        [TDNS="$enableval"],
 
138
        [TDNS="auto"])
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"],
145
150
        [POLL="yes"])
146
151
 
 
152
AC_ARG_WITH([systemdsystemunitdir],
 
153
        AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
 
154
        [
 
155
                if test x"$with_systemdsystemunitdir" = xyes; then
 
156
                        with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
 
157
                fi
 
158
        ])
 
159
if test "x$with_systemdsystemunitdir" != xno; then
 
160
        AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
 
161
fi
 
162
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
 
163
 
147
164
if test "$DEBUG" != "no"; then
148
 
        appendCXX -ggdb
 
165
        appendCXX -ggdb3
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++])
 
173
        fi
154
174
else
155
175
        if test "x$OPTIMIZE" = "xyes"; then
156
176
                appendCXX -O2
188
208
 
189
209
AC_CHECK_LIB( gnugetopt, getopt_long,)
190
210
AC_CHECK_FUNCS([lstat getopt_long getphassphrase])
191
 
PKG_PROG_PKG_CONFIG()
192
211
 
193
212
# ----- Check for dlopen
194
213
 
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.])])
197
216
 
198
 
# ----- Check for c-ares
 
217
# ----- Check for pthreads
199
218
 
200
 
if test "x$ARES" != "xno"; then
201
 
        old_ARES=$ARES
202
 
        if test -z "$PKG_CONFIG"
203
 
        then
204
 
                ARES=no
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])
 
219
DNS_TEXT=blocking
 
220
if test "x$TDNS" != "xno"; then
 
221
        old_TDNS=$TDNS
 
222
        AX_PTHREAD([
 
223
                AC_MSG_CHECKING([whether getaddrinfo() supports AI_ADDRCONFIG])
 
224
                AC_COMPILE_IFELSE([
 
225
                        AC_LANG_PROGRAM([[
 
226
                                #include <sys/types.h>
 
227
                                #include <sys/socket.h>
 
228
                                #include <netdb.h>
 
229
                        ]], [[
 
230
                                int x = AI_ADDRCONFIG;
 
231
                                (void) x;
 
232
                        ]])
 
233
                ], [
 
234
                        AC_MSG_RESULT([yes])
 
235
                        TDNS=yes
 
236
                ], [
 
237
                        AC_MSG_RESULT([no])
 
238
                        TDNS=no
 
239
                        # Note that broken systems, such as OpenBSD, NetBSD, which don't support AI_ADDRCONFIG,
 
240
                        # also have thread-unsafe getaddrinfo().
 
241
                ])
 
242
        ], [
 
243
                TDNS=no
 
244
        ])
 
245
        if test "x$TDNS" = "xyes"; then
 
246
                DNS_TEXT=threads
 
247
                AC_DEFINE([HAVE_THREADED_DNS], [1], [Define if threaded DNS is enabled])
 
248
                appendCXX "$PTHREAD_CFLAGS"
 
249
                appendLib "$PTHREAD_LIBS"
209
250
        else
210
 
                PKG_CHECK_MODULES([c_ares], [libcares >= 1.5.0],, ARES=no)
211
 
 
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])
217
 
                else
218
 
                        AC_DEFINE([HAVE_C_ARES], [1], [Define if c-ares is enabled])
219
 
                        appendCXX $c_ares_CFLAGS
220
 
                        appendLib $c_ares_LIBS
221
 
                        ARES=yes
222
 
                fi
 
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])
223
255
        fi
224
256
fi
225
257
 
244
276
                AC_CHECK_LIB( ssl, SSL_shutdown,, SSL=no )
245
277
        ])
246
278
 
 
279
        if test "x$SSL" != "xno"; then
 
280
                AC_MSG_CHECKING([whether openssl is usable])
 
281
                AC_LINK_IFELSE([
 
282
                        AC_LANG_PROGRAM([[
 
283
                                #include <openssl/ssl.h>
 
284
                        ]], [[
 
285
                                SSL_CTX* ctx = SSL_CTX_new(TLSv1_method());
 
286
                                SSL* ssl = SSL_new(ctx);
 
287
                                DH* dh = DH_new();
 
288
                                DH_free(dh);
 
289
                                SSL_free(ssl);
 
290
                                SSL_CTX_free(ctx);
 
291
                        ]])
 
292
                ], [
 
293
                        AC_MSG_RESULT([yes])
 
294
                ], [
 
295
                        AC_MSG_RESULT([no])
 
296
                        SSL=no
 
297
                ])
 
298
                
 
299
        fi
 
300
 
247
301
        if test "x$SSL" = "xno" ; then
248
302
                ZNC_AUTO_FAIL([SSL],
249
303
                        [OpenSSL not found. Try --disable-openssl.],
281
335
        # warning: -fPIC ignored for target (all code is position independent)
282
336
        appendMod -fPIC
283
337
else
284
 
        # But cygwin does want most of znc in a shared lib
 
338
        # But cygwin does want most of ZNC in a shared lib
285
339
        LIBZNC="libznc.dll"
286
340
        LIBZNCDIR="$bindir"
287
341
fi
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.])
 
361
                fi
 
362
        fi
 
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])
 
365
                USESWIG=no
305
366
        fi
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.])
 
370
                else
 
371
                        AC_MSG_NOTICE([modperl/modpython files are found, no SWIG needed])
 
372
                fi
 
373
                USESWIG="not needed"
307
374
                SWIG=""
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.])
313
 
                else
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.])
316
 
                fi
317
375
        else
318
376
                USESWIG=yes
319
377
        fi
320
378
else
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.])
323
381
        fi
324
 
        USESWIG=no
 
382
        USESWIG='not needed'
325
383
fi
326
384
 
327
385
if test "x$PERL" != "xno"; then
357
415
                AC_MSG_ERROR([pkg-config is required for modpython.])
358
416
        fi
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])
367
 
                        fi
368
 
                fi
369
 
        fi
370
418
        my_saved_LIBS="$LIBS"
371
419
        my_saved_CXXFLAGS="$CXXFLAGS"
372
420
        appendLib $python_LIBS
393
441
        fi
394
442
fi
395
443
 
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.]))
400
448
fi
401
449
 
402
450
# Check if we want modtcl
455
503
        LIBS="$my_saved_LIBS"
456
504
fi
457
505
 
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"
459
509
then
460
 
        AC_CHECK_FUNC( iconv, CHARSET=1 )
461
 
        AC_CHECK_LIB( iconv, iconv_open, LIBICONV=-liconv ; CHARSET=1 )
462
 
        if test "x$CHARSET" = "x1"
463
 
        then
464
 
                AC_MSG_CHECKING([whether iconv expects a const second argument])
465
 
                AC_COMPILE_IFELSE([
466
 
                        AC_LANG_PROGRAM([[
467
 
                #include <iconv.h>
468
 
                ]], [[
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);
473
 
                ]])], [
474
 
                        AC_MSG_RESULT([no])
475
 
                        appendMod -DICONV_CONST=
476
 
                ], [
477
 
                        AC_MSG_RESULT([yes])
478
 
                        appendMod -DICONV_CONST=const
479
 
                ])
480
 
        else
481
 
                AC_MSG_WARN([libiconv was not found, disabling the charset module])
482
 
        fi
 
510
        AC_MSG_CHECKING([whether iconv expects a const second argument])
 
511
        AC_COMPILE_IFELSE([
 
512
                AC_LANG_PROGRAM([[
 
513
        #include <iconv.h>
 
514
        ]], [[
 
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);
 
519
        ]])], [
 
520
                AC_MSG_RESULT([no])
 
521
                appendMod -DICONV_CONST=
 
522
        ], [
 
523
                AC_MSG_RESULT([yes])
 
524
                appendMod -DICONV_CONST=const
 
525
        ])
 
526
else
 
527
        AC_MSG_WARN([libiconv was not found, disabling the charset module])
483
528
fi
484
529
 
485
530
AC_CACHE_CHECK([for GNU make], [ac_cv_path_GNUMAKE], [
501
546
AC_SUBST([LIBS])
502
547
AC_SUBST([LIBZNC])
503
548
AC_SUBST([LIBZNCDIR])
 
549
AC_SUBST([ISCYGWIN])
504
550
AC_SUBST([MODLINK])
505
551
AC_SUBST([NOSSL])
506
 
AC_SUBST([EXTRA])
507
552
AC_SUBST([TCL_FLAGS])
508
 
AC_SUBST([SASL])
 
553
AC_SUBST([CYRUS])
509
554
AC_SUBST([CHARSET])
510
555
AC_SUBST([LIBICONV])
511
556
AC_SUBST([MODDIR])
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])
526
570
AC_OUTPUT
527
571
 
528
572
echo
529
 
echo znc AC_PACKAGE_VERSION configured
 
573
echo ZNC AC_PACKAGE_VERSION configured
530
574
echo
531
575
echo "prefix:       $prefix"
532
576
echo "debug:        $DEBUG"
533
577
echo "ipv6:         $IPV6"
534
578
echo "openssl:      $SSL"
535
 
echo "c-ares:       $ARES"
 
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
540
 
        echo "sasl:         no"
 
583
if test x"$CYRUS" = "x" ; then
 
584
        echo "cyrus:        no"
541
585
else
542
 
        echo "sasl:         yes"
 
586
        echo "cyrus:        yes"
543
587
fi
544
 
echo "extra:        $EXTRA"
545
588
if test x"$TCL_FLAGS" = "x" ; then
546
589
        echo "tcl:          no"
547
590
else