source: configure @ 2700925

Last change on this file since 2700925 was b1dc403, checked in by Wilmer van der Gaast <wilmer@…>, at 2015-05-04T21:58:50Z

Catch up with master.

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