source: configure @ beb0f54

Last change on this file since beb0f54 was beb0f54, checked in by dequis <dx@…>, at 2015-05-17T04:13:30Z

configure: Replace xmlto/xsltproc checks with a python>=2.5 check

It actually checks that xml.etree.ElementTree can be imported, which is
good enough.

The script works fine in 2.5 (tested with centos 6), and doesn't work
in 2.4 but we don't support centos 5 anymore so no problem there.

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