source: configure @ a6005da

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

Linux pam authentication backend

This backend authenticates users against pam.

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