source: configure @ e252d8c

Last change on this file since e252d8c was e252d8c, checked in by dequis <dx@…>, at 2014-09-27T14:54:35Z

RIP native win32 support (use cygwin instead)

It has been broken for a very long time and nobody cared about it.

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