source: configure @ aee8c19

Last change on this file since aee8c19 was aee8c19, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-12-07T21:37:27Z

Fix libresolv detection on FreeBSD. Based on a patch by ashish@….

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