source: configure @ a6cd799

Last change on this file since a6cd799 was 25c4c78, checked in by dequis <dx@…>, at 2015-01-16T19:50:24Z

Fix compiler warnings on Cygwin and Mac OS X.

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