source: configure @ 93302ef

Last change on this file since 93302ef was 0075527, checked in by Nick Murdoch <nick@…>, at 2013-03-17T13:38:14Z

Add existing git project files, and modify bitlbee's build script to build the plugin.

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