source: configure @ d348377

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

Add -lgcrypt when building with OTR built-in

Needed when building without gnutls (which already depends on gcrypt)

  • Property mode set to 100755
File size: 21.5 KB
RevLine 
[b7d3cc34]1#!/bin/sh
2
3##############################
4##  Configurer for BitlBee  ##
5##                          ##
6##  Copyright 2004 Lintux   ##
7##  Copyright 2002 Lucumo   ##
8##############################
9
10prefix='/usr/local/'
[57da960]11bindir='$prefix/bin/'
12sbindir='$prefix/sbin/'
[b7d3cc34]13etcdir='$prefix/etc/bitlbee/'
14mandir='$prefix/share/man/'
15datadir='$prefix/share/bitlbee/'
16config='/var/lib/bitlbee/'
[85cf37f]17plugindir='$prefix/lib/bitlbee/'
18includedir='$prefix/include/bitlbee/'
[417002e]19systemdsystemunitdir=''
[85cf37f]20libevent='/usr/'
[34b17d9]21pidfile='/var/run/bitlbee.pid'
[4c225f0]22ipcsocket=''
[e506d6c]23pcdir='$prefix/lib/pkgconfig'
[25b80e9c]24systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
[b7d3cc34]25
[04e2a05]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
[1b221e0]36twitter=1
[04dc563]37purple=0
[b7d3cc34]38
39debug=0
40strip=1
[66b9e86e]41gcov=0
[2abfbc5]42plugins=1
[04f0c10]43otr=0
[370899f]44skype=0
[85cf37f]45
46events=glib
[b7d3cc34]47ssl=auto
48
[7281ad1]49pie=1
50
[b7d3cc34]51arch=`uname -s`
52cpu=`uname -m`
53
[74c5718]54GLIB_MIN_VERSION=2.14
[670204f]55
[b7d3cc34]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
[57da960]69--sbindir=...                                           $sbindir
[b7d3cc34]70--etcdir=...                                            $etcdir
71--mandir=...                                            $mandir
72--datadir=...                                           $datadir
[7b23afd]73--plugindir=...                                         $plugindir
[417002e]74--systemdsystemunitdir=...                              $systemdsystemunitdir
[34b17d9]75--pidfile=...                                           $pidfile
[b7d3cc34]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
[4aa0f6b]82--twitter=0/1   Disable/enable Twitter part             $twitter
[b7d3cc34]83
[796da03]84--purple=0/1    Disable/enable libpurple support        $purple
[04f0c10]85                (automatically disables other protocol modules)
[b7d3cc34]86
87--debug=0/1     Disable/enable debugging                $debug
88--strip=0/1     Disable/enable binary stripping         $strip
[7281ad1]89--pie=0/1       Build position independent executable   $pie
[66b9e86e]90--gcov=0/1      Disable/enable test coverage reporting  $gcov
[2abfbc5]91--plugins=0/1   Disable/enable plugins support          $plugins
[04f0c10]92--otr=0/1/auto/plugin
93                Disable/enable OTR encryption support   $otr
[17f6079]94--skype=0/1/plugin
[370899f]95                Disable/enable Skype support            $skype
[b7d3cc34]96
[85cf37f]97--events=...    Event handler (glib, libevent)          $events
[e1d3f98]98--ssl=...       SSL library to use (gnutls, nss, openssl, auto)
[b7d3cc34]99                                                        $ssl
[aec56b0]100
[7281ad1]101
[f1e7407]102--target=...    Cross compilation target                same as host
[b7d3cc34]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'`
[57da960]112sbindir=`eval echo "$sbindir/" | sed 's/\/\{1,\}/\//g'`
[b7d3cc34]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'`
[7b23afd]117plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
[85cf37f]118includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
119libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
120
[6dff9d4]121pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
122ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
[e506d6c]123pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
[b7d3cc34]124
[17f6079]125protocols_mods=""
126
[b95b0c8]127cat <<EOF >Makefile.settings
[b7d3cc34]128## BitlBee settings, generated by configure
129PREFIX=$prefix
130BINDIR=$bindir
[57da960]131SBINDIR=$sbindir
[b7d3cc34]132ETCDIR=$etcdir
133MANDIR=$mandir
134DATADIR=$datadir
[7b23afd]135PLUGINDIR=$plugindir
[b7d3cc34]136CONFIG=$config
[e506d6c]137INCLUDEDIR=$includedir
138PCDIR=$pcdir
[b7d3cc34]139
[1bf9492]140TARGET=$target
[b7d3cc34]141ARCH=$arch
142CPU=$cpu
143
[25b80e9c]144INSTALL=install -p
145
[b7d3cc34]146DESTDIR=
147LFLAGS=
[7a80925]148EFLAGS=-lm
[b7d3cc34]149EOF
150
[1074806]151srcdir=$(cd $(dirname $0);pwd)
152currdir=$(pwd)
153if [ "$srcdir" != "$currdir" ]; then 
[f60079b]154        echo
155        echo "configure script run from a different directory. Will create some symlinks..."
156        if [ ! -e Makefile -o -L Makefile ]; then
[04dc563]157                COPYDIRS="doc lib protocols tests utils"
158                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
[f60079b]159                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
160                dst="$PWD"
161                cd "$srcdir"
[04dc563]162                for i in $(find . -name Makefile -type f); do
[f60079b]163                        ln -s "$PWD${i#.}" "$dst/$i";
164                done
165                cd "$dst"
166                rm -rf .bzr
167        fi
168       
[7fa5c19]169        echo "_SRCDIR_=$srcdir/" >> Makefile.settings
[f60079b]170        CFLAGS="$CFLAGS -I${dst}"
171else
172        srcdir=$PWD
173fi
174
[b95b0c8]175cat<<EOF >config.h
[b7d3cc34]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"
[7b23afd]184#define PLUGINDIR "$plugindir"
[34b17d9]185#define PIDFILE "$pidfile"
[6dff9d4]186#define IPCSOCKET "$ipcsocket"
[b7d3cc34]187#define ARCH "$arch"
188#define CPU "$cpu"
189EOF
190
[1bf9492]191
192
[f1e7407]193if [ -n "$target" ]; then
[1bf9492]194        PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
195        export PKG_CONFIG_LIBDIR
[f1e7407]196        PATH=/usr/$target/bin:$PATH
197        CC=$target-cc
198        LD=$target-ld
[1bf9492]199        systemlibdirs="/usr/$target/lib"
[f1e7407]200fi
201
[1bf9492]202
[b7d3cc34]203if [ "$debug" = "1" ]; then
204        echo 'DEBUG=1' >> Makefile.settings
[4dda9e4]205        CFLAGS="$CFLAGS -g -DDEBUG"
[b7d3cc34]206else
[56f260a]207        [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
[b7d3cc34]208fi
209
[7281ad1]210if [ "$pie" = "1" ]; then
211        echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings
212        echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings
213fi
214
[d203495]215echo LDFLAGS=$LDFLAGS >> Makefile.settings
216
[daae10f]217echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
[f60079b]218echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
[b7d3cc34]219
[41a94dd]220echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
[f712188]221
[b7d3cc34]222if [ -n "$CC" ]; then
[5973412]223        CC=$CC
[b7d3cc34]224elif type gcc > /dev/null 2> /dev/null; then
[5973412]225        CC=gcc
[b7d3cc34]226elif type cc > /dev/null 2> /dev/null; then
[5973412]227        CC=cc
[b7d3cc34]228else
229        echo 'Cannot find a C compiler, aborting.'
230        exit 1;
231fi
232
[5973412]233echo "CC=$CC" >> Makefile.settings;
[daae10f]234if echo $CC | grep -qw gcc; then
235        # Apparently -Wall is gcc-specific?
236        echo CFLAGS+=-Wall >> Makefile.settings
237fi
[5973412]238
[f1e7407]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
[b7d3cc34]246fi
247
[f1e7407]248echo "LD=$LD" >> Makefile.settings
249
[32c632f]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
[670204f]255        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
[b95b0c8]256                cat<<EOF >>Makefile.settings
[32c632f]257EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
258CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
[b7d3cc34]259EOF
[670204f]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
[b7d3cc34]265else
[670204f]266        echo
[574af7e]267        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
[670204f]268        exit 1
[b7d3cc34]269fi
270
[85cf37f]271if [ "$events" = "libevent" ]; then
[003553b]272        if ! [ -f "${libevent}include/event.h" ]; then
[85cf37f]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
[b95b0c8]280        cat <<EOF >>Makefile.settings
[85cf37f]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
[b7d3cc34]287else
288        echo
[85cf37f]289        echo 'ERROR: Unknown event handler specified.'
290        exit 1
[b7d3cc34]291fi
[85cf37f]292echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
[b7d3cc34]293
294detect_gnutls()
295{
[4af7b4f]296        if $PKG_CONFIG --exists gnutls; then
[b95b0c8]297                cat <<EOF >>Makefile.settings
[83e47ec]298EFLAGS+=`$PKG_CONFIG --libs gnutls` `libgcrypt-config --libs`
299CFLAGS+=`$PKG_CONFIG --cflags gnutls` `libgcrypt-config --cflags`
[4af7b4f]300EOF
301                ssl=gnutls
[5513f3e]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
[4af7b4f]306                ret=1
307        elif libgnutls-config --version > /dev/null 2> /dev/null; then
[b95b0c8]308                cat <<EOF >>Makefile.settings
[83e47ec]309EFLAGS+=`libgnutls-config --libs` `libgcrypt-config --libs`
310CFLAGS+=`libgnutls-config --cflags` `libgcrypt-config --cflags`
[b7d3cc34]311EOF
312               
313                ssl=gnutls
314                ret=1;
315        else
316                ret=0;
317        fi;
318}
319
320detect_nss()
321{
[ef043d3]322        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
[b95b0c8]323                cat<<EOF >>Makefile.settings
[ef043d3]324EFLAGS+=`$PKG_CONFIG --libs nss`
325CFLAGS+=`$PKG_CONFIG --cflags nss`
[b7d3cc34]326EOF
327               
328                ssl=nss
329                ret=1;
330        else
331                ret=0;
332        fi;
333}
334
[36cf9fd]335RESOLV_TESTCODE='
[aee8c19]336#include <sys/types.h>
337#include <netinet/in.h>
[36cf9fd]338#include <arpa/nameser.h>
339#include <resolv.h>
340
[632627e]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
[36cf9fd]355int main()
356{
357        ns_initparse( NULL, 0, NULL );
358        ns_parserr( NULL, ns_s_an, 0, NULL );
359}
360'
[632627e]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
[fb87924]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));
[632627e]375}
376'
[36cf9fd]377
378detect_resolv_dynamic()
379{
[aee8c19]380        case "$arch" in
[632627e]381        OpenBSD )
382                # In FreeBSD res_*/dn_* routines are present in libc.so
383                LIBRESOLV=;;
[aee8c19]384        FreeBSD )
[632627e]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
[aee8c19]389                LIBRESOLV=;;
390        * )
391                LIBRESOLV=-lresolv;;
392        esac
[4fca1db]393        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
[8462239]394        ret=1
[aee8c19]395        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
[36cf9fd]396        if [ "$?" = "0" ]; then
[aee8c19]397                echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
[8462239]398                ret=0
[36cf9fd]399        fi
400
[8462239]401        rm -f $TMPFILE
402        return $ret
[36cf9fd]403}
404
405detect_resolv_static()
406{
[4fca1db]407        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
[8462239]408        ret=1
[36cf9fd]409        for i in $systemlibdirs; do
410                if [ -f $i/libresolv.a ]; then
[8462239]411                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
[36cf9fd]412                        if [ "$?" = "0" ]; then
413                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
[8462239]414                                ret=0
[36cf9fd]415                        fi
416                fi
417        done
418
[8462239]419        rm -f $TMPFILE
420        return $ret
[36cf9fd]421}
422
[632627e]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{
[fb87924]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
[632627e]469    fi
470
[fb87924]471    rm -f $TMPFILE
472    return $ret
[632627e]473}
474
[b3c467b]475if [ "$ssl" = "auto" ]; then
476        detect_gnutls
[b7d3cc34]477        if [ "$ret" = "0" ]; then
[c5920df]478                # Disable NSS for now as it's known to not work very well ATM.
479                #detect_nss
[191cfb1]480                :
[b7d3cc34]481        fi
[b3c467b]482elif [ "$ssl" = "gnutls" ]; then
483        detect_gnutls
484elif [ "$ssl" = "nss" ]; then
485        detect_nss
[85d7b85]486elif [ "$ssl" = "sspi" ]; then
487        echo
[b3c467b]488elif [ "$ssl" = "openssl" ]; then
489        echo
490        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
[b3eee9b]491        echo 'installation of OpenSSL (including devel/header files) before reporting'
[b3c467b]492        echo 'compilation problems.'
493        echo
494        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
[b3eee9b]495        echo 'completely GPL-compatible. Using GnuTLS is recommended and better supported'
496        echo 'by us. However, on many BSD machines, OpenSSL can be considered part of the'
497        echo 'operating system, which makes it GPL-compatible.'
[b3c467b]498        echo
499        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
500        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
501        echo
502        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
503        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
[b3eee9b]504        echo 'package, you really should use GnuTLS instead.'
[b3c467b]505        echo
506        echo 'Also, the OpenSSL license requires us to say this:'
507        echo ' *    "This product includes software developed by the OpenSSL Project'
508        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
[b7d3cc34]509       
[b3c467b]510        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
511       
512        ret=1
513else
514        echo
515        echo 'ERROR: Unknown SSL library specified.'
516        exit 1
[b7d3cc34]517fi
518
[b3c467b]519if [ "$ret" = "0" ]; then
520        echo
521        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
522        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
[e1d3f98]523        echo '       so if you want to use that, you have to select it by hand.'
[b7d3cc34]524       
[b3c467b]525        exit 1
526fi;
527
528echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
529
[632627e]530if detect_nameser_has_ns_types; then
531        echo '#define NAMESER_HAS_NS_TYPES' >> config.h
532fi
[36cf9fd]533if detect_resolv_dynamic || detect_resolv_static; then
534        echo '#define HAVE_RESOLV_A' >> config.h
[632627e]535    if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
536            echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
537    fi
538else
539    echo 'Insufficient resolv routines. Jabber server must be set explicitly'
[36cf9fd]540fi
[36e9f62]541
[632627e]542
[ba7d16f]543STORAGES="xml"
[b3c467b]544
545for i in $STORAGES; do
546        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
547done
548echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
549
[b7d3cc34]550if [ "$strip" = 0 ]; then
551        echo "STRIP=\# skip strip" >> Makefile.settings;
552else
553        if [ "$debug" = 1 ]; then
554                echo
555                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
556                echo 'STRIP=\# skip strip' >> Makefile.settings
557                strip=0;
558        elif [ -n "$STRIP" ]; then
559                echo "STRIP=$STRIP" >> Makefile.settings;
560        elif type strip > /dev/null 2> /dev/null; then
561                echo "STRIP=strip" >> Makefile.settings;
562        else
563                echo
564                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
565                echo 'STRIP=\# skip strip' >> Makefile.settings
566                strip=0;
567        fi;
568fi
569
[417002e]570if [ -z "$systemdsystemunitdir" ]; then
571        if $PKG_CONFIG --exists systemd; then
572                systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd`
573        fi
574fi
575if [ -n "$systemdsystemunitdir" ]; then
576        if [ "$systemdsystemunitdir" != "no" ]; then
577                echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
578        fi
579fi
580
[66b9e86e]581if [ "$gcov" = "1" ]; then
[31fc3970]582        echo "CFLAGS+=--coverage" >> Makefile.settings
583        echo "EFLAGS+=--coverage" >> Makefile.settings
[66b9e86e]584fi
585
[2abfbc5]586if [ "$plugins" = 0 ]; then
[489847f]587        plugindir=""
[2abfbc5]588        echo '#undef WITH_PLUGINS' >> config.h
589else
590        echo '#define WITH_PLUGINS' >> config.h
591fi
592
[6738a67]593otrprefix=""
594for i in / /usr /usr/local; do
595        if [ -f ${i}/lib/libotr.a ]; then
596                otrprefix=${i}
597                break
598        fi
599done
[764c7d1]600if [ "$otr" = "auto" ]; then
[6738a67]601        if [ -n "$otrprefix" ]; then
602                otr=1
603        else
604                otr=0
605        fi
[764c7d1]606fi
[6738a67]607if [ "$otr" = 1 ]; then
[858ea01]608        # BI == built-in
609        echo '#define OTR_BI' >> config.h
[d348377]610        echo "EFLAGS+=-L${otrprefix}/lib -lotr -lgcrypt" >> Makefile.settings
[6738a67]611        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
[858ea01]612        echo 'OTR_BI=otr.o' >> Makefile.settings
613elif [ "$otr" = "plugin" ]; then
614        echo '#define OTR_PI' >> config.h
615        echo "OTRFLAGS=-L${otrprefix}/lib -lotr" >> Makefile.settings
616        echo "CFLAGS+=-I${otrprefix}/include" >> Makefile.settings
617        echo 'OTR_PI=otr.so' >> Makefile.settings
[764c7d1]618fi
[a8aa823]619if [ "$otr" != 0 ] && ! pkg-config libotr --atleast-version=4.0; then
620        echo
621        echo 'WARNING: Your libotr seems to be old. BitlBee now needs at least libotr 4.0.'
622        # Not hard-failing because the code above doesn't use pkg-config, so who knows
623        # what's true at this point...
624fi
[764c7d1]625
[17f6079]626if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
[b2b7f52]627        if [ "$arch" = "Darwin" ]; then
628                echo "SKYPEFLAGS=-dynamiclib -undefined dynamic_lookup" >> Makefile.settings
629        else
630                echo "SKYPEFLAGS=-fPIC -shared" >> Makefile.settings
631        fi
[370899f]632        echo 'SKYPE_PI=skype.so' >> Makefile.settings
[17f6079]633        protocols_mods="$protocol_mods skype(plugin)"
[370899f]634fi
635
[ceebeb1]636if [ ! -e doc/user-guide/help.txt ] && ! type xmlto > /dev/null 2> /dev/null; then
637        echo
638        echo 'WARNING: Building from an unreleased source tree without prebuilt helpfile.'
639        echo 'Install xmlto if you want online help to work.'
640fi
641
[f287f04]642REAL_BITLBEE_VERSION=`grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/'`
[ffea9b9]643echo
[a014331]644if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
645        nick=`bzr nick`
646        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
647                nick="-$nick"
648        else
649                nick=""
650        fi
[ffea9b9]651        rev=`bzr revno`
652        echo 'Using bzr revision #'$rev' as version number'
[f287f04]653        BITLBEE_VERSION=$REAL_BITLBEE_VERSION-bzr$nick-$rev
[b7d3cc34]654fi
655
656if [ -n "$BITLBEE_VERSION" ]; then
657        echo 'Spoofing version number: '$BITLBEE_VERSION
658        echo '#undef BITLBEE_VERSION' >> config.h
[f287f04]659        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
[ffea9b9]660        echo
[f287f04]661else
662        # for pkg-config
663        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
[b7d3cc34]664fi
665
[4fca1db]666if ! make helloworld > /dev/null 2>&1; then
667        echo "WARNING: Your version of make (BSD make?) does not support BitlBee's makefiles."
668        echo "BitlBee needs GNU make to build properly. On most systems GNU make is available"
669        echo "under the name 'gmake'."
670        echo
671        if gmake helloworld > /dev/null 2>&1; then
672                echo "gmake seems to be available on your machine, great."
673                echo
674        else
675                echo "gmake is not installed (or not working). Please try to install it."
676                echo
677        fi
678fi
679
[b95b0c8]680cat <<EOF >bitlbee.pc
[e506d6c]681prefix=$prefix
682includedir=$includedir
[489847f]683plugindir=$plugindir
[e506d6c]684
685Name: bitlbee
686Description: IRC to IM gateway
687Requires: glib-2.0
688Version: $BITLBEE_VERSION
689Libs:
690Cflags: -I\${includedir}
691
692EOF
693
[b7d3cc34]694protocols=''
695protoobjs=''
696
[e248c7f]697if [ "$purple" = 0 ]; then
698        echo '#undef WITH_PURPLE' >> config.h
699else
[e08e53c]700        if ! $PKG_CONFIG purple; then
701                echo
702                echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
703                exit 1
704        fi
[e248c7f]705        echo '#define WITH_PURPLE' >> config.h
[b95b0c8]706        cat<<EOF >>Makefile.settings
[e08e53c]707EFLAGS += $($PKG_CONFIG purple --libs)
708PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
709EOF
[e248c7f]710        protocols=$protocols'purple '
711        protoobjs=$protoobjs'purple_mod.o '
712
[04e2a05]713        # only disable these if the user didn't enable them explicitly
714        [ "$msn" = "default-on" ] && msn=0
715        [ "$jabber" = "default-on" ] && jabber=0
716        [ "$oscar" = "default-on" ] && oscar=0
717        [ "$yahoo" = "default-on" ] && yahoo=0
[18e1f3b]718
719        echo '#undef PACKAGE' >> config.h
720        echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
[bda2975]721       
722        if [ "$events" = "libevent" ]; then
723                echo 'Warning: Some libpurple modules (including msn-pecan) do their event handling'
724                echo 'outside libpurple, talking to GLib directly. At least for now the combination'
725                echo 'libpurple + libevent is *not* recommended!'
[c775a58]726                echo
[bda2975]727        fi
[e248c7f]728fi
729
[b0a89cc]730case "$CC" in
731*gcc* )
[e371011]732        echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings
[fe92921]733        for i in . lib tests protocols protocols/*/; do
[b0a89cc]734                mkdir -p $i/.depend
735        done
736esac
737
[b7d3cc34]738if [ "$msn" = 0 ]; then
739        echo '#undef WITH_MSN' >> config.h
740else
741        echo '#define WITH_MSN' >> config.h
742        protocols=$protocols'msn '
[b5a22e3]743        protoobjs=$protoobjs'msn_mod.o '
[b7d3cc34]744fi
745
746if [ "$jabber" = 0 ]; then
747        echo '#undef WITH_JABBER' >> config.h
748else
749        echo '#define WITH_JABBER' >> config.h
750        protocols=$protocols'jabber '
[b5a22e3]751        protoobjs=$protoobjs'jabber_mod.o '
[b7d3cc34]752fi
753
754if [ "$oscar" = 0 ]; then
755        echo '#undef WITH_OSCAR' >> config.h
756else
757        echo '#define WITH_OSCAR' >> config.h
758        protocols=$protocols'oscar '
[b5a22e3]759        protoobjs=$protoobjs'oscar_mod.o '
[b7d3cc34]760fi
761
762if [ "$yahoo" = 0 ]; then
763        echo '#undef WITH_YAHOO' >> config.h
764else
765        echo '#define WITH_YAHOO' >> config.h
766        protocols=$protocols'yahoo '
[b5a22e3]767        protoobjs=$protoobjs'yahoo_mod.o '
[b7d3cc34]768fi
769
[1b221e0]770if [ "$twitter" = 0 ]; then
771        echo '#undef WITH_TWITTER' >> config.h
772else
773        echo '#define WITH_TWITTER' >> config.h
774        protocols=$protocols'twitter '
775        protoobjs=$protoobjs'twitter_mod.o '
776fi
777
[b7d3cc34]778if [ "$protocols" = "PROTOCOLS = " ]; then
[43462708]779        echo "Warning: You haven't selected any communication protocol to compile!"
[b3c467b]780        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
[b7d3cc34]781fi
782
783echo "PROTOCOLS = $protocols" >> Makefile.settings
784echo "PROTOOBJS = $protoobjs" >> Makefile.settings
785
786echo Architecture: $arch
787case "$arch" in
788Linux )
789;;
790GNU/* )
791;;
792*BSD )
793;;
794Darwin )
[caceb06]795        echo 'STRIP=\# skip strip' >> Makefile.settings
[b7d3cc34]796;;
797IRIX )
798;;
799SunOS )
800        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
801        echo 'STRIP=\# skip strip' >> Makefile.settings
[70d7795]802        echo '#define NO_FD_PASSING' >> config.h
[b7d3cc34]803;;
[8de63c3]804AIX )
805        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
[b7d3cc34]806;;
807CYGWIN* )
808        echo 'Cygwin is not officially supported.'
809;;
[aec56b0]810Windows )
811;;
[b7d3cc34]812* )
[8d6c4b1]813        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
814        echo 'Please report any problems at http://bugs.bitlbee.org/.'
[b7d3cc34]815;;
816esac
817
[f1e7407]818if [ -n "$target" ]; then
819        echo "Cross-compiling for: $target"
820fi
821
[b7d3cc34]822echo
823echo 'Configuration done:'
824
825if [ "$debug" = "1" ]; then
[b3c467b]826        echo '  Debugging enabled.'
[b7d3cc34]827else
[b3c467b]828        echo '  Debugging disabled.'
[b7d3cc34]829fi
830
[7281ad1]831if [ "$pie" = "1" ]; then
832        echo '  Building PIE executable'
833else
834        echo '  Building non-PIE executable'
835fi
836
[b7d3cc34]837if [ "$strip" = "1" ]; then
[b3c467b]838        echo '  Binary stripping enabled.'
[b7d3cc34]839else
[b3c467b]840        echo '  Binary stripping disabled.'
[b7d3cc34]841fi
842
[764c7d1]843if [ "$otr" = "1" ]; then
844        echo '  Off-the-Record (OTR) Messaging enabled.'
[858ea01]845elif [ "$otr" = "plugin" ]; then
846        echo '  Off-the-Record (OTR) Messaging enabled (as a plugin).'
[764c7d1]847else
848        echo '  Off-the-Record (OTR) Messaging disabled.'
849fi
850
[417002e]851if [ -n "$systemdsystemunitdir" ]; then
852        echo '  systemd enabled.'
853else
854        echo '  systemd disabled.'
855fi
856
[b3c467b]857echo '  Using event handler: '$events
858echo '  Using SSL library: '$ssl
[4e3df8a]859#echo '  Building with these storage backends: '$STORAGES
[b7d3cc34]860
861if [ -n "$protocols" ]; then
[17f6079]862        echo '  Building with these protocols:' $protocols$protocols_mods
[4e3df8a]863        case "$protocols" in
864        *purple*)
865                echo "    Note that BitlBee-libpurple is supported on a best-effort basis. It's"
866                echo "    not *fully* compatible with normal BitlBee. Don't use it unless you"
867                echo "    absolutely need it (i.e. support for a certain protocol or feature)."
868        esac
[b7d3cc34]869else
[b3c467b]870        echo '  Building without IM-protocol support. We wish you a lot of fun...'
[b7d3cc34]871fi
Note: See TracBrowser for help on using the repository browser.