source: configure @ b09ce17

Last change on this file since b09ce17 was b1dc403, checked in by Wilmer van der Gaast <wilmer@…>, at 2015-05-04T21:58:50Z

Catch up with master.

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