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
Line 
1#!/bin/sh
2
3##############################
4##  Configurer for BitlBee  ##
5##                          ##
6##  Copyright 2004 Lintux   ##
7##  Copyright 2002 Lucumo   ##
8##############################
9
10prefix='/usr/local/'
11bindir='$prefix/bin/'
12sbindir='$prefix/sbin/'
13etcdir='$prefix/etc/bitlbee/'
14mandir='$prefix/share/man/'
15datadir='$prefix/share/bitlbee/'
16config='/var/lib/bitlbee/'
17plugindir='$prefix/lib/bitlbee/'
18includedir='$prefix/include/bitlbee/'
19systemdsystemunitdir=''
20libevent='/usr/'
21pidfile='/var/run/bitlbee.pid'
22ipcsocket=''
23pcdir='$prefix/lib/pkgconfig'
24systemlibdirs="/lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib"
25sysroot=''
26
27configure_args="$@"
28
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
39twitter=1
40purple=0
41
42doc=1
43debug=0
44strip=1
45gcov=0
46asan=0
47plugins=1
48otr=0
49skype=0
50
51events=glib
52ssl=auto
53
54pam=0
55
56pie=1
57
58arch=$(uname -s)
59cpu=$(uname -m)
60
61GLIB_MIN_VERSION=2.16
62
63# Cygwin and Darwin don't support PIC/PIE
64case "$arch" in
65        CYGWIN* )
66                pie=0;;
67        Darwin )
68                pie=0;;
69esac
70
71get_version() {
72        REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
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
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
86                search='\(.*\)-\([0-9]*\)-\(g[0-9a-f]*\)'
87                replace="\1+$timestamp+$branch+\2-\3-git"
88
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
93
94                BITLBEE_VERSION=$(echo $describe | sed "s#$search#$replace#")
95
96                unset timestamp branch search replace describe
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
109while [ -n "$1" ]; do
110        e="$(expr "X$1" : 'X--\(.*=.*\)')"
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
120--sbindir=...                                           $sbindir
121--etcdir=...                                            $etcdir
122--mandir=...                                            $mandir
123--datadir=...                                           $datadir
124--plugindir=...                                         $plugindir
125--systemdsystemunitdir=...                              $systemdsystemunitdir
126--pidfile=...                                           $pidfile
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
133--twitter=0/1   Disable/enable Twitter part             $twitter
134
135--purple=0/1    Disable/enable libpurple support        $purple
136                (automatically disables other protocol modules)
137
138--pam=0/1       Disable/enable PAM authentication       $pam
139
140--doc=0/1       Disable/enable help.txt generation      $doc
141--debug=0/1     Disable/enable debugging                $debug
142--strip=0/1     Disable/enable binary stripping         $strip
143--pie=0/1       Build position independent executable   $pie
144--gcov=0/1      Disable/enable test coverage reporting  $gcov
145--asan=0/1      Disable/enable AddressSanitizer         $asan
146--plugins=0/1   Disable/enable plugins support          $plugins
147--otr=0/1/auto/plugin
148                Disable/enable OTR encryption support   $otr
149--skype=0/1/plugin
150                Disable/enable Skype support            $skype
151
152--events=...    Event handler (glib, libevent)          $events
153--ssl=...       SSL library to use (gnutls, nss, openssl, auto)
154                                                        $ssl
155
156
157--target=...    Cross compilation target                same as host
158--sysroot=...   Cross compilation sysroot               $sysroot
159EOF
160                exit;
161        fi
162        eval "$e"
163        shift;
164done
165
166# Expand $prefix and get rid of double slashes
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')
180
181protocols_mods=""
182
183cat <<EOF >Makefile.settings
184## BitlBee settings, generated by configure
185
186# ./configure $configure_args
187
188PREFIX=$prefix
189BINDIR=$bindir
190SBINDIR=$sbindir
191ETCDIR=$etcdir
192MANDIR=$mandir
193DATADIR=$datadir
194PLUGINDIR=$plugindir
195CONFIG=$config
196INCLUDEDIR=$includedir
197PCDIR=$pcdir
198
199TARGET=$target
200ARCH=$arch
201CPU=$cpu
202
203INSTALL=install -p
204
205DESTDIR=
206LFLAGS=
207EFLAGS=-lm
208EOF
209
210srcdir=$(cd $(dirname $0);pwd)
211currdir=$(pwd)
212if [ "$srcdir" != "$currdir" ]; then 
213        echo
214        echo "configure script run from a different directory. Will create some symlinks..."
215        if [ ! -e Makefile -o -L Makefile ]; then
216                COPYDIRS="doc lib protocols tests utils"
217                mkdir -p $(cd "$srcdir"; find $COPYDIRS -type d)
218                find . -name Makefile -type l -print0 | xargs -0 rm 2> /dev/null
219                dst="$PWD"
220                cd "$srcdir"
221                for i in $(find . -name Makefile -type f); do
222                        ln -s "$PWD${i#.}" "$dst/$i";
223                done
224                cd "$dst"
225                rm -rf .bzr
226        fi
227       
228        echo "_SRCDIR_=$srcdir/" >> Makefile.settings
229        CFLAGS="$CFLAGS -I${dst}"
230else
231        srcdir=$PWD
232fi
233
234cat<<EOF >config.h
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
240#define BITLBEE_CONFIGURE_ARGS "$configure_args"
241
242#define CONFIG "$config"
243#define ETCDIR "$etcdir"
244#define VARDIR "$datadir"
245#define PLUGINDIR "$plugindir"
246#define PIDFILE "$pidfile"
247#define IPCSOCKET "$ipcsocket"
248#define ARCH "$arch"
249#define CPU "$cpu"
250EOF
251
252
253
254if [ -n "$target" ]; then
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
279        CC=$target-cc
280        LD=$target-ld
281        STRIP=$target-strip
282fi
283
284if [ "$asan" = "1" ]; then
285        CFLAGS="$CFLAGS -fsanitize=address"
286        LDFLAGS="$LDFLAGS -fsanitize=address"
287        debug=1
288fi
289
290if [ "$debug" = "1" ]; then
291        echo 'DEBUG=1' >> Makefile.settings
292        CFLAGS="$CFLAGS -g3 -DDEBUG -O0"
293else
294        [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
295fi
296
297if [ "$pie" = "1" ]; then
298        echo 'CFLAGS_BITLBEE=-fPIE' >> Makefile.settings
299        echo 'LDFLAGS_BITLBEE=-pie' >> Makefile.settings
300fi
301
302echo LDFLAGS=$LDFLAGS >> Makefile.settings
303
304echo CFLAGS=$CFLAGS $CPPFLAGS >> Makefile.settings
305echo CFLAGS+=-I${srcdir} -I${srcdir}/lib -I${srcdir}/protocols -I. >> Makefile.settings
306
307echo CFLAGS+=-DHAVE_CONFIG_H -D_GNU_SOURCE >> Makefile.settings
308
309if [ -n "$CC" ]; then
310        CC=$CC
311elif type gcc > /dev/null 2> /dev/null; then
312        CC=gcc
313elif type cc > /dev/null 2> /dev/null; then
314        CC=cc
315else
316        echo 'Cannot find a C compiler, aborting.'
317        exit 1;
318fi
319
320echo "CC=$CC" >> Makefile.settings;
321if echo $CC | grep -qw gcc; then
322        # Apparently -Wall is gcc-specific?
323        echo CFLAGS+=-Wall >> Makefile.settings
324fi
325
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
333fi
334
335echo "LD=$LD" >> Makefile.settings
336
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
342        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
343                cat<<EOF >>Makefile.settings
344EFLAGS+=$($PKG_CONFIG --libs glib-2.0 gmodule-2.0)
345CFLAGS+=$($PKG_CONFIG --cflags glib-2.0 gmodule-2.0)
346EOF
347        else
348                echo
349                echo 'Found glib2 '$($PKG_CONFIG glib-2.0 --modversion)', but version '$GLIB_MIN_VERSION' or newer is required.'
350                exit 1
351        fi
352else
353        echo
354        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
355        exit 1
356fi
357
358if [ "$events" = "libevent" ]; then
359        if ! [ -f "${libevent}include/event.h" ]; then
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
367        cat <<EOF >>Makefile.settings
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
374else
375        echo
376        echo 'ERROR: Unknown event handler specified.'
377        exit 1
378fi
379echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
380
381detect_gnutls()
382{
383        if $PKG_CONFIG --exists gnutls; then
384                cat <<EOF >>Makefile.settings
385EFLAGS+=$($PKG_CONFIG --libs gnutls) $(libgcrypt-config --libs)
386CFLAGS+=$($PKG_CONFIG --cflags gnutls) $(libgcrypt-config --cflags)
387EOF
388                ssl=gnutls
389                if ! $PKG_CONFIG gnutls --atleast-version=2.8; then
390                        echo
391                        echo 'Warning: With GnuTLS versions <2.8, certificate expire dates are not verified.'
392                fi
393                ret=1
394        elif libgnutls-config --version > /dev/null 2> /dev/null; then
395                cat <<EOF >>Makefile.settings
396EFLAGS+=$(libgnutls-config --libs) $(libgcrypt-config --libs)
397CFLAGS+=$(libgnutls-config --cflags) $(libgcrypt-config --cflags)
398EOF
399               
400                ssl=gnutls
401                ret=1;
402        else
403                ret=0;
404        fi;
405}
406
407detect_nss()
408{
409        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG nss; then
410                cat<<EOF >>Makefile.settings
411EFLAGS+=$($PKG_CONFIG --libs nss)
412CFLAGS+=$($PKG_CONFIG --cflags nss)
413EOF
414               
415                ssl=nss
416                ret=1;
417        else
418                ret=0;
419        fi;
420}
421
422RESOLV_TESTCODE='
423#include <sys/types.h>
424#include <netinet/in.h>
425#include <arpa/nameser.h>
426#include <resolv.h>
427
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
442int main()
443{
444        ns_initparse( NULL, 0, NULL );
445        ns_parserr( NULL, ns_s_an, 0, NULL );
446}
447'
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
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));
462}
463'
464
465detect_resolv_dynamic()
466{
467        case "$arch" in
468        OpenBSD )
469                # In FreeBSD res_*/dn_* routines are present in libc.so
470                LIBRESOLV=;;
471        FreeBSD )
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
476                LIBRESOLV=;;
477        * )
478                LIBRESOLV=-lresolv;;
479        esac
480        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
481        ret=1
482        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - $LIBRESOLV >/dev/null 2>/dev/null
483        if [ "$?" = "0" ]; then
484                echo "EFLAGS+=$LIBRESOLV" >> Makefile.settings
485                ret=0
486        fi
487
488        rm -f $TMPFILE
489        return $ret
490}
491
492detect_resolv_static()
493{
494        TMPFILE=$(mktemp /tmp/bitlbee-configure.XXXXXX)
495        ret=1
496        for i in $systemlibdirs; do
497                if [ -f $i/libresolv.a ]; then
498                        echo "$RESOLV_TESTCODE" | $CC -o $TMPFILE -x c - -Wl,$i/libresolv.a >/dev/null 2>/dev/null
499                        if [ "$?" = "0" ]; then
500                                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
501                                ret=0
502                        fi
503                fi
504        done
505
506        rm -f $TMPFILE
507        return $ret
508}
509
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
522        if [ "$?" = "0" ]; then
523                ret=0
524        fi
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
537                        if [ "$?" = "0" ]; then
538                                ret=0
539                        fi
540                fi
541        done
542
543        rm -f $TMPFILE
544        return $ret
545}
546
547detect_nameser_has_ns_types()
548{
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
560}
561
562if [ "$ssl" = "auto" ]; then
563        detect_gnutls
564        if [ "$ret" = "0" ]; then
565                # Disable NSS for now as it's known to not work very well ATM.
566                #detect_nss
567                :
568        fi
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'
576        echo 'installation of OpenSSL (including devel/header files) before reporting'
577        echo 'compilation problems.'
578        echo
579        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
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.'
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'
589        echo 'package, you really should use GnuTLS instead.'
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/)"'
594       
595        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
596       
597        ret=1
598else
599        echo
600        echo 'ERROR: Unknown SSL library specified.'
601        exit 1
602fi
603
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,'
608        echo '       so if you want to use that, you have to select it by hand.'
609       
610        exit 1
611fi;
612
613echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
614
615if detect_nameser_has_ns_types; then
616        echo '#define NAMESER_HAS_NS_TYPES' >> config.h
617fi
618if detect_resolv_dynamic || detect_resolv_static; then
619        echo '#define HAVE_RESOLV_A' >> config.h
620        if detect_resolv_ns_dynamic || detect_resolv_ns_static; then
621                echo '#define HAVE_RESOLV_A_WITH_NS' >> config.h
622        fi
623else
624        echo 'Insufficient resolv routines. Jabber server must be set explicitly'
625fi
626
627
628STORAGES="xml"
629
630for i in $STORAGES; do
631        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
632done
633echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
634
635authobjs=
636authlibs=
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
648echo AUTH_OBJS=$authobjs >> Makefile.settings
649echo EFLAGS+=$authlibs >> Makefile.settings
650
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
671if [ -z "$systemdsystemunitdir" ]; then
672        if $PKG_CONFIG --exists systemd; then
673                systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
674        fi
675fi
676if [ -n "$systemdsystemunitdir" ]; then
677        if [ "$systemdsystemunitdir" != "no" ]; then
678                echo "SYSTEMDSYSTEMUNITDIR=$systemdsystemunitdir" >> Makefile.settings
679        fi
680fi
681
682if [ "$gcov" = "1" ]; then
683        echo "CFLAGS+=--coverage" >> Makefile.settings
684        echo "EFLAGS+=--coverage" >> Makefile.settings
685fi
686
687if [ "$plugins" = 0 ]; then
688        plugindir=""
689        echo '#undef WITH_PLUGINS' >> config.h
690else
691        echo '#define WITH_PLUGINS' >> config.h
692fi
693
694otrprefix=""
695if [ "$otr" = "auto" ]; then
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
702fi
703
704if [ "$otr" = 1 ]; then
705        # BI == built-in
706        echo '#define OTR_BI' >> config.h
707        echo "EFLAGS+=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
708        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
709        echo 'OTR_BI=otr.o' >> Makefile.settings
710elif [ "$otr" = "plugin" ]; then
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.
713        echo '#define OTR_PI' >> config.h
714        echo "OTRFLAGS=$($PKG_CONFIG --libs libotr) $(libgcrypt-config --libs)" >> Makefile.settings
715        echo "CFLAGS+=$($PKG_CONFIG --cflags libotr) $(libgcrypt-config --cflags)" >> Makefile.settings
716        echo 'OTR_PI=otr.so' >> Makefile.settings
717fi
718
719if [ "$skype" = "1" -o "$skype" = "plugin" ]; then
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
725        echo 'SKYPE_PI=skype.so' >> Makefile.settings
726        protocols_mods="$protocol_mods skype(plugin)"
727fi
728
729if [ -z "$PYTHON" ]; then
730        PYTHON=python
731fi
732
733if [ "$doc" = "1" ]; then
734        # check this here just in case someone tries to install it in python2.4...
735        if ! $PYTHON -m xml.etree.ElementTree > /dev/null 2>&1; then
736                echo
737                echo 'ERROR: Python (>=2.5 or 3.x) is required to generate docs'
738                echo "(Use the PYTHON environment variable if it's in a weird location)"
739                exit 1
740        fi
741        echo "DOC=1" >> Makefile.settings
742        echo "PYTHON=$PYTHON" >> Makefile.settings
743fi
744
745get_version
746
747if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
748        echo 'Spoofing version number: '$BITLBEE_VERSION
749        echo '#undef BITLBEE_VERSION' >> config.h
750        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
751        echo
752fi
753
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
768cat <<EOF >bitlbee.pc
769prefix=$prefix
770includedir=$includedir
771plugindir=$plugindir
772
773Name: bitlbee
774Description: IRC to IM gateway
775Requires: glib-2.0
776Version: $BITLBEE_VERSION
777Libs:
778Cflags: -I\${includedir}
779
780EOF
781
782protocols=''
783protoobjs=''
784
785if [ "$purple" = 0 ]; then
786        echo '#undef WITH_PURPLE' >> config.h
787else
788        if ! $PKG_CONFIG purple; then
789                echo
790                echo 'Cannot find libpurple development libraries, aborting. (Install libpurple-dev?)'
791                exit 1
792        fi
793        echo '#define WITH_PURPLE' >> config.h
794        cat<<EOF >>Makefile.settings
795EFLAGS += $($PKG_CONFIG purple --libs)
796PURPLE_CFLAGS += $($PKG_CONFIG purple --cflags)
797EOF
798        protocols=$protocols'purple '
799        protoobjs=$protoobjs'purple_mod.o '
800
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
806
807        echo '#undef PACKAGE' >> config.h
808        echo '#define PACKAGE "BitlBee-LIBPURPLE"' >> config.h
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!'
814                echo
815        fi
816fi
817
818case "$CC" in
819*gcc* )
820        echo CFLAGS+=-MMD -MF .depend/\$@.d >> Makefile.settings
821        for i in . lib tests protocols protocols/*/; do
822                mkdir -p $i/.depend
823        done
824esac
825
826if [ "$msn" = 0 ]; then
827        echo '#undef WITH_MSN' >> config.h
828else
829        echo '#define WITH_MSN' >> config.h
830        protocols=$protocols'msn '
831        protoobjs=$protoobjs'msn_mod.o '
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 '
839        protoobjs=$protoobjs'jabber_mod.o '
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 '
847        protoobjs=$protoobjs'oscar_mod.o '
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 '
855        protoobjs=$protoobjs'yahoo_mod.o '
856fi
857
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
866if [ "$protocols" = "PROTOCOLS = " ]; then
867        echo "Warning: You haven't selected any communication protocol to compile!"
868        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
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 )
883        echo 'STRIP=\# skip strip' >> Makefile.settings
884;;
885IRIX )
886;;
887SunOS )
888        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
889        echo 'STRIP=\# skip strip' >> Makefile.settings
890        echo '#define NO_FD_PASSING' >> config.h
891;;
892AIX )
893        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
894;;
895CYGWIN* )
896;;
897Windows )
898        echo 'Native windows compilation is not supported anymore, use cygwin instead.'
899;;
900* )
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/.'
903;;
904esac
905
906if [ -n "$target" ]; then
907        echo "Cross-compiling for: $target"
908fi
909
910echo
911echo 'Configuration done:'
912
913if [ "$debug" = "1" ]; then
914        echo '  Debugging enabled.'
915else
916        echo '  Debugging disabled.'
917fi
918
919if [ "$asan" = "1" ]; then
920        echo '  AddressSanitizer (ASAN) enabled.'
921else
922        echo '  AddressSanitizer (ASAN) disabled.'
923fi
924
925if [ "$pie" = "1" ]; then
926        echo '  Building PIE executable'
927else
928        echo '  Building non-PIE executable'
929fi
930
931if [ "$strip" = "1" ]; then
932        echo '  Binary stripping enabled.'
933else
934        echo '  Binary stripping disabled.'
935fi
936
937if [ "$otr" = "1" ]; then
938        echo '  Off-the-Record (OTR) Messaging enabled.'
939elif [ "$otr" = "plugin" ]; then
940        echo '  Off-the-Record (OTR) Messaging enabled (as a plugin).'
941else
942        echo '  Off-the-Record (OTR) Messaging disabled.'
943fi
944
945if [ -n "$systemdsystemunitdir" ]; then
946        echo '  systemd enabled.'
947else
948        echo '  systemd disabled.'
949fi
950
951echo '  Using event handler: '$events
952echo '  Using SSL library: '$ssl
953#echo '  Building with these storage backends: '$STORAGES
954
955if [ -n "$protocols" ]; then
956        echo '  Building with these protocols:' $protocols$protocols_mods
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
963else
964        echo '  Building without IM-protocol support. We wish you a lot of fun...'
965fi
Note: See TracBrowser for help on using the repository browser.