source: configure @ 0dd6570

Last change on this file since 0dd6570 was 57da960, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-12-10T22:43:10Z

Skype module packaging.

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