source: configure @ 5f1e78d

Last change on this file since 5f1e78d was 17f6079, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-07-24T12:50:21Z

Small changes to --skype= flag behaviour in configure script.

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