source: configure @ 531eabd

Last change on this file since 531eabd was 3434a8c, checked in by Wilmer van der Gaast <wilmer@…>, at 2015-02-25T23:25:37Z

Makefile update for RPC stuff.

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