source: configure @ 15c3a6b

Last change on this file since 15c3a6b was b75671d, checked in by Wilmer van der Gaast <wilmer@…>, at 2015-06-17T22:47:26Z

Merge remote-tracking branch 'origin/master' into parson

  • Property mode set to 100755
File size: 22.8 KB
Line 
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/bin/'
12sbindir='$prefix/sbin/'
13etcdir='$prefix/etc/bitlbee/'
14mandir='$prefix/share/man/'
15datadir='$prefix/share/bitlbee/'
16config='/var/lib/bitlbee/'
17plugindir='$prefix/lib/bitlbee/'
18includedir='$prefix/include/bitlbee/'
19systemdsystemunitdir=''
20libevent='/usr/'
21pidfile='/var/run/bitlbee.pid'
22ipcsocket=''
23pcdir='$prefix/lib/pkgconfig'
24systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
25
26# Set these to default-on to let it be overriden by either the user or purple
27#
28# If the user sets one of these to 1, purple won't disable them.
29# Otherwise, if it's still default-on, it gets included in normal builds,
30# but not purple ones.
31msn="default-on"
32jabber="default-on"
33oscar="default-on"
34rpc="rpc-on"
35yahoo="default-on"
36
37twitter=1
38purple=0
39
40doc=1
41debug=0
42strip=1
43gcov=0
44asan=0
45plugins=1
46otr=0
47skype=0
48
49events=glib
50ssl=auto
51
52pie=1
53
54arch=`uname -s`
55cpu=`uname -m`
56
57GLIB_MIN_VERSION=2.16
58
59# Cygwin and Darwin don't support PIC/PIE
60case "$arch" in
61        CYGWIN* )
62                pie=0;;
63        Darwin )
64                pie=0;;
65esac
66
67get_version() {
68        REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
69
70        if [ -n "$BITLBEE_VERSION" ]; then
71                # environment variable already set to something to spoof it
72                # don't replace it with the git stuff
73                return
74        fi
75
76        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
77
78        if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
79                timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
80                branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
81
82                search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)'
83                replace="\1+$timestamp+$branch+\2-\3-git"
84
85                describe=$(cd $srcdir; git describe --long --tags 2>/dev/null)
86                if [ $? -ne 0 ]; then
87                        describe=${REAL_BITLBEE_VERSION}-0-g$(cd $srcdir; git rev-parse --short HEAD)
88                fi
89
90                BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#")
91
92                unset timestamp branch search replace describe
93        fi
94}
95
96if [ "$1" = "--dump-version" ]; then
97        srcdir=$(cd $(dirname $0);pwd)
98        get_version
99        echo $BITLBEE_VERSION
100        exit
101fi
102
103echo BitlBee configure
104
105while [ -n "$1" ]; do
106        e="`expr "X$1" : 'X--\(.*=.*\)'`"
107        if [ -z "$e" ]; then
108                cat<<EOF
109
110Usage: $0 [OPTIONS]
111
112Option          Description                             Default
113
114--prefix=...    Directories to put files in             $prefix
115--bindir=...                                            $bindir
116--sbindir=...                                           $sbindir
117--etcdir=...                                            $etcdir
118--mandir=...                                            $mandir
119--datadir=...                                           $datadir
120--plugindir=...                                         $plugindir
121--systemdsystemunitdir=...                              $systemdsystemunitdir
122--pidfile=...                                           $pidfile
123--config=...                                            $config
124
125--msn=0/1       Disable/enable MSN part                 $msn
126--jabber=0/1    Disable/enable Jabber part              $jabber
127--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
128--yahoo=0/1     Disable/enable Yahoo part               $yahoo
129--twitter=0/1   Disable/enable Twitter part             $twitter
130
131--purple=0/1    Disable/enable libpurple support        $purple
132                (automatically disables other protocol modules)
133--rpc=0/1       Disable/enable RPC interface            $rpc
134
135--doc=0/1       Disable/enable help.txt generation      $doc
136--debug=0/1     Disable/enable debugging                $debug
137--strip=0/1     Disable/enable binary stripping         $strip
138--pie=0/1       Build position independent executable   $pie
139--gcov=0/1      Disable/enable test coverage reporting  $gcov
140--asan=0/1      Disable/enable AddressSanitizer         $asan
141--plugins=0/1   Disable/enable plugins support          $plugins
142--otr=0/1/auto/plugin
143                Disable/enable OTR encryption support   $otr
144--skype=0/1/plugin
145                Disable/enable Skype support            $skype
146
147--events=...    Event handler (glib, libevent)          $events
148--ssl=...       SSL library to use (gnutls, nss, openssl, auto)
149                                                        $ssl
150
151
152--target=...    Cross compilation target                same as host
153EOF
154                exit;
155        fi
156        eval "$e"
157        shift;
158done
159
160# Expand $prefix and get rid of double slashes
161bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
162sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'`
163etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
164mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
165datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
166config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
167plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
168includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
169libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
170
171pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
172ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
173pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
174
175protocols_mods=""
176
177cat <<EOF >Makefile.settings
178## BitlBee settings, generated by configure
179PREFIX=$prefix
180BINDIR=$bindir
181SBINDIR=$sbindir
182ETCDIR=$etcdir
183MANDIR=$mandir
184DATADIR=$datadir
185PLUGINDIR=$plugindir
186CONFIG=$config
187INCLUDEDIR=$includedir
188PCDIR=$pcdir
189
190TARGET=$target
191ARCH=$arch
192CPU=$cpu
193
194INSTALL=install -p
195
196DESTDIR=
197LFLAGS=
198EFLAGS=-lm
199EOF
200
201srcdir=$(cd $(dirname $0);pwd)
202currdir=$(pwd)
203if [ "$srcdir" != "$currdir" ]; then 
204        echo
205        echo "configure script run from a different directory. Will create some symlinks..."
206        if [ ! -e Makefile -o -L Makefile ]; then
207                COPYDIRS="doc lib protocols tests utils"
208                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
209                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
210                dst="$PWD"
211                cd "$srcdir"
212                for i in $(find . -name Makefile -type f); do
213                        ln -s "$PWD${i#.}" "$dst/$i";
214                done
215                cd "$dst"
216                rm -rf .bzr
217        fi
218       
219        echo "_SRCDIR_=$srcdir/" >> Makefile.settings
220        CFLAGS="$CFLAGS -I${dst}"
221else
222        srcdir=$PWD
223fi
224
225cat<<EOF >config.h
226/* BitlBee settings, generated by configure
227   
228   Do *NOT* use any of these defines in your code without thinking twice, most
229   of them can/will be overridden at run-time */
230
231#define CONFIG "$config"
232#define ETCDIR "$etcdir"
233#define VARDIR "$datadir"
234#define PLUGINDIR "$plugindir"
235#define PIDFILE "$pidfile"
236#define IPCSOCKET "$ipcsocket"
237#define ARCH "$arch"
238#define CPU "$cpu"
239EOF
240
241
242
243if [ -n "$target" ]; then
244        PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
245        export PKG_CONFIG_LIBDIR
246        PATH=/usr/$target/bin:$PATH
247        CC=$target-cc
248        LD=$target-ld
249        systemlibdirs="/usr/$target/lib"
250fi
251
252if [ "$asan" = "1" ]; then
253        CFLAGS="$CFLAGS -fsanitize=address"
254        LDFLAGS="$LDFLAGS -fsanitize=address"
255        debug=1
256fi
257
258if [ "$debug" = "1" ]; then
259        echo 'DEBUG=1' >> Makefile.settings
260        CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
261else
262        [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
263fi
264
265if [ "$pie" = "1" ]; then
266        echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings
267        echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings
268fi
269
270echo LDFLAGS=$LDFLAGS >> Makefile.settings
271
272echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
273echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
274
275echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
276
277if [ -n "$CC" ]; then
278        CC=$CC
279elif type gcc > /dev/null 2> /dev/null; then
280        CC=gcc
281elif type cc > /dev/null 2> /dev/null; then
282        CC=cc
283else
284        echo 'Cannot find a C compiler, aborting.'
285        exit 1;
286fi
287
288echo "CC=$CC" >> Makefile.settings;
289if echo $CC | grep -qw gcc; then
290        # Apparently -Wall is gcc-specific?
291        echo CFLAGS+=-Wall >> Makefile.settings
292fi
293
294if [ -z "$LD" ]; then
295        if type ld > /dev/null 2> /dev/null; then
296                LD=ld
297        else
298                echo 'Cannot find ld, aborting.'
299                exit 1;
300        fi
301fi
302
303echo "LD=$LD" >> Makefile.settings
304
305if [ -z "$PKG_CONFIG" ]; then
306        PKG_CONFIG=pkg-config
307fi
308
309if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
310        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
311                cat<<EOF >>Makefile.settings
312EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
313CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
314EOF
315        else
316                echo
317                echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
318                exit 1
319        fi
320else
321        echo
322        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
323        exit 1
324fi
325
326if [ "$events" = "libevent" ]; then
327        if ! [ -f "${libevent}include/event.h" ]; then
328                echo
329                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
330                echo 'its location using the --libevent= argument. (Example: If event.h is in'
331                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
332        fi
333       
334        echo '#define EVENTS_LIBEVENT' >> config.h
335        cat <<EOF >>Makefile.settings
336EFLAGS+=-levent -L${libevent}lib
337CFLAGS+=-I${libevent}include
338EOF
339elif [ "$events" = "glib" ]; then
340        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
341        echo '#define EVENTS_GLIB' >> config.h
342else
343        echo
344        echo 'ERROR: Unknown event handler specified.'
345        exit 1
346fi
347echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
348
349detect_gnutls()
350{
351        if $PKG_CONFIG --exists gnutls; then
352                cat <<EOF >>Makefile.settings
353EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
354CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
355EOF
356                ssl=gnutls
357                if ! pkg-config gnutls --atleast-version=2.8; then
358                        echo
359                        echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
360                fi
361                ret=1
362        elif libgnutls-config --version > /dev/null 2> /dev/null; then
363                cat <<EOF >>Makefile.settings
364EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
365CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
366EOF
367               
368                ssl=gnutls
369                ret=1;
370        else
371                ret=0;
372        fi;
373}
374
375detect_nss()
376{
377        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
378                cat<<EOF >>Makefile.settings
379EFLAGS+=`$PKG_CONFIG --libs nss`
380CFLAGS+=`$PKG_CONFIG --cflags nss`
381EOF
382               
383                ssl=nss
384                ret=1;
385        else
386                ret=0;
387        fi;
388}
389
390RESOLV_TESTCODE='
391#include <sys/types.h>
392#include <netinet/in.h>
393#include <arpa/nameser.h>
394#include <resolv.h>
395
396int main()
397{
398
399        res_query( NULL, 0, 0, NULL, 0);
400        dn_expand( NULL, NULL, NULL, NULL, 0);
401        dn_skipname( NULL, NULL);
402}
403'
404RESOLV_NS_TESTCODE='
405#include <sys/types.h>
406#include <netinet/in.h>
407#include <arpa/nameser.h>
408#include <resolv.h>
409
410int main()
411{
412        ns_initparse( NULL, 0, NULL );
413        ns_parserr( NULL, ns_s_an, 0, NULL );
414}
415'
416RESOLV_NS_TYPES_TESTCODE='
417#include <sys/types.h>
418#include <netinet/in.h>
419#include <arpa/nameser.h>
420
421int main()
422{
423        ns_msg nsh;
424        ns_rr rr;
425
426        /* Not all platforms we want to work on have
427         ns_* routines, so use this to make sure
428         the compiler uses it.*/
429        return (int)(sizeof(nsh) + sizeof(rr));
430}
431'
432
433detect_resolv_dynamic()
434{
435        case "$arch" in
436        OpenBSD )
437                # In FreeBSD res_*/dn_* routines are present in libc.so
438                LIBRESOLV=;;
439        FreeBSD )
440                # In FreeBSD res_*/dn_* routines are present in libc.so
441                LIBRESOLV=;;
442        CYGWIN* )
443                # In Cygwin res_*/dn_* routines are present in libc.so
444                LIBRESOLV=;;
445        * )
446                LIBRESOLV=-lresolv;;
447        esac
448        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
449        ret=1
450        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
451        if [ "$?" = "0" ]; then
452                echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
453                ret=0
454        fi
455
456        rm -f $TMPFILE
457        return $ret
458}
459
460detect_resolv_static()
461{
462        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
463        ret=1
464        for i in $systemlibdirs; do
465                if [ -f $i/libresolv.a ]; then
466                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
467                        if [ "$?" = "0" ]; then
468                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
469                                ret=0
470                        fi
471                fi
472        done
473
474        rm -f $TMPFILE
475        return $ret
476}
477
478detect_resolv_ns_dynamic()
479{
480        case "$arch" in
481        FreeBSD )
482                # In FreeBSD ns_ routines are present in libc.so
483                LIBRESOLV=;;
484        * )
485                LIBRESOLV=-lresolv;;
486        esac
487        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
488        ret=1
489        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
490        if [ "$?" = "0" ]; then
491                ret=0
492        fi
493
494        rm -f $TMPFILE
495        return $ret
496}
497
498detect_resolv_ns_static()
499{
500        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
501        ret=1
502        for i in $systemlibdirs; do
503                if [ -f $i/libresolv.a ]; then
504                        echo "$RESOLV_NS_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
505                        if [ "$?" = "0" ]; then
506                                ret=0
507                        fi
508                fi
509        done
510
511        rm -f $TMPFILE
512        return $ret
513}
514
515detect_nameser_has_ns_types()
516{
517        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
518        ret=1
519        # since we aren't actually linking with ns_* routines
520        # we can just compile the test code
521        echo "$RESOLV_NS_TYPES_TESTCODE" | $CC -o $TMPFILE -x c -  >/dev/null 2>/dev/null
522        if [ "$?" = "0" ]; then
523                ret=0
524        fi
525
526        rm -f $TMPFILE
527        return $ret
528}
529
530if [ "$ssl" = "auto" ]; then
531        detect_gnutls
532        if [ "$ret" = "0" ]; then
533                # Disable NSS for now as it's known to not work very well ATM.
534                #detect_nss
535                :
536        fi
537elif [ "$ssl" = "gnutls" ]; then
538        detect_gnutls
539elif [ "$ssl" = "nss" ]; then
540        detect_nss
541elif [ "$ssl" = "openssl" ]; then
542        echo
543        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
544        echo 'installation of OpenSSL (including devel/header files) before reporting'
545        echo 'compilation problems.'
546        echo
547        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
548        echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported'
549        echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the'
550        echo 'operating system, which makes it GPL-compatible.'
551        echo
552        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
553        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
554        echo
555        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
556        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
557        echo 'package, you really should use GnuTLS instead.'
558        echo
559        echo 'Also, the OpenSSL license requires us to say this:'
560        echo ' *    "This product includes software developed by the OpenSSL Project'
561        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
562       
563        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
564       
565        ret=1
566else
567        echo
568        echo 'ERROR: Unknown SSL library specified.'
569        exit 1
570fi
571
572if [ "$ret" = "0" ]; then
573        echo
574        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
575        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
576        echo '       so if you want to use that, you have to select it by hand.'
577       
578        exit 1
579fi;
580
581echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
582
583if detect_nameser_has_ns_types; then
584        echo '#define NAMESER_HAS_NS_TYPES' >> config.h
585fi
586if detect_resolv_dynamic || detect_resolv_static; then
587        echo '#define HAVE_RESOLV_A' >> config.h
588        if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
589                echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
590        fi
591else
592        echo 'Insufficient resolv routines. Jabber server must be set explicitly'
593fi
594
595
596STORAGES="xml"
597
598for i in $STORAGES; do
599        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
600done
601echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
602
603if [ "$strip" = 0 ]; then
604        echo "STRIP=\# skip strip" >> Makefile.settings;
605else
606        if [ "$debug" = 1 ]; then
607                echo
608                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
609                echo 'STRIP=\# skip strip' >> Makefile.settings
610                strip=0;
611        elif [ -n "$STRIP" ]; then
612                echo "STRIP=$STRIP" >> Makefile.settings;
613        elif type strip > /dev/null 2> /dev/null; then
614                echo "STRIP=strip" >> Makefile.settings;
615        else
616                echo
617                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
618                echo 'STRIP=\# skip strip' >> Makefile.settings
619                strip=0;
620        fi;
621fi
622
623if [ -z "$systemdsystemunitdir" ]; then
624        if $PKG_CONFIG --exists systemd; then
625                systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
626        fi
627fi
628if [ -n "$systemdsystemunitdir" ]; then
629        if [ "$systemdsystemunitdir" != "no" ]; then
630                echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
631        fi
632fi
633
634if [ "$gcov" = "1" ]; then
635        echo "CFLAGS+=--coverage" >> Makefile.settings
636        echo "EFLAGS+=--coverage" >> Makefile.settings
637fi
638
639if [ "$plugins" = 0 ]; then
640        plugindir=""
641        echo '#undef WITH_PLUGINS' >> config.h
642else
643        echo '#define WITH_PLUGINS' >> config.h
644fi
645
646otrprefix=""
647for i in / /usr /usr/local; do
648        if [ -f ${i}/lib/libotr.a ]; then
649                otrprefix=${i}
650                break
651        fi
652done
653if [ "$otr" = "auto" ]; then
654        if [ -n "$otrprefix" ]; then
655                otr=1
656        else
657                otr=0
658        fi
659fi
660if [ "$otr" = 1 ]; then
661        # BI == built-in
662        echo '#define OTR_BI' >> config.h
663        echo "EFLAGS+=-L${otrprefix}/lib -lotr -lgcrypt" >> Makefile.settings
664        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
665        echo 'OTR_BI=otr.o' >> Makefile.settings
666elif [ "$otr" = "plugin" ]; then
667        echo '#define OTR_PI' >> config.h
668        echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
669        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
670        echo 'OTR_PI=otr.so' >> Makefile.settings
671fi
672if [ "$otr" != 0 ] && ! pkg-config libotr --atleast-version=4.0; then
673        echo
674        echo 'WARNING: Your libotr seems to be old. BitlBee now needs at least libotr 4.0.'
675        # Not hard-failing because the code above doesn't use pkg-config, so who knows
676        # what's true at this point...
677fi
678
679if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
680        if [ "$arch" = "Darwin" ]; then
681                echo "SKYPEFLAGS=-dynamiclib -undefined dynamic_lookup" >> Makefile.settings
682        else
683                echo "SKYPEFLAGS=-fPIC -shared" >> Makefile.settings
684        fi
685        echo 'SKYPE_PI=skype.so' >> Makefile.settings
686        protocols_mods="$protocol_mods skype(plugin)"
687fi
688
689if [ -z "$PYTHON" ]; then
690        PYTHON=python
691fi
692
693if [ "$doc" = "1" ]; then
694        # check this here just in case someone tries to install it in python2.4...
695        if ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
696                echo
697                echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
698                echo "(Use the PYTHON environment variable if it's in a weird location)"
699                exit 1
700        fi
701        echo "DOC=1" >> Makefile.settings
702        echo "PYTHON=$PYTHON" >> Makefile.settings
703fi
704
705get_version
706
707if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
708        echo 'Spoofing version number: '$BITLBEE_VERSION
709        echo '#undef BITLBEE_VERSION' >> config.h
710        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
711        echo
712fi
713
714if ! make helloworld > /dev/null 2>&1; then
715        echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
716        echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
717        echo "under the name 'gmake'."
718        echo
719        if gmake helloworld > /dev/null 2>&1; then
720                echo "gmake seems to be available on your machine, great."
721                echo
722        else
723                echo "gmake is not installed (or not working). Please try to install it."
724                echo
725        fi
726fi
727
728cat <<EOF >bitlbee.pc
729prefix=$prefix
730includedir=$includedir
731plugindir=$plugindir
732
733Name: bitlbee
734Description: IRC to IM gateway
735Requires: glib-2.0
736Version: $BITLBEE_VERSION
737Libs:
738Cflags: -I\${includedir}
739
740EOF
741
742protocols=''
743protoobjs=''
744
745if [ "$purple" = 0 ]; then
746        echo '#undef WITH_PURPLE' >> config.h
747else
748        if ! $PKG_CONFIG purple; then
749                echo
750                echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
751                exit 1
752        fi
753        echo '#define WITH_PURPLE' >> config.h
754        cat<<EOF >>Makefile.settings
755EFLAGS += $($PKG_CONFIG purple --libs)
756PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
757EOF
758        protocols=$protocols'purple '
759        protoobjs=$protoobjs'purple_mod.o '
760
761        # only disable these if the user didn't enable them explicitly
762        [ "$msn" = "default-on" ] && msn=0
763        [ "$jabber" = "default-on" ] && jabber=0
764        [ "$oscar" = "default-on" ] && oscar=0
765        [ "$yahoo" = "default-on" ] && yahoo=0
766
767        echo '#undef PACKAGE' >> config.h
768        echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
769       
770        if [ "$events" = "libevent" ]; then
771                echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
772                echo 'outside libpurple, talking to GLib directly. At least for now the combination'
773                echo 'libpurple + libevent is *not* recommended!'
774                echo
775        fi
776fi
777
778case "$CC" in
779*gcc* )
780        echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings
781        for i in . lib tests protocols protocols/*/; do
782                mkdir -p $i/.depend
783        done
784esac
785
786if [ "$msn" = 0 ]; then
787        echo '#undef WITH_MSN' >> config.h
788else
789        echo '#define WITH_MSN' >> config.h
790        protocols=$protocols'msn '
791        protoobjs=$protoobjs'msn_mod.o '
792fi
793
794if [ "$jabber" = 0 ]; then
795        echo '#undef WITH_JABBER' >> config.h
796else
797        echo '#define WITH_JABBER' >> config.h
798        protocols=$protocols'jabber '
799        protoobjs=$protoobjs'jabber_mod.o '
800fi
801
802if [ "$oscar" = 0 ]; then
803        echo '#undef WITH_OSCAR' >> config.h
804else
805        echo '#define WITH_OSCAR' >> config.h
806        protocols=$protocols'oscar '
807        protoobjs=$protoobjs'oscar_mod.o '
808fi
809
810if [ "$yahoo" = 0 ]; then
811        echo '#undef WITH_YAHOO' >> config.h
812else
813        echo '#define WITH_YAHOO' >> config.h
814        protocols=$protocols'yahoo '
815        protoobjs=$protoobjs'yahoo_mod.o '
816fi
817
818if [ "$twitter" = 0 ]; then
819        echo '#undef WITH_TWITTER' >> config.h
820else
821        echo '#define WITH_TWITTER' >> config.h
822        protocols=$protocols'twitter '
823        protoobjs=$protoobjs'twitter_mod.o '
824fi
825
826if [ "$rpc" = 0 ]; then
827        echo '#undef WITH_RPC' >> config.h
828else
829        echo '#define WITH_RPC' >> config.h
830        protocols=$protocols'rpc '
831        protoobjs=$protoobjs'rpc_mod.o '
832fi
833
834if [ "$protocols" = "PROTOCOLS = " ]; then
835        echo "Warning: You haven't selected any communication protocol to compile!"
836        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
837fi
838
839echo "PROTOCOLS = $protocols" >> Makefile.settings
840echo "PROTOOBJS = $protoobjs" >> Makefile.settings
841
842echo Architecture: $arch
843case "$arch" in
844Linux )
845;;
846GNU/* )
847;;
848*BSD )
849;;
850Darwin )
851        echo 'STRIP=\# skip strip' >> Makefile.settings
852;;
853IRIX )
854;;
855SunOS )
856        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
857        echo 'STRIP=\# skip strip' >> Makefile.settings
858        echo '#define NO_FD_PASSING' >> config.h
859;;
860AIX )
861        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
862;;
863CYGWIN* )
864;;
865Windows )
866        echo 'Native windows compilation is not supported anymore, use cygwin instead.'
867;;
868* )
869        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
870        echo 'Please report any problems at http://bugs.bitlbee.org/.'
871;;
872esac
873
874if [ -n "$target" ]; then
875        echo "Cross-compiling for: $target"
876fi
877
878echo
879echo 'Configuration done:'
880
881if [ "$debug" = "1" ]; then
882        echo '  Debugging enabled.'
883else
884        echo '  Debugging disabled.'
885fi
886
887if [ "$asan" = "1" ]; then
888        echo '  AddressSanitizer (ASAN) enabled.'
889else
890        echo '  AddressSanitizer (ASAN) disabled.'
891fi
892
893if [ "$pie" = "1" ]; then
894        echo '  Building PIE executable'
895else
896        echo '  Building non-PIE executable'
897fi
898
899if [ "$strip" = "1" ]; then
900        echo '  Binary stripping enabled.'
901else
902        echo '  Binary stripping disabled.'
903fi
904
905if [ "$otr" = "1" ]; then
906        echo '  Off-the-Record (OTR) Messaging enabled.'
907elif [ "$otr" = "plugin" ]; then
908        echo '  Off-the-Record (OTR) Messaging enabled (as a plugin).'
909else
910        echo '  Off-the-Record (OTR) Messaging disabled.'
911fi
912
913if [ -n "$systemdsystemunitdir" ]; then
914        echo '  systemd enabled.'
915else
916        echo '  systemd disabled.'
917fi
918
919echo '  Using event handler: '$events
920echo '  Using SSL library: '$ssl
921#echo '  Building with these storage backends: '$STORAGES
922
923if [ -n "$protocols" ]; then
924        echo '  Building with these protocols:' $protocols$protocols_mods
925        case "$protocols" in
926        *purple*)
927                echo "    Note that BitlBee-libpurple is supported on a best-effort basis. It's"
928                echo "    not *fully* compatible with normal BitlBee. Don't use it unless you"
929                echo "    absolutely need it (i.e. support for a certain protocol or feature)."
930        esac
931else
932        echo '  Building without IM-protocol support. We wish you a lot of fun...'
933fi
Note: See TracBrowser for help on using the repository browser.