source: configure @ 417002e

Last change on this file since 417002e was 417002e, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-03-18T00:57:14Z

systemd stuff (bug #738)

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