source: configure @ 5155570

Last change on this file since 5155570 was 66911fc, checked in by Miklos Vajna <vmiklos@…>, at 2011-06-29T23:29:01Z

configure: --skype=plugin -> --skype=1

  • Property mode set to 100755
File size: 18.9 KB
RevLine 
[b7d3cc34]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/sbin/'
12etcdir='$prefix/etc/bitlbee/'
13mandir='$prefix/share/man/'
14datadir='$prefix/share/bitlbee/'
15config='/var/lib/bitlbee/'
[85cf37f]16plugindir='$prefix/lib/bitlbee/'
17includedir='$prefix/include/bitlbee/'
[417002e]18systemdsystemunitdir=''
[85cf37f]19libevent='/usr/'
[34b17d9]20pidfile='/var/run/bitlbee.pid'
[5c5a586]21ipcsocket='/var/run/bitlbee.sock'
[e506d6c]22pcdir='$prefix/lib/pkgconfig'
[8462239]23systemlibdirs="/lib /lib64 /usr/lib /usr/lib64 /usr/local/lib /usr/local/lib64"
[b7d3cc34]24
25msn=1
26jabber=1
27oscar=1
28yahoo=1
[1b221e0]29twitter=1
[4aa0f6b]30twitter=1
[04dc563]31purple=0
[b7d3cc34]32
33debug=0
34strip=1
[66b9e86e]35gcov=0
[2abfbc5]36plugins=1
[04f0c10]37otr=0
[370899f]38skype=0
[85cf37f]39
40events=glib
[670204f]41ldap=0
[b7d3cc34]42ssl=auto
43
44arch=`uname -s`
45cpu=`uname -m`
46
[670204f]47GLIB_MIN_VERSION=2.4
48
[b7d3cc34]49echo BitlBee configure
50
51while [ -n "$1" ]; do
52        e="`expr "X$1" : 'X--\(.*=.*\)'`"
53        if [ -z "$e" ]; then
54                cat<<EOF
55
56Usage: $0 [OPTIONS]
57
58Option          Description                             Default
59
60--prefix=...    Directories to put files in             $prefix
61--bindir=...                                            $bindir
62--etcdir=...                                            $etcdir
63--mandir=...                                            $mandir
64--datadir=...                                           $datadir
[7b23afd]65--plugindir=...                                         $plugindir
[417002e]66--systemdsystemunitdir=...                              $systemdsystemunitdir
[34b17d9]67--pidfile=...                                           $pidfile
[b7d3cc34]68--config=...                                            $config
[6dff9d4]69--ipcsocket=...                                         $ipcsocket
[b7d3cc34]70
71--msn=0/1       Disable/enable MSN part                 $msn
72--jabber=0/1    Disable/enable Jabber part              $jabber
73--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
74--yahoo=0/1     Disable/enable Yahoo part               $yahoo
[4aa0f6b]75--twitter=0/1   Disable/enable Twitter part             $twitter
[b7d3cc34]76
[796da03]77--purple=0/1    Disable/enable libpurple support        $purple
[04f0c10]78                (automatically disables other protocol modules)
[b7d3cc34]79
80--debug=0/1     Disable/enable debugging                $debug
81--strip=0/1     Disable/enable binary stripping         $strip
[66b9e86e]82--gcov=0/1      Disable/enable test coverage reporting  $gcov
[2abfbc5]83--plugins=0/1   Disable/enable plugins support          $plugins
[04f0c10]84--otr=0/1/auto/plugin
85                Disable/enable OTR encryption support   $otr
[370899f]86--skype=0/plugin
87                Disable/enable Skype support            $skype
[b7d3cc34]88
[85cf37f]89--events=...    Event handler (glib, libevent)          $events
[b7d3cc34]90--ssl=...       SSL library to use (gnutls, nss, openssl, bogus, auto)
91                                                        $ssl
[aec56b0]92
[f1e7407]93--target=...    Cross compilation target                same as host
[b7d3cc34]94EOF
95                exit;
96        fi
97        eval "$e"
98        shift;
99done
100
101# Expand $prefix and get rid of double slashes
102bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
103etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
104mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
105datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
106config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
[7b23afd]107plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
[85cf37f]108includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
109libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
110
[6dff9d4]111pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
112ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
[e506d6c]113pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
[b7d3cc34]114
115cat<<EOF>Makefile.settings
116## BitlBee settings, generated by configure
117PREFIX=$prefix
118BINDIR=$bindir
119ETCDIR=$etcdir
120MANDIR=$mandir
121DATADIR=$datadir
[7b23afd]122PLUGINDIR=$plugindir
[b7d3cc34]123CONFIG=$config
[e506d6c]124INCLUDEDIR=$includedir
125PCDIR=$pcdir
[b7d3cc34]126
[1bf9492]127TARGET=$target
[b7d3cc34]128ARCH=$arch
129CPU=$cpu
130
131DESTDIR=
132LFLAGS=
133EFLAGS=
134EOF
135
[1074806]136srcdir=$(cd $(dirname $0);pwd)
137currdir=$(pwd)
138if [ "$srcdir" != "$currdir" ]; then 
[f60079b]139        echo
140        echo "configure script run from a different directory. Will create some symlinks..."
141        if [ ! -e Makefile -o -L Makefile ]; then
[04dc563]142                COPYDIRS="doc lib protocols tests utils"
143                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
[f60079b]144                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
145                dst="$PWD"
146                cd "$srcdir"
[04dc563]147                for i in $(find . -name Makefile -type f); do
[f60079b]148                        ln -s "$PWD${i#.}" "$dst/$i";
149                done
150                cd "$dst"
151                rm -rf .bzr
152        fi
153       
154        echo "SRCDIR=$srcdir/" >> Makefile.settings
155        CFLAGS="$CFLAGS -I${dst}"
156else
157        srcdir=$PWD
158fi
159
[b7d3cc34]160cat<<EOF>config.h
161/* BitlBee settings, generated by configure
162   
163   Do *NOT* use any of these defines in your code without thinking twice, most
164   of them can/will be overridden at run-time */
165
166#define CONFIG "$config"
167#define ETCDIR "$etcdir"
168#define VARDIR "$datadir"
[7b23afd]169#define PLUGINDIR "$plugindir"
[34b17d9]170#define PIDFILE "$pidfile"
[6dff9d4]171#define IPCSOCKET "$ipcsocket"
[b7d3cc34]172#define ARCH "$arch"
173#define CPU "$cpu"
174EOF
175
[1bf9492]176
177
[f1e7407]178if [ -n "$target" ]; then
[1bf9492]179        PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
180        export PKG_CONFIG_LIBDIR
[f1e7407]181        PATH=/usr/$target/bin:$PATH
182        CC=$target-cc
183        LD=$target-ld
[1bf9492]184        systemlibdirs="/usr/$target/lib"
[f1e7407]185fi
186
[1bf9492]187
[b7d3cc34]188if [ "$debug" = "1" ]; then
[285b55d]189        [ -z "$CFLAGS" ] && CFLAGS=-g
[b7d3cc34]190        echo 'DEBUG=1' >> Makefile.settings
[911cc4f]191        CFLAGS="$CFLAGS -DDEBUG"
[b7d3cc34]192else
[56f260a]193        [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
[b7d3cc34]194fi
195
[daae10f]196echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
[f60079b]197echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
[b7d3cc34]198
[f712188]199echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
200
[b7d3cc34]201if [ -n "$CC" ]; then
[5973412]202        CC=$CC
[b7d3cc34]203elif type gcc > /dev/null 2> /dev/null; then
[5973412]204        CC=gcc
[b7d3cc34]205elif type cc > /dev/null 2> /dev/null; then
[5973412]206        CC=cc
[b7d3cc34]207else
208        echo 'Cannot find a C compiler, aborting.'
209        exit 1;
210fi
211
[5973412]212echo "CC=$CC" >> Makefile.settings;
[daae10f]213if echo $CC | grep -qw gcc; then
214        # Apparently -Wall is gcc-specific?
215        echo CFLAGS+=-Wall >> Makefile.settings
216fi
[5973412]217
[f1e7407]218if [ -z "$LD" ]; then
219        if type ld > /dev/null 2> /dev/null; then
220                LD=ld
221        else
222                echo 'Cannot find ld, aborting.'
223                exit 1;
224        fi
[b7d3cc34]225fi
226
[f1e7407]227echo "LD=$LD" >> Makefile.settings
228
[32c632f]229if [ -z "$PKG_CONFIG" ]; then
230        PKG_CONFIG=pkg-config
231fi
232
233if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
[670204f]234        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
235                cat<<EOF>>Makefile.settings
[32c632f]236EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
237CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
[b7d3cc34]238EOF
[670204f]239        else
240                echo
241                echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
242                exit 1
243        fi
[b7d3cc34]244else
[670204f]245        echo
[574af7e]246        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
[670204f]247        exit 1
[b7d3cc34]248fi
249
[85cf37f]250if [ "$events" = "libevent" ]; then
[003553b]251        if ! [ -f "${libevent}include/event.h" ]; then
[85cf37f]252                echo
253                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
254                echo 'its location using the --libevent= argument. (Example: If event.h is in'
255                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
256        fi
257       
258        echo '#define EVENTS_LIBEVENT' >> config.h
259        cat <<EOF>>Makefile.settings
260EFLAGS+=-levent -L${libevent}lib
261CFLAGS+=-I${libevent}include
262EOF
263elif [ "$events" = "glib" ]; then
264        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
265        echo '#define EVENTS_GLIB' >> config.h
[b7d3cc34]266else
267        echo
[85cf37f]268        echo 'ERROR: Unknown event handler specified.'
269        exit 1
[b7d3cc34]270fi
[85cf37f]271echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
[b7d3cc34]272
273detect_gnutls()
274{
[4af7b4f]275        if $PKG_CONFIG --exists gnutls; then
276                cat <<EOF>>Makefile.settings
[83e47ec]277EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
278CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
[4af7b4f]279EOF
280                ssl=gnutls
281                ret=1
282        elif libgnutls-config --version > /dev/null 2> /dev/null; then
[b7d3cc34]283                cat <<EOF>>Makefile.settings
[83e47ec]284EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
285CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
[b7d3cc34]286EOF
287               
288                ssl=gnutls
289                ret=1;
290        else
291                ret=0;
292        fi;
293}
294
295detect_nss()
296{
[ef043d3]297        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
[b7d3cc34]298                cat<<EOF>>Makefile.settings
[ef043d3]299EFLAGS+=`$PKG_CONFIG --libs nss`
300CFLAGS+=`$PKG_CONFIG --cflags nss`
[b7d3cc34]301EOF
302               
303                ssl=nss
304                ret=1;
305        else
306                ret=0;
307        fi;
308}
309
[f32d557]310detect_ldap()
[f665dab]311{
[4fca1db]312        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
[5973412]313        if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then
[f665dab]314                cat<<EOF>>Makefile.settings
[5973412]315EFLAGS+=-lldap
316CFLAGS+=
[f665dab]317EOF
[f32d557]318                ldap=1
[5973412]319                rm -f $TMPFILE
[f665dab]320                ret=1
[b7d3cc34]321        else
[5973412]322                ldap=0
[f665dab]323                ret=0
[b7d3cc34]324        fi
[f665dab]325}
326
[36cf9fd]327RESOLV_TESTCODE='
328#include <arpa/nameser.h>
329#include <resolv.h>
330
331int main()
332{
333        ns_initparse( NULL, 0, NULL );
334        ns_parserr( NULL, ns_s_an, 0, NULL );
335}
336'
337
338detect_resolv_dynamic()
339{
[4fca1db]340        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
[8462239]341        ret=1
342        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -lresolv >/dev/null 2>/dev/null
[36cf9fd]343        if [ "$?" = "0" ]; then
344                echo 'EFLAGS+=-lresolv' >> Makefile.settings
[8462239]345                ret=0
[36cf9fd]346        fi
347
[8462239]348        rm -f $TMPFILE
349        return $ret
[36cf9fd]350}
351
352detect_resolv_static()
353{
[4fca1db]354        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
[8462239]355        ret=1
[36cf9fd]356        for i in $systemlibdirs; do
357                if [ -f $i/libresolv.a ]; then
[8462239]358                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
[36cf9fd]359                        if [ "$?" = "0" ]; then
360                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
[8462239]361                                ret=0
[36cf9fd]362                        fi
363                fi
364        done
365
[8462239]366        rm -f $TMPFILE
367        return $ret
[36cf9fd]368}
369
[b3c467b]370if [ "$ssl" = "auto" ]; then
371        detect_gnutls
[b7d3cc34]372        if [ "$ret" = "0" ]; then
[c5920df]373                # Disable NSS for now as it's known to not work very well ATM.
374                #detect_nss
[191cfb1]375                :
[b7d3cc34]376        fi
[b3c467b]377elif [ "$ssl" = "gnutls" ]; then
378        detect_gnutls
379elif [ "$ssl" = "nss" ]; then
380        detect_nss
[85d7b85]381elif [ "$ssl" = "sspi" ]; then
382        echo
[b3c467b]383elif [ "$ssl" = "openssl" ]; then
384        echo
385        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
386        echo 'install of OpenSSL (including devel/header files) before reporting'
387        echo 'compilation problems.'
388        echo
389        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
390        echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
391        echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
392        echo 'part of the operating system, which makes it GPL-compatible.'
393        echo
394        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
395        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
396        echo
397        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
398        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
399        echo 'package, you really should use GnuTLS or NSS instead.'
400        echo
401        echo 'Also, the OpenSSL license requires us to say this:'
402        echo ' *    "This product includes software developed by the OpenSSL Project'
403        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
[b7d3cc34]404       
[b3c467b]405        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
406       
407        ret=1
408elif [ "$ssl" = "bogus" ]; then
409        echo
[670204f]410        echo 'Using bogus SSL code. This means some features will not work properly.'
[b3c467b]411       
412        ## Yes, you, at the console! How can you authenticate if you don't have any SSL!?
[1c2eaa3]413        if [ "$msn" = "1" -o "$yahoo" = "1" ]; then
[b7d3cc34]414                echo
[1c2eaa3]415                echo 'WARNING: The MSN and Yahoo! modules will not work without SSL. Disabling.'
[b3c467b]416                msn=0
[1c2eaa3]417                yahoo=0
[b3c467b]418        fi
[b7d3cc34]419       
[b3c467b]420        ret=1
421else
422        echo
423        echo 'ERROR: Unknown SSL library specified.'
424        exit 1
[b7d3cc34]425fi
426
[b3c467b]427if [ "$ret" = "0" ]; then
428        echo
429        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
430        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
431        echo '       so if you want to use that, you have to select it by hand. If you don'\''t'
432        echo '       need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)'
[b7d3cc34]433       
[b3c467b]434        exit 1
435fi;
436
[83e47ec]437if [ "$msn" = "1" -a "$ssl" != "openssl" -a "$ssl" != "gnutls" ]; then
[a366cca]438        # Needed for MSN only. OpenSSL exports nice cipher functions already,
[83e47ec]439        # in case of GnuTLS we should be able to use gcrypt. Otherwise, use
440        # built-in stuff. (Since right now those are the only two supported
441        # SSL modules anyway, this is mostly unnecessary.)
[a366cca]442        echo 'DES=des.o' >> Makefile.settings
443fi
444
[b3c467b]445echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
446
[36cf9fd]447if detect_resolv_dynamic || detect_resolv_static; then
448        echo '#define HAVE_RESOLV_A' >> config.h
449fi
[36e9f62]450
[ba7d16f]451STORAGES="xml"
[b3c467b]452
[f32d557]453if [ "$ldap" = "auto" ]; then
454        detect_ldap
[b7d3cc34]455fi
456
[f32d557]457if [ "$ldap" = 0 ]; then
[5973412]458        echo "#undef WITH_LDAP" >> config.h
[f32d557]459elif [ "$ldap" = 1 ]; then
[5c5a586]460        echo
461        echo 'LDAP support is a work in progress and does NOT work AT ALL right now.'
462        echo
463        exit 1
464       
[5973412]465        echo "#define WITH_LDAP 1" >> config.h
[b3c467b]466        STORAGES="$STORAGES ldap"
[b7d3cc34]467fi
468
[b3c467b]469for i in $STORAGES; do
470        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
471done
472echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
473
[b7d3cc34]474if [ "$strip" = 0 ]; then
475        echo "STRIP=\# skip strip" >> Makefile.settings;
476else
477        if [ "$debug" = 1 ]; then
478                echo
479                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
480                echo 'STRIP=\# skip strip' >> Makefile.settings
481                strip=0;
482        elif [ -n "$STRIP" ]; then
483                echo "STRIP=$STRIP" >> Makefile.settings;
484        elif type strip > /dev/null 2> /dev/null; then
485                echo "STRIP=strip" >> Makefile.settings;
486        else
487                echo
488                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
489                echo 'STRIP=\# skip strip' >> Makefile.settings
490                strip=0;
491        fi;
492fi
493
[417002e]494if [ -z "$systemdsystemunitdir" ]; then
495        if $PKG_CONFIG --exists systemd; then
496                systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
497        fi
498fi
499if [ -n "$systemdsystemunitdir" ]; then
500        if [ "$systemdsystemunitdir" != "no" ]; then
501                echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
502        fi
503fi
504
[66b9e86e]505if [ "$gcov" = "1" ]; then
[31fc3970]506        echo "CFLAGS+=--coverage" >> Makefile.settings
507        echo "EFLAGS+=--coverage" >> Makefile.settings
[66b9e86e]508fi
509
[2abfbc5]510if [ "$plugins" = 0 ]; then
511        echo '#undef WITH_PLUGINS' >> config.h
512else
513        echo '#define WITH_PLUGINS' >> config.h
514fi
515
[6738a67]516otrprefix=""
517for i in / /usr /usr/local; do
518        if [ -f ${i}/lib/libotr.a ]; then
519                otrprefix=${i}
520                break
521        fi
522done
[764c7d1]523if [ "$otr" = "auto" ]; then
[6738a67]524        if [ -n "$otrprefix" ]; then
525                otr=1
526        else
527                otr=0
528        fi
[764c7d1]529fi
[6738a67]530if [ "$otr" = 1 ]; then
[858ea01]531        # BI == built-in
532        echo '#define OTR_BI' >> config.h
[6738a67]533        echo "EFLAGS+=-L${otrprefix}/lib -lotr" >> Makefile.settings
534        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
[858ea01]535        echo 'OTR_BI=otr.o' >> Makefile.settings
536elif [ "$otr" = "plugin" ]; then
537        echo '#define OTR_PI' >> config.h
538        echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
539        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
540        echo 'OTR_PI=otr.so' >> Makefile.settings
[764c7d1]541fi
542
[66911fc]543if [ "$skype" = "1" ]; then
[370899f]544        echo 'SKYPE_PI=skype.so' >> Makefile.settings
545fi
546
[ceebeb1]547if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then
548        echo
549        echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'
550        echo 'Install xmlto if you want online help to work.'
551fi
552
[ffea9b9]553echo
[a014331]554if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
555        nick=`bzr nick`
556        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
557                nick="-$nick"
558        else
559                nick=""
560        fi
[ffea9b9]561        rev=`bzr revno`
562        echo 'Using bzr revision #'$rev' as version number'
[a014331]563        BITLBEE_VERSION=\"bzr$nick-$rev\"
[b7d3cc34]564fi
565
566if [ -n "$BITLBEE_VERSION" ]; then
567        echo 'Spoofing version number: '$BITLBEE_VERSION
568        echo '#undef BITLBEE_VERSION' >> config.h
[ffea9b9]569        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
570        echo
[b7d3cc34]571fi
572
[4fca1db]573if ! make helloworld > /dev/null 2>&1; then
574        echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
575        echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
576        echo "under the name 'gmake'."
577        echo
578        if gmake helloworld > /dev/null 2>&1; then
579                echo "gmake seems to be available on your machine, great."
580                echo
581        else
582                echo "gmake is not installed (or not working). Please try to install it."
583                echo
584        fi
585fi
586
[e506d6c]587cat <<EOF>bitlbee.pc
588prefix=$prefix
589includedir=$includedir
590
591Name: bitlbee
592Description: IRC to IM gateway
593Requires: glib-2.0
594Version: $BITLBEE_VERSION
595Libs:
596Cflags: -I\${includedir}
597
598EOF
599
[b7d3cc34]600protocols=''
601protoobjs=''
602
[e248c7f]603if [ "$purple" = 0 ]; then
604        echo '#undef WITH_PURPLE' >> config.h
605else
[e08e53c]606        if ! $PKG_CONFIG purple; then
607                echo
608                echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
609                exit 1
610        fi
[e248c7f]611        echo '#define WITH_PURPLE' >> config.h
[e08e53c]612        cat<<EOF>>Makefile.settings
613EFLAGS += $($PKG_CONFIG purple --libs)
614PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
615EOF
[e248c7f]616        protocols=$protocols'purple '
617        protoobjs=$protoobjs'purple_mod.o '
618
619        # Having both libpurple and native IM modules in one binary may
620        # do strange things. Let's not do that.
621        msn=0
622        jabber=0
623        oscar=0
624        yahoo=0
[bda2975]625       
626        if [ "$events" = "libevent" ]; then
627                echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
628                echo 'outside libpurple, talking to GLib directly. At least for now the combination'
629                echo 'libpurple + libevent is *not* recommended!'
[c775a58]630                echo
[bda2975]631        fi
[e248c7f]632fi
633
[b0a89cc]634case "$CC" in
635*gcc* )
636        echo CFLAGS+=-MD -MF .depend/\$@.d >> Makefile.settings
637        for i in . lib protocols protocols/*/; do
638                mkdir -p $i/.depend
639        done
640esac
641
[b7d3cc34]642if [ "$msn" = 0 ]; then
643        echo '#undef WITH_MSN' >> config.h
644else
645        echo '#define WITH_MSN' >> config.h
646        protocols=$protocols'msn '
[b5a22e3]647        protoobjs=$protoobjs'msn_mod.o '
[b7d3cc34]648fi
649
650if [ "$jabber" = 0 ]; then
651        echo '#undef WITH_JABBER' >> config.h
652else
653        echo '#define WITH_JABBER' >> config.h
654        protocols=$protocols'jabber '
[b5a22e3]655        protoobjs=$protoobjs'jabber_mod.o '
[b7d3cc34]656fi
657
658if [ "$oscar" = 0 ]; then
659        echo '#undef WITH_OSCAR' >> config.h
660else
661        echo '#define WITH_OSCAR' >> config.h
662        protocols=$protocols'oscar '
[b5a22e3]663        protoobjs=$protoobjs'oscar_mod.o '
[b7d3cc34]664fi
665
666if [ "$yahoo" = 0 ]; then
667        echo '#undef WITH_YAHOO' >> config.h
668else
669        echo '#define WITH_YAHOO' >> config.h
670        protocols=$protocols'yahoo '
[b5a22e3]671        protoobjs=$protoobjs'yahoo_mod.o '
[b7d3cc34]672fi
673
[1b221e0]674if [ "$twitter" = 0 ]; then
675        echo '#undef WITH_TWITTER' >> config.h
676else
677        echo '#define WITH_TWITTER' >> config.h
678        protocols=$protocols'twitter '
679        protoobjs=$protoobjs'twitter_mod.o '
680fi
681
[b7d3cc34]682if [ "$protocols" = "PROTOCOLS = " ]; then
[43462708]683        echo "Warning: You haven't selected any communication protocol to compile!"
[b3c467b]684        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
[b7d3cc34]685fi
686
687echo "PROTOCOLS = $protocols" >> Makefile.settings
688echo "PROTOOBJS = $protoobjs" >> Makefile.settings
689
690echo Architecture: $arch
691case "$arch" in
692Linux )
693;;
694GNU/* )
695;;
696*BSD )
697;;
698Darwin )
[caceb06]699        echo 'STRIP=\# skip strip' >> Makefile.settings
[b7d3cc34]700;;
701IRIX )
702;;
703SunOS )
704        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
705        echo 'STRIP=\# skip strip' >> Makefile.settings
[70d7795]706        echo '#define NO_FD_PASSING' >> config.h
[b7d3cc34]707;;
[8de63c3]708AIX )
709        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
[b7d3cc34]710;;
711CYGWIN* )
712        echo 'Cygwin is not officially supported.'
713;;
[aec56b0]714Windows )
715;;
[b7d3cc34]716* )
[8d6c4b1]717        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
718        echo 'Please report any problems at http://bugs.bitlbee.org/.'
[b7d3cc34]719;;
720esac
721
[f1e7407]722if [ -n "$target" ]; then
723        echo "Cross-compiling for: $target"
724fi
725
[b7d3cc34]726echo
727echo 'Configuration done:'
728
729if [ "$debug" = "1" ]; then
[b3c467b]730        echo '  Debugging enabled.'
[b7d3cc34]731else
[b3c467b]732        echo '  Debugging disabled.'
[b7d3cc34]733fi
734
735if [ "$strip" = "1" ]; then
[b3c467b]736        echo '  Binary stripping enabled.'
[b7d3cc34]737else
[b3c467b]738        echo '  Binary stripping disabled.'
[b7d3cc34]739fi
740
[764c7d1]741if [ "$otr" = "1" ]; then
742        echo '  Off-the-Record (OTR) Messaging enabled.'
[858ea01]743elif [ "$otr" = "plugin" ]; then
744        echo '  Off-the-Record (OTR) Messaging enabled (as a plugin).'
[764c7d1]745else
746        echo '  Off-the-Record (OTR) Messaging disabled.'
747fi
748
[66911fc]749if [ "$skype" = "1" ]; then
[370899f]750        echo '  Skype enabled (as a plugin).'
751else
752        echo '  Skype disabled.'
753fi
754
[417002e]755if [ -n "$systemdsystemunitdir" ]; then
756        echo '  systemd enabled.'
757else
758        echo '  systemd disabled.'
759fi
760
[b3c467b]761echo '  Using event handler: '$events
762echo '  Using SSL library: '$ssl
[4e3df8a]763#echo '  Building with these storage backends: '$STORAGES
[b7d3cc34]764
765if [ -n "$protocols" ]; then
[b3c467b]766        echo '  Building with these protocols:' $protocols
[4e3df8a]767        case "$protocols" in
768        *purple*)
769                echo "    Note that BitlBee-libpurple is supported on a best-effort basis. It's"
770                echo "    not *fully* compatible with normal BitlBee. Don't use it unless you"
771                echo "    absolutely need it (i.e. support for a certain protocol or feature)."
772        esac
[b7d3cc34]773else
[b3c467b]774        echo '  Building without IM-protocol support. We wish you a lot of fun...'
[b7d3cc34]775fi
Note: See TracBrowser for help on using the repository browser.