source: configure @ 1dcbd3e

Last change on this file since 1dcbd3e was 7ec2ce8, checked in by dequis <dx@…>, at 2018-01-10T03:05:23Z

Remove MSN. Use the skypeweb purple plugin instead.

RIP

As per http://ismsndeadyet.com/ all versions up to MSNP22 died a few
months ago. We had a MSNP21 implementation, bought us two extra years.

Implementing MSNP24 is technically possible but also pointless given
skypeweb, and the authentication requires some fairly messed up crypto
and legacy old-skype-protocol servers. For a long time I tried to
reverse a potentially simpler method, and got fairly close, but never
completed that. I haven't done any attempts to continue it in the last
year, so I'm fine with giving up at this point.

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