source: configure @ 50bb490

Last change on this file since 50bb490 was 50bb490, checked in by Dennis Kaarsemaker <dennis@…>, at 2016-03-25T18:07:53Z

ldap authentication backend

We only support the openldap scheme for now, with users that are
posixAccounts. Moreover, as the plugin cannot be configured directly,
you must configure libldap correctly in /etc/openldap/ldap.conf

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