source: configure @ 840394e

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

Fix compiler warnings on Cygwin and Mac OS X.

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