source: configure @ 1dcbd3e

Last change on this file since 1dcbd3e was 7ec2ce8, checked in by dequis <dx@…>, at 2018-01-10T03:05:23Z

Remove MSN. Use the skypeweb purple plugin instead.

RIP

As per http://ismsndeadyet.com/ all versions up to MSNP22 died a few
months ago. We had a MSNP21 implementation, bought us two extra years.

Implementing MSNP24 is technically possible but also pointless given
skypeweb, and the authentication requires some fairly messed up crypto
and legacy old-skype-protocol servers. For a long time I tried to
reverse a potentially simpler method, and got fairly close, but never
completed that. I haven't done any attempts to continue it in the last
year, so I'm fine with giving up at this point.

  • Property mode set to 100755
File size: 24.2 KB
Line 
1#!/bin/sh
2
3##############################
4##  Configurer for BitlBee  ##
5##                          ##
6##  Copyright 2004 Lintux   ##
7##  Copyright 2002 Lucumo   ##
8##############################
9
10prefix='/usr/local/'
11bindir='$prefix/bin/'
12sbindir='$prefix/sbin/'
13etcdir='$prefix/etc/bitlbee/'
14mandir='$prefix/share/man/'
15datadir='$prefix/share/bitlbee/'
16config='/var/lib/bitlbee/'
17libdir='$prefix/lib/'
18plugindir='$prefix/lib/bitlbee/'
19includedir='$prefix/include/bitlbee/'
20systemdsystemunitdir=''
21libevent='/usr/'
22pidfile='/var/run/bitlbee.pid'
23ipcsocket=''
24pcdir='$prefix/lib/pkgconfig'
25systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
26sysroot=''
27
28configure_args="$@"
29
30# Set these to default-on to let it be overriden by either the user or purple
31#
32# If the user sets one of these to 1, purple won't disable them.
33# Otherwise, if it's still default-on, it gets included in normal builds,
34# but not purple ones.
35jabber="default-on"
36oscar="default-on"
37
38twitter=1
39purple=0
40
41verbose=0
42doc=1
43debug=0
44strip=0
45gcov=0
46asan=0
47plugins=1
48otr=0
49skype=0
50
51events=glib
52ssl=auto
53
54pam=0
55ldap=0
56
57pie=1
58
59arch=$(uname -s)
60
61GLIB_MIN_VERSION=2.16
62
63# Cygwin and Darwin don't support PIC/PIE
64case "$arch" in
65        CYGWIN* )
66                pie=0;;
67        Darwin )
68                pie=0;;
69esac
70
71get_version() {
72        REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
73
74        if [ -n "$BITLBEE_VERSION" ]; then
75                # environment variable already set to something to spoof it
76                # don't replace it with the git stuff
77                return
78        fi
79
80        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
81
82        if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
83                timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
84                branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
85
86                search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)'
87                replace="\1+$timestamp+$branch+\2-\3-git"
88
89                describe=$(cd $srcdir; git describe --long --tags 2>/dev/null)
90                if [ $? -ne 0 ]; then
91                        describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD)
92                fi
93
94                BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#")
95
96                unset timestamp branch search replace describe
97        fi
98}
99
100if [ "$1" = "--dump-version" ]; then
101        srcdir=$(cd $(dirname $0);pwd)
102        get_version
103        echo $BITLBEE_VERSION
104        exit
105fi
106
107echo BitlBee configure
108
109while [ -n "$1" ]; do
110        e="$(expr "X$1" : 'X--\(.*=.*\)')"
111        if [ -z "$e" ]; then
112                cat<<EOF
113
114Usage: $0 [OPTIONS]
115
116Option          Description                             Default
117
118--prefix=...    Directories to put files in             $prefix
119--bindir=...                                            $bindir
120--sbindir=...                                           $sbindir
121--etcdir=...                                            $etcdir
122--mandir=...                                            $mandir
123--datadir=...                                           $datadir
124--plugindir=...                                         $plugindir
125--systemdsystemunitdir=...                              $systemdsystemunitdir
126--pidfile=...                                           $pidfile
127--config=...                                            $config
128
129--verbose=0/1   Disable/enable verbose build            $verbose
130
131--jabber=0/1    Disable/enable Jabber part              $jabber
132--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
133--twitter=0/1   Disable/enable Twitter part             $twitter
134
135--purple=0/1    Disable/enable libpurple support        $purple
136                (automatically disables other protocol modules)
137
138--pam=0/1       Disable/enable PAM authentication       $pam
139--ldap=0/1      Disable/enable LDAP authentication      $ldap
140
141--doc=0/1       Disable/enable help.txt generation      $doc
142--debug=0/1     Disable/enable debugging                $debug
143--strip=0/1     Disable/enable binary stripping         $strip
144--pie=0/1       Build position independent executable   $pie
145--gcov=0/1      Disable/enable test coverage reporting  $gcov
146--asan=0/1      Disable/enable AddressSanitizer         $asan
147--plugins=0/1   Disable/enable plugins support          $plugins
148--otr=0/1/auto/plugin
149                Disable/enable OTR encryption support   $otr
150--skype=0/1/plugin
151                Disable/enable Skype support            $skype
152
153--events=...    Event handler (glib, libevent)          $events
154--ssl=...       SSL library to use (gnutls, nss, openssl, auto)
155                                                        $ssl
156
157
158--target=...    Cross compilation target                same as host
159--sysroot=...   Cross compilation sysroot               $sysroot
160EOF
161                exit;
162        fi
163        eval "$e"
164        shift;
165done
166
167# Expand $prefix and get rid of double slashes
168bindir=$(eval echo "$bindir/" | sed 's/\/\{1,\}/\//g')
169sbindir=$(eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g')
170etcdir=$(eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g')
171mandir=$(eval echo "$mandir/" | sed 's/\/\{1,\}/\//g')
172datadir=$(eval echo "$datadir/" | sed 's/\/\{1,\}/\//g')
173config=$(eval echo "$config/" | sed 's/\/\{1,\}/\//g')
174libdir=$(eval echo "$libdir/" | sed 's/\/\{1,\}/\//g')
175plugindir=$(eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g')
176includedir=$(eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g')
177libevent=$(eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g')
178
179pidfile=$(eval echo "$pidfile" | sed 's/\/\{1,\}/\//g')
180ipcsocket=$(eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g')
181pcdir=$(eval echo "$pcdir" | sed 's/\/\{1,\}/\//g')
182
183protocols_mods=""
184
185cat <<EOF >Makefile.settings
186## BitlBee settings, generated by configure
187
188# ./configure $configure_args
189
190PREFIX=$prefix
191BINDIR=$bindir
192SBINDIR=$sbindir
193ETCDIR=$etcdir
194MANDIR=$mandir
195DATADIR=$datadir
196PLUGINDIR=$plugindir
197CONFIG=$config
198LIBDIR=$libdir
199INCLUDEDIR=$includedir
200PCDIR=$pcdir
201
202TARGET=$target
203
204INSTALL=install -p
205
206DESTDIR=
207LFLAGS=
208EFLAGS=-lm
209EOF
210
211srcdir=$(cd $(dirname $0);pwd)
212currdir=$(pwd)
213if [ "$srcdir" != "$currdir" ]; then 
214        echo
215        echo "configure script run from a different directory. Will create some symlinks..."
216        if [ ! -e Makefile -o -L Makefile ]; then
217                COPYDIRS="doc lib protocols tests utils"
218                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
219                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
220                dst="$PWD"
221                cd "$srcdir"
222                for i in $(find . -name Makefile -type f); do
223                        ln -s "$PWD${i#.}" "$dst/$i";
224                done
225                cd "$dst"
226                rm -rf .bzr
227        fi
228       
229        echo "_SRCDIR_=$srcdir/" >> Makefile.settings
230        CFLAGS="$CFLAGS -I${dst}"
231else
232        srcdir=$PWD
233fi
234
235cat<<EOF >config.h
236/* BitlBee settings, generated by configure
237   
238   Do *NOT* use any of these defines in your code without thinking twice, most
239   of them can/will be overridden at run-time */
240
241#define BITLBEE_CONFIGURE_ARGS "$configure_args"
242
243#define CONFIG "$config"
244#define ETCDIR "$etcdir"
245#define VARDIR "$datadir"
246#define PLUGINDIR "$plugindir"
247#define DATADIR "$datadir"
248#define PIDFILE "$pidfile"
249#define IPCSOCKET "$ipcsocket"
250EOF
251
252
253
254if [ -n "$target" ]; then
255        # prepend sysroot to system lib dirs
256
257        systemlibdirs_cross=''
258        for i in $systemlibdirs; do
259                systemlibdirs_cross="$systemlibdirs_cross $sysroot$i"
260        done
261        systemlibdirs=$systemlibdirs_cross
262        unset systemlibdirs_cross
263
264        # backward compatibility
265
266        if [ -z "$PKG_CONFIG_LIBDIR" ]; then
267                PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
268                export PKG_CONFIG_LIBDIR
269        fi
270
271        if [ -d /usr/$target/bin ]; then
272                PATH=/usr/$target/bin:$PATH
273        fi
274
275        if [ -d /usr/$target/lib ]; then
276                systemlibdirs="$systemlibdirs /usr/$target/lib"
277        fi
278
279        CC=$target-cc
280        LD=$target-ld
281        STRIP=$target-strip
282fi
283
284if [ "$asan" = "1" ]; then
285        CFLAGS="$CFLAGS -fsanitize=address"
286        LDFLAGS="$LDFLAGS -fsanitize=address"
287        debug=1
288fi
289
290if [ "$verbose" = "0" ]; then
291        echo 'VERBOSE=@' >> Makefile.settings
292else
293        echo 'VERBOSE=' >> Makefile.settings
294fi
295
296cat <<EOF >>Makefile.settings
297
298# Enable/disable output verbosity
299ifdef V
300ifeq (\$(V),1)
301        VERBOSE=
302else
303        VERBOSE=@
304endif
305endif
306
307EOF
308
309if [ "$debug" = "1" ]; then
310        echo 'DEBUG=1' >> Makefile.settings
311        CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
312else
313        [ -z "$CFLAGS" ] && CFLAGS="-g -O2 -fno-strict-aliasing"
314fi
315
316if [ "$pie" = "1" ]; then
317        echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings
318        echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings
319fi
320
321echo LDFLAGS=$LDFLAGS >> Makefile.settings
322
323echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
324echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
325
326echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
327
328if [ -n "$CC" ]; then
329        CC=$CC
330elif type gcc > /dev/null 2> /dev/null; then
331        CC=gcc
332elif type cc > /dev/null 2> /dev/null; then
333        CC=cc
334else
335        echo 'Cannot find a C compiler, aborting.'
336        exit 1;
337fi
338
339echo "CC=$CC" >> Makefile.settings;
340if echo $CC | grep -qw gcc; then
341        # Apparently -Wall is gcc-specific?
342        echo CFLAGS+=-Wall >> Makefile.settings
343fi
344
345if [ -z "$LD" ]; then
346        if type ld > /dev/null 2> /dev/null; then
347                LD=ld
348        else
349                echo 'Cannot find ld, aborting.'
350                exit 1;
351        fi
352fi
353
354echo "LD=$LD" >> Makefile.settings
355
356if [ -z "$PKG_CONFIG" ]; then
357        PKG_CONFIG=pkg-config
358fi
359
360if ! $PKG_CONFIG --version > /dev/null 2>/dev/null; then
361        echo
362        echo 'Cannot find pkg-config, aborting.'
363        exit 1
364fi
365
366if $PKG_CONFIG glib-2.0; then
367        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
368                cat<<EOF >>Makefile.settings
369EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0)
370CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0)
371EOF
372        else
373                echo
374                echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
375                exit 1
376        fi
377else
378        echo
379        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
380        exit 1
381fi
382
383if [ "$events" = "libevent" ]; then
384        if ! [ -f "${libevent}include/event.h" ]; then
385                echo
386                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
387                echo 'its location using the --libevent= argument. (Example: If event.h is in'
388                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
389        fi
390       
391        echo '#define EVENTS_LIBEVENT' >> config.h
392        cat <<EOF >>Makefile.settings
393EFLAGS+=-levent -L${libevent}lib
394CFLAGS+=-I${libevent}include
395EOF
396elif [ "$events" = "glib" ]; then
397        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
398        echo '#define EVENTS_GLIB' >> config.h
399else
400        echo
401        echo 'ERROR: Unknown event handler specified.'
402        exit 1
403fi
404echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
405
406detect_gnutls()
407{
408        if $PKG_CONFIG --exists gnutls; then
409                cat <<EOF >>Makefile.settings
410EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs)
411CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags)
412EOF
413                ssl=gnutls
414                if ! $PKG_CONFIG gnutls --atleast-version=2.8; then
415                        echo
416                        echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
417                fi
418                ret=1
419        elif libgnutls-config --version > /dev/null 2> /dev/null; then
420                cat <<EOF >>Makefile.settings
421EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs)
422CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags)
423EOF
424               
425                ssl=gnutls
426                ret=1;
427        else
428                ret=0;
429        fi;
430}
431
432detect_nss()
433{
434        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
435                cat<<EOF >>Makefile.settings
436EFLAGS+=$($PKG_CONFIG --libs nss)
437CFLAGS+=$($PKG_CONFIG --cflags nss)
438EOF
439               
440                ssl=nss
441                ret=1;
442        else
443                ret=0;
444        fi;
445}
446
447RESOLV_TESTCODE='
448#include <sys/types.h>
449#include <netinet/in.h>
450#include <arpa/nameser.h>
451#include <resolv.h>
452
453int main()
454{
455
456        res_query( NULL, 0, 0, NULL, 0);
457        dn_expand( NULL, NULL, NULL, NULL, 0);
458        dn_skipname( NULL, NULL);
459}
460'
461RESOLV_NS_TESTCODE='
462#include <sys/types.h>
463#include <netinet/in.h>
464#include <arpa/nameser.h>
465#include <resolv.h>
466
467int main()
468{
469        ns_initparse( NULL, 0, NULL );
470        ns_parserr( NULL, ns_s_an, 0, NULL );
471}
472'
473RESOLV_NS_TYPES_TESTCODE='
474#include <sys/types.h>
475#include <netinet/in.h>
476#include <arpa/nameser.h>
477
478int main()
479{
480        ns_msg nsh;
481        ns_rr rr;
482
483        /* Not all platforms we want to work on have
484         ns_* routines, so use this to make sure
485         the compiler uses it.*/
486        return (int)(sizeof(nsh) + sizeof(rr));
487}
488'
489
490detect_resolv_dynamic()
491{
492        case "$arch" in
493        OpenBSD )
494                # In FreeBSD res_*/dn_* routines are present in libc.so
495                LIBRESOLV=;;
496        FreeBSD )
497                # In FreeBSD res_*/dn_* routines are present in libc.so
498                LIBRESOLV=;;
499        CYGWIN* )
500                # In Cygwin res_*/dn_* routines are present in libc.so
501                LIBRESOLV=;;
502        * )
503                LIBRESOLV=-lresolv;;
504        esac
505        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
506        ret=1
507        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
508        if [ "$?" = "0" ]; then
509                echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
510                ret=0
511        fi
512
513        rm -f $TMPFILE
514        return $ret
515}
516
517detect_resolv_static()
518{
519        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
520        ret=1
521        for i in $systemlibdirs; do
522                if [ -f $i/libresolv.a ]; then
523                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
524                        if [ "$?" = "0" ]; then
525                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
526                                ret=0
527                        fi
528                fi
529        done
530
531        rm -f $TMPFILE
532        return $ret
533}
534
535detect_resolv_ns_dynamic()
536{
537        case "$arch" in
538        FreeBSD )
539                # In FreeBSD ns_ routines are present in libc.so
540                LIBRESOLV=;;
541        * )
542                LIBRESOLV=-lresolv;;
543        esac
544        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
545        ret=1
546        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
547        if [ "$?" = "0" ]; then
548                ret=0
549        fi
550
551        rm -f $TMPFILE
552        return $ret
553}
554
555detect_resolv_ns_static()
556{
557        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
558        ret=1
559        for i in $systemlibdirs; do
560                if [ -f $i/libresolv.a ]; then
561                        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
562                        if [ "$?" = "0" ]; then
563                                ret=0
564                        fi
565                fi
566        done
567
568        rm -f $TMPFILE
569        return $ret
570}
571
572detect_nameser_has_ns_types()
573{
574        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
575        ret=1
576        # since we aren't actually linking with ns_* routines
577        # we can just compile the test code
578        echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
579        if [ "$?" = "0" ]; then
580                ret=0
581        fi
582
583        rm -f $TMPFILE
584        return $ret
585}
586
587if [ "$ssl" = "auto" ]; then
588        detect_gnutls
589        if [ "$ret" = "0" ]; then
590                # Disable NSS for now as it's known to not work very well ATM.
591                #detect_nss
592                :
593        fi
594elif [ "$ssl" = "gnutls" ]; then
595        detect_gnutls
596elif [ "$ssl" = "nss" ]; then
597        detect_nss
598elif [ "$ssl" = "openssl" ]; then
599        echo
600        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
601        echo 'installation of OpenSSL (including devel/header files) before reporting'
602        echo 'compilation problems.'
603        echo
604        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
605        echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported'
606        echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the'
607        echo 'operating system, which makes it GPL-compatible.'
608        echo
609        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
610        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
611        echo
612        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
613        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
614        echo 'package, you really should use GnuTLS instead.'
615        echo
616        echo 'Also, the OpenSSL license requires us to say this:'
617        echo ' *    "This product includes software developed by the OpenSSL Project'
618        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
619       
620        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
621       
622        ret=1
623else
624        echo
625        echo 'ERROR: Unknown SSL library specified.'
626        exit 1
627fi
628
629if [ "$ret" = "0" ]; then
630        echo
631        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
632        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
633        echo '       so if you want to use that, you have to select it by hand.'
634       
635        exit 1
636fi;
637
638echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
639
640if detect_nameser_has_ns_types; then
641        echo '#define NAMESER_HAS_NS_TYPES' >> config.h
642fi
643if detect_resolv_dynamic || detect_resolv_static; then
644        echo '#define HAVE_RESOLV_A' >> config.h
645        if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
646                echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
647        fi
648else
649        echo 'Insufficient resolv routines. Jabber server must be set explicitly'
650fi
651
652
653STORAGES="xml"
654
655for i in $STORAGES; do
656        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
657done
658echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
659
660authobjs=
661authlibs=
662if [ "$pam" = 0 ]; then
663        echo '#undef WITH_PAM' >> config.h
664else
665        if ! echo '#include <security/pam_appl.h>' | $CC -E - >/dev/null 2>/dev/null; then
666                echo 'Cannot find libpam development libraries, aborting. (Install libpam0g-dev?)'
667                exit 1
668        fi
669        echo '#define WITH_PAM' >> config.h
670        authobjs=$authobjs'auth_pam.o '
671        authlibs=$authlibs'-lpam '
672fi
673if [ "$ldap" = 0 ]; then
674        echo '#undef WITH_LDAP' >> config.h
675else
676        if ! echo '#include <ldap.h>' | $CC -E - >/dev/null 2>/dev/null; then
677                echo 'Cannot find libldap development libraries, aborting. (Install libldap2-dev?)'
678                exit 1
679        fi
680        echo '#define WITH_LDAP' >> config.h
681        authobjs=$authobjs'auth_ldap.o '
682        authlibs=$authlibs'-lldap '
683fi
684echo AUTH_OBJS=$authobjs >> Makefile.settings
685echo EFLAGS+=$authlibs >> Makefile.settings
686
687if [ "$strip" = 0 ]; then
688        echo "STRIP=\# skip strip" >> Makefile.settings;
689else
690        if [ "$debug" = 1 ]; then
691                echo
692                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
693                echo 'STRIP=\# skip strip' >> Makefile.settings
694                strip=0;
695        elif [ -n "$STRIP" ]; then
696                echo "STRIP=$STRIP" >> Makefile.settings;
697        elif type strip > /dev/null 2> /dev/null; then
698                echo "STRIP=strip" >> Makefile.settings;
699        else
700                echo
701                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
702                echo 'STRIP=\# skip strip' >> Makefile.settings
703                strip=0;
704        fi;
705fi
706
707if [ -z "$systemdsystemunitdir" ]; then
708        if $PKG_CONFIG --exists systemd; then
709                systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
710        fi
711fi
712if [ -n "$systemdsystemunitdir" ]; then
713        if [ "$systemdsystemunitdir" != "no" ]; then
714                echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
715        fi
716fi
717
718if [ "$gcov" = "1" ]; then
719        echo "CFLAGS+=--coverage" >> Makefile.settings
720        echo "EFLAGS+=--coverage" >> Makefile.settings
721fi
722
723if [ "$plugins" = 0 ]; then
724        plugindir=""
725        echo '#undef WITH_PLUGINS' >> config.h
726else
727        echo '#define WITH_PLUGINS' >> config.h
728fi
729
730otrprefix=""
731if [ "$otr" = "auto" ]; then
732        ! $PKG_CONFIG --exists libotr
733        otr=$?
734fi
735
736if [ "$otr" != 0 ] && ! $PKG_CONFIG --atleast-version=4.0 --print-errors libotr; then
737        exit 1
738fi
739
740if [ "$otr" = 1 ]; then
741        # BI == built-in
742        echo '#define OTR_BI' >> config.h
743        echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
744        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
745        echo 'OTR_BI=otr.o' >> Makefile.settings
746elif [ "$otr" = "plugin" ]; then
747        # for some mysterious reason beyond the comprehension of my mortal mind,
748        # the libgcrypt flags aren't needed when building as plugin. add them anyway.
749        echo '#define OTR_PI' >> config.h
750        echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
751        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
752        echo 'OTR_PI=otr.so' >> Makefile.settings
753fi
754
755if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
756        if [ "$arch" = "Darwin" ]; then
757                echo "SKYPEFLAGS=-dynamiclib -undefined dynamic_lookup" >> Makefile.settings
758        else
759                echo "SKYPEFLAGS=-fPIC -shared" >> Makefile.settings
760        fi
761        echo 'SKYPE_PI=skype.so' >> Makefile.settings
762        protocols_mods="$protocol_mods skype(plugin)"
763fi
764
765if [ -z "$PYTHON" ]; then
766        PYTHON=python
767fi
768
769if [ "$doc" = "1" ]; then
770        # check this here just in case someone tries to install it in python2.4...
771        if [ ! -e $srcdir/doc/user-guide/help.txt ] && ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
772                echo
773                echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
774                echo "(Use the PYTHON environment variable if it's in a weird location)"
775                exit 1
776        fi
777        echo "DOC=1" >> Makefile.settings
778        echo "PYTHON=$PYTHON" >> Makefile.settings
779fi
780
781get_version
782
783if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
784        echo 'Spoofing version number: '$BITLBEE_VERSION
785        echo '#undef BITLBEE_VERSION' >> config.h
786        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
787        echo
788fi
789
790if ! make helloworld > /dev/null 2>&1; then
791        echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
792        echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
793        echo "under the name 'gmake'."
794        echo
795        if gmake helloworld > /dev/null 2>&1; then
796                echo "gmake seems to be available on your machine, great."
797                echo
798        else
799                echo "gmake is not installed (or not working). Please try to install it."
800                echo
801        fi
802fi
803
804pkgconfiglibs=''
805case "$arch" in
806CYGWIN* )
807        pkgconfiglibs='-L${libdir} -lbitlbee -no-undefined'
808esac
809
810cat <<EOF >bitlbee.pc
811prefix=$prefix
812includedir=$includedir
813plugindir=$plugindir
814libdir=$libdir
815datadir=$datadir
816
817Name: bitlbee
818Description: IRC to IM gateway
819Requires: glib-2.0
820Version: $BITLBEE_VERSION
821Libs: $pkgconfiglibs
822Cflags: -I\${includedir}
823
824EOF
825
826protocols=''
827protoobjs=''
828
829if [ "$purple" = 0 ]; then
830        echo '#undef WITH_PURPLE' >> config.h
831else
832        if ! $PKG_CONFIG purple; then
833                echo
834                echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
835                exit 1
836        fi
837        echo '#define WITH_PURPLE' >> config.h
838        cat<<EOF >>Makefile.settings
839EFLAGS += $($PKG_CONFIG purple --libs)
840PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
841EOF
842        protocols=$protocols'purple '
843        protoobjs=$protoobjs'purple_mod.o '
844
845        # only disable these if the user didn't enable them explicitly
846        [ "$jabber" = "default-on" ] && jabber=0
847        [ "$oscar" = "default-on" ] && oscar=0
848
849        echo '#undef PACKAGE' >> config.h
850        echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
851       
852        if [ "$events" = "libevent" ]; then
853                echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
854                echo 'outside libpurple, talking to GLib directly. At least for now the combination'
855                echo 'libpurple + libevent is *not* recommended!'
856                echo
857        fi
858fi
859
860case "$CC" in
861*gcc* )
862        echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings
863        for i in . lib tests protocols protocols/*/; do
864                mkdir -p $i/.depend
865        done
866esac
867
868if [ "$jabber" = 0 ]; then
869        echo '#undef WITH_JABBER' >> config.h
870else
871        echo '#define WITH_JABBER' >> config.h
872        protocols=$protocols'jabber '
873        protoobjs=$protoobjs'jabber_mod.o '
874fi
875
876if [ "$oscar" = 0 ]; then
877        echo '#undef WITH_OSCAR' >> config.h
878else
879        echo '#define WITH_OSCAR' >> config.h
880        protocols=$protocols'oscar '
881        protoobjs=$protoobjs'oscar_mod.o '
882fi
883
884if [ "$twitter" = 0 ]; then
885        echo '#undef WITH_TWITTER' >> config.h
886else
887        echo '#define WITH_TWITTER' >> config.h
888        protocols=$protocols'twitter '
889        protoobjs=$protoobjs'twitter_mod.o '
890fi
891
892if [ "$protocols" = "PROTOCOLS = " ]; then
893        echo "Warning: You haven't selected any communication protocol to compile!"
894        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
895fi
896
897echo "PROTOCOLS = $protocols" >> Makefile.settings
898echo "PROTOOBJS = $protoobjs" >> Makefile.settings
899
900echo Architecture: $arch
901case "$arch" in
902Linux )
903;;
904GNU/* )
905;;
906*BSD )
907;;
908Darwin )
909        echo 'STRIP=\# skip strip' >> Makefile.settings
910;;
911IRIX )
912;;
913SunOS )
914        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
915        echo 'STRIP=\# skip strip' >> Makefile.settings
916        echo '#define NO_FD_PASSING' >> config.h
917;;
918AIX )
919        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
920;;
921CYGWIN* )
922        echo 'EFLAGS+=-Wl,--export-all,--out-implib,libbitlbee.dll.a' >> Makefile.settings
923        echo 'IMPLIB=libbitlbee.dll.a' >> Makefile.settings
924;;
925Windows )
926        echo 'Native windows compilation is not supported anymore, use cygwin instead.'
927;;
928* )
929        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
930        echo 'Please report any problems at http://bugs.bitlbee.org/.'
931;;
932esac
933
934if [ -n "$target" ]; then
935        echo "Cross-compiling for: $target"
936fi
937
938echo
939echo 'Configuration done:'
940
941if [ "$debug" = "1" ]; then
942        echo '  Debugging enabled.'
943else
944        echo '  Debugging disabled.'
945fi
946
947if [ "$asan" = "1" ]; then
948        echo '  AddressSanitizer (ASAN) enabled.'
949else
950        echo '  AddressSanitizer (ASAN) disabled.'
951fi
952
953if [ "$pie" = "1" ]; then
954        echo '  Building PIE executable'
955else
956        echo '  Building non-PIE executable'
957fi
958
959if [ "$strip" = "1" ]; then
960        echo '  Binary stripping enabled.'
961else
962        echo '  Binary stripping disabled.'
963fi
964
965if [ "$otr" = "1" ]; then
966        echo '  Off-the-Record (OTR) Messaging enabled.'
967elif [ "$otr" = "plugin" ]; then
968        echo '  Off-the-Record (OTR) Messaging enabled (as a plugin).'
969else
970        echo '  Off-the-Record (OTR) Messaging disabled.'
971fi
972
973if [ -n "$systemdsystemunitdir" ]; then
974        echo '  systemd enabled.'
975else
976        echo '  systemd disabled.'
977fi
978
979echo '  Using event handler: '$events
980echo '  Using SSL library: '$ssl
981#echo '  Building with these storage backends: '$STORAGES
982
983if [ -n "$protocols" ]; then
984        echo '  Building with these protocols:' $protocols$protocols_mods
985        case "$protocols" in
986        *purple*)
987                echo "    Note that BitlBee-libpurple is supported on a best-effort basis. It's"
988                echo "    not *fully* compatible with normal BitlBee. Don't use it unless you"
989                echo "    absolutely need it (i.e. support for a certain protocol or feature)."
990        esac
991else
992        echo '  Building without IM-protocol support. We wish you a lot of fun...'
993fi
Note: See TracBrowser for help on using the repository browser.