source: configure @ 73c2dce

Last change on this file since 73c2dce was 73c2dce, checked in by Jelmer Vernooij <jelmer@…>, at 2008-06-10T03:21:13Z

Update docs, remove obsolete win32-related utilities.

  • Property mode set to 100755
File size: 12.8 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/'
11bindir='$prefix/sbin/'
12etcdir='$prefix/etc/bitlbee/'
13mandir='$prefix/share/man/'
14datadir='$prefix/share/bitlbee/'
15config='/var/lib/bitlbee/'
[85cf37f]16plugindir='$prefix/lib/bitlbee/'
17includedir='$prefix/include/bitlbee/'
18libevent='/usr/'
[34b17d9]19pidfile='/var/run/bitlbee.pid'
[5c5a586]20ipcsocket='/var/run/bitlbee.sock'
[e506d6c]21pcdir='$prefix/lib/pkgconfig'
[1bf9492]22systemlibdirs="/lib /usr/lib /usr/local/lib"
[b7d3cc34]23
24msn=1
25jabber=1
26oscar=1
27yahoo=1
28
29debug=0
30strip=1
[66b9e86e]31gcov=0
[2abfbc5]32plugins=1
[85cf37f]33
34events=glib
[670204f]35ldap=0
[b7d3cc34]36ssl=auto
37
38arch=`uname -s`
39cpu=`uname -m`
40
[670204f]41GLIB_MIN_VERSION=2.4
42
[b7d3cc34]43echo BitlBee configure
44
45while [ -n "$1" ]; do
46        e="`expr "X$1" : 'X--\(.*=.*\)'`"
47        if [ -z "$e" ]; then
48                cat<<EOF
49
50Usage: $0 [OPTIONS]
51
52Option          Description                             Default
53
54--prefix=...    Directories to put files in             $prefix
55--bindir=...                                            $bindir
56--etcdir=...                                            $etcdir
57--mandir=...                                            $mandir
58--datadir=...                                           $datadir
[7b23afd]59--plugindir=...                                         $plugindir
[34b17d9]60--pidfile=...                                           $pidfile
[b7d3cc34]61--config=...                                            $config
[6dff9d4]62--ipcsocket=...                                         $ipcsocket
[b7d3cc34]63
64--msn=0/1       Disable/enable MSN part                 $msn
65--jabber=0/1    Disable/enable Jabber part              $jabber
66--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
67--yahoo=0/1     Disable/enable Yahoo part               $yahoo
68
69--debug=0/1     Disable/enable debugging                $debug
70--strip=0/1     Disable/enable binary stripping         $strip
[66b9e86e]71--gcov=0/1      Disable/enable test coverage reporting  $gcov
[2abfbc5]72--plugins=0/1   Disable/enable plugins support          $plugins
[b7d3cc34]73
[85cf37f]74--events=...    Event handler (glib, libevent)          $events
[b7d3cc34]75--ssl=...       SSL library to use (gnutls, nss, openssl, bogus, auto)
76                                                        $ssl
[aec56b0]77
[f1e7407]78--target=...    Cross compilation target                same as host
[b7d3cc34]79EOF
80                exit;
81        fi
82        eval "$e"
83        shift;
84done
85
86# Expand $prefix and get rid of double slashes
87bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
88etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
89mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
90datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
91config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
[7b23afd]92plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
[85cf37f]93includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
94libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
95
[6dff9d4]96pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
97ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
[e506d6c]98pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
[b7d3cc34]99
100cat<<EOF>Makefile.settings
101## BitlBee settings, generated by configure
102PREFIX=$prefix
103BINDIR=$bindir
104ETCDIR=$etcdir
105MANDIR=$mandir
106DATADIR=$datadir
[7b23afd]107PLUGINDIR=$plugindir
[b7d3cc34]108CONFIG=$config
[e506d6c]109INCLUDEDIR=$includedir
110PCDIR=$pcdir
[b7d3cc34]111
[1bf9492]112TARGET=$target
[b7d3cc34]113ARCH=$arch
114CPU=$cpu
115OUTFILE=bitlbee
116
117DESTDIR=
118LFLAGS=
119EFLAGS=
120EOF
121
122cat<<EOF>config.h
123/* BitlBee settings, generated by configure
124   
125   Do *NOT* use any of these defines in your code without thinking twice, most
126   of them can/will be overridden at run-time */
127
128#define CONFIG "$config"
129#define ETCDIR "$etcdir"
130#define VARDIR "$datadir"
[7b23afd]131#define PLUGINDIR "$plugindir"
[34b17d9]132#define PIDFILE "$pidfile"
[6dff9d4]133#define IPCSOCKET "$ipcsocket"
[b7d3cc34]134#define ARCH "$arch"
135#define CPU "$cpu"
136EOF
137
[1bf9492]138
139
[f1e7407]140if [ -n "$target" ]; then
[1bf9492]141        PKG_CONFIG_LIBDIR=/usr/$target/lib/pkgconfig
142        export PKG_CONFIG_LIBDIR
[f1e7407]143        PATH=/usr/$target/bin:$PATH
144        CC=$target-cc
145        LD=$target-ld
[1bf9492]146        systemlibdirs="/usr/$target/lib"
[f1e7407]147fi
148
[1bf9492]149
[b7d3cc34]150if [ "$debug" = "1" ]; then
[285b55d]151        [ -z "$CFLAGS" ] && CFLAGS=-g
[b7d3cc34]152        echo 'DEBUG=1' >> Makefile.settings
[911cc4f]153        CFLAGS="$CFLAGS -DDEBUG"
[b7d3cc34]154else
[56f260a]155        [ -z "$CFLAGS" ] && CFLAGS="-O2 -fno-strict-aliasing"
[b7d3cc34]156fi
157
[285b55d]158echo CFLAGS=$CFLAGS >> Makefile.settings
[df1694b]159echo CFLAGS+=-I`pwd` -I`pwd`/lib -I`pwd`/protocols -I. >> Makefile.settings
[b7d3cc34]160
[f712188]161echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
162
[b7d3cc34]163if [ -n "$CC" ]; then
[5973412]164        CC=$CC
[b7d3cc34]165elif type gcc > /dev/null 2> /dev/null; then
[5973412]166        CC=gcc
[b7d3cc34]167elif type cc > /dev/null 2> /dev/null; then
[5973412]168        CC=cc
[b7d3cc34]169else
170        echo 'Cannot find a C compiler, aborting.'
171        exit 1;
172fi
173
[5973412]174echo "CC=$CC" >> Makefile.settings;
175
[f1e7407]176if [ -z "$LD" ]; then
177        if type ld > /dev/null 2> /dev/null; then
178                LD=ld
179        else
180                echo 'Cannot find ld, aborting.'
181                exit 1;
182        fi
[b7d3cc34]183fi
184
[f1e7407]185echo "LD=$LD" >> Makefile.settings
186
[32c632f]187if [ -z "$PKG_CONFIG" ]; then
188        PKG_CONFIG=pkg-config
189fi
190
191if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
[670204f]192        if $PKG_CONFIG glib-2.0 --atleast-version=$GLIB_MIN_VERSION; then
193                cat<<EOF>>Makefile.settings
[32c632f]194EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
195CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
[b7d3cc34]196EOF
[670204f]197        else
198                echo
199                echo 'Found glib2 '`$PKG_CONFIG glib-2.0 --modversion`', but version '$GLIB_MIN_VERSION' or newer is required.'
200                exit 1
201        fi
[b7d3cc34]202else
[670204f]203        echo
[574af7e]204        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
[670204f]205        exit 1
[b7d3cc34]206fi
207
[85cf37f]208if [ "$events" = "libevent" ]; then
[003553b]209        if ! [ -f "${libevent}include/event.h" ]; then
[85cf37f]210                echo
211                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
212                echo 'its location using the --libevent= argument. (Example: If event.h is in'
213                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
214        fi
215       
216        echo '#define EVENTS_LIBEVENT' >> config.h
217        cat <<EOF>>Makefile.settings
218EFLAGS+=-levent -L${libevent}lib
219CFLAGS+=-I${libevent}include
220EOF
221elif [ "$events" = "glib" ]; then
222        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
223        echo '#define EVENTS_GLIB' >> config.h
[b7d3cc34]224else
225        echo
[85cf37f]226        echo 'ERROR: Unknown event handler specified.'
227        exit 1
[b7d3cc34]228fi
[85cf37f]229echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
[b7d3cc34]230
231detect_gnutls()
232{
[4af7b4f]233        if $PKG_CONFIG --exists gnutls; then
234                cat <<EOF>>Makefile.settings
235EFLAGS+=`$PKG_CONFIG --libs gnutls`
236CFLAGS+=`$PKG_CONFIG --cflags gnutls`
237EOF
238                ssl=gnutls
239                ret=1
240        elif libgnutls-config --version > /dev/null 2> /dev/null; then
[b7d3cc34]241                cat <<EOF>>Makefile.settings
242EFLAGS+=`libgnutls-config --libs`
243CFLAGS+=`libgnutls-config --cflags`
244EOF
245               
246                ssl=gnutls
247                ret=1;
248        else
249                ret=0;
250        fi;
251}
252
253detect_nss()
254{
[32c632f]255        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
[b7d3cc34]256                cat<<EOF>>Makefile.settings
[32c632f]257EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
258CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
[b7d3cc34]259EOF
260               
261                ssl=nss
262                ret=1;
263        else
264                ret=0;
265        fi;
266}
267
[f32d557]268detect_ldap()
[f665dab]269{
[5973412]270        TMPFILE=`mktemp`
271        if $CC -o $TMPFILE -shared -lldap 2>/dev/null >/dev/null; then
[f665dab]272                cat<<EOF>>Makefile.settings
[5973412]273EFLAGS+=-lldap
274CFLAGS+=
[f665dab]275EOF
[f32d557]276                ldap=1
[5973412]277                rm -f $TMPFILE
[f665dab]278                ret=1
[b7d3cc34]279        else
[5973412]280                ldap=0
[f665dab]281                ret=0
[b7d3cc34]282        fi
[f665dab]283}
284
[b3c467b]285if [ "$ssl" = "auto" ]; then
286        detect_gnutls
[b7d3cc34]287        if [ "$ret" = "0" ]; then
[b3c467b]288                detect_nss
[b7d3cc34]289        fi
[b3c467b]290elif [ "$ssl" = "gnutls" ]; then
291        detect_gnutls
292elif [ "$ssl" = "nss" ]; then
293        detect_nss
[85d7b85]294elif [ "$ssl" = "sspi" ]; then
295        echo
[b3c467b]296elif [ "$ssl" = "openssl" ]; then
297        echo
298        echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
299        echo 'install of OpenSSL (including devel/header files) before reporting'
300        echo 'compilation problems.'
301        echo
302        echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
303        echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
304        echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
305        echo 'part of the operating system, which makes it GPL-compatible.'
306        echo
307        echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
308        echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
309        echo
310        echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
311        echo 'probably illegal. If you want to create and distribute a binary BitlBee'
312        echo 'package, you really should use GnuTLS or NSS instead.'
313        echo
314        echo 'Also, the OpenSSL license requires us to say this:'
315        echo ' *    "This product includes software developed by the OpenSSL Project'
316        echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
[b7d3cc34]317       
[b3c467b]318        echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
319       
320        ret=1
321elif [ "$ssl" = "bogus" ]; then
322        echo
[670204f]323        echo 'Using bogus SSL code. This means some features will not work properly.'
[b3c467b]324       
325        ## Yes, you, at the console! How can you authenticate if you don't have any SSL!?
326        if [ "$msn" = "1" ]; then
[b7d3cc34]327                echo
[b3c467b]328                echo 'Real SSL support is necessary for MSN authentication, will build without'
329                echo 'MSN protocol support.'
330                msn=0
331        fi
[b7d3cc34]332       
[b3c467b]333        ret=1
334else
335        echo
336        echo 'ERROR: Unknown SSL library specified.'
337        exit 1
[b7d3cc34]338fi
339
[b3c467b]340if [ "$ret" = "0" ]; then
341        echo
342        echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
343        echo '       Please note that this script doesn'\''t have detection code for OpenSSL,'
344        echo '       so if you want to use that, you have to select it by hand. If you don'\''t'
345        echo '       need SSL support, you can select the "bogus" SSL library. (--ssl=bogus)'
[b7d3cc34]346       
[b3c467b]347        exit 1
348fi;
349
350echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
351
[1bf9492]352for i in $systemlibdirs; do
[003553b]353        if [ -f $i/libresolv.a ]; then
[36e9f62]354                echo '#define HAVE_RESOLV_A' >> config.h
355                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
356                break
357        fi
358done
359
[b3c467b]360STORAGES="text xml"
361
[f32d557]362if [ "$ldap" = "auto" ]; then
363        detect_ldap
[b7d3cc34]364fi
365
[f32d557]366if [ "$ldap" = 0 ]; then
[5973412]367        echo "#undef WITH_LDAP" >> config.h
[f32d557]368elif [ "$ldap" = 1 ]; then
[5c5a586]369        echo
370        echo 'LDAP support is a work in progress and does NOT work AT ALL right now.'
371        echo
372        exit 1
373       
[5973412]374        echo "#define WITH_LDAP 1" >> config.h
[b3c467b]375        STORAGES="$STORAGES ldap"
[b7d3cc34]376fi
377
[b3c467b]378for i in $STORAGES; do
379        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
380done
381echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
382
[b7d3cc34]383if [ "$strip" = 0 ]; then
384        echo "STRIP=\# skip strip" >> Makefile.settings;
385else
386        if [ "$debug" = 1 ]; then
387                echo
388                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
389                echo 'STRIP=\# skip strip' >> Makefile.settings
390                strip=0;
391        elif [ -n "$STRIP" ]; then
392                echo "STRIP=$STRIP" >> Makefile.settings;
393        elif type strip > /dev/null 2> /dev/null; then
394                echo "STRIP=strip" >> Makefile.settings;
395        else
396                echo
397                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
398                echo 'STRIP=\# skip strip' >> Makefile.settings
399                strip=0;
400        fi;
401fi
402
[66b9e86e]403if [ "$gcov" = "1" ]; then
[31fc3970]404        echo "CFLAGS+=--coverage" >> Makefile.settings
405        echo "EFLAGS+=--coverage" >> Makefile.settings
[66b9e86e]406fi
407
[2abfbc5]408if [ "$plugins" = 0 ]; then
409        echo '#undef WITH_PLUGINS' >> config.h
410else
411        echo '#define WITH_PLUGINS' >> config.h
412fi
413
[ffea9b9]414echo
[a014331]415if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
416        nick=`bzr nick`
417        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
418                nick="-$nick"
419        else
420                nick=""
421        fi
[ffea9b9]422        rev=`bzr revno`
423        echo 'Using bzr revision #'$rev' as version number'
[a014331]424        BITLBEE_VERSION=\"bzr$nick-$rev\"
[b7d3cc34]425fi
426
427if [ -n "$BITLBEE_VERSION" ]; then
428        echo 'Spoofing version number: '$BITLBEE_VERSION
429        echo '#undef BITLBEE_VERSION' >> config.h
[ffea9b9]430        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
431        echo
[b7d3cc34]432fi
433
[e506d6c]434cat <<EOF>bitlbee.pc
435prefix=$prefix
436includedir=$includedir
437
438Name: bitlbee
439Description: IRC to IM gateway
440Requires: glib-2.0
441Version: $BITLBEE_VERSION
442Libs:
443Cflags: -I\${includedir}
444
445EOF
446
[b7d3cc34]447protocols=''
448protoobjs=''
449
450if [ "$msn" = 0 ]; then
451        echo '#undef WITH_MSN' >> config.h
452else
453        echo '#define WITH_MSN' >> config.h
454        protocols=$protocols'msn '
[b5a22e3]455        protoobjs=$protoobjs'msn_mod.o '
[b7d3cc34]456fi
457
458if [ "$jabber" = 0 ]; then
459        echo '#undef WITH_JABBER' >> config.h
460else
461        echo '#define WITH_JABBER' >> config.h
462        protocols=$protocols'jabber '
[b5a22e3]463        protoobjs=$protoobjs'jabber_mod.o '
[b7d3cc34]464fi
465
466if [ "$oscar" = 0 ]; then
467        echo '#undef WITH_OSCAR' >> config.h
468else
469        echo '#define WITH_OSCAR' >> config.h
470        protocols=$protocols'oscar '
[b5a22e3]471        protoobjs=$protoobjs'oscar_mod.o '
[b7d3cc34]472fi
473
474if [ "$yahoo" = 0 ]; then
475        echo '#undef WITH_YAHOO' >> config.h
476else
477        echo '#define WITH_YAHOO' >> config.h
478        protocols=$protocols'yahoo '
[b5a22e3]479        protoobjs=$protoobjs'yahoo_mod.o '
[b7d3cc34]480fi
481
482if [ "$protocols" = "PROTOCOLS = " ]; then
[43462708]483        echo "Warning: You haven't selected any communication protocol to compile!"
[b3c467b]484        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
[b7d3cc34]485fi
486
487echo "PROTOCOLS = $protocols" >> Makefile.settings
488echo "PROTOOBJS = $protoobjs" >> Makefile.settings
489
490echo Architecture: $arch
491case "$arch" in
492Linux )
493;;
494GNU/* )
495;;
496*BSD )
497;;
498Darwin )
499;;
500IRIX )
501;;
502SunOS )
503        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
504        echo 'STRIP=\# skip strip' >> Makefile.settings
505;;
[8de63c3]506AIX )
507        echo 'EFLAGS+=-Wl,-brtl' >> Makefile.settings
[b7d3cc34]508;;
509CYGWIN* )
510        echo 'Cygwin is not officially supported.'
511;;
[aec56b0]512Windows )
513        echo OUTFILE=bitlbee.exe >> Makefile.settings
514;;
[b7d3cc34]515* )
[8d6c4b1]516        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
517        echo 'Please report any problems at http://bugs.bitlbee.org/.'
[b7d3cc34]518;;
519esac
520
[f1e7407]521if [ -n "$target" ]; then
522        echo "Cross-compiling for: $target"
523fi
524
[b7d3cc34]525echo
526echo 'Configuration done:'
527
528if [ "$debug" = "1" ]; then
[b3c467b]529        echo '  Debugging enabled.'
[b7d3cc34]530else
[b3c467b]531        echo '  Debugging disabled.'
[b7d3cc34]532fi
533
534if [ "$strip" = "1" ]; then
[b3c467b]535        echo '  Binary stripping enabled.'
[b7d3cc34]536else
[b3c467b]537        echo '  Binary stripping disabled.'
[b7d3cc34]538fi
539
[b3c467b]540echo '  Using event handler: '$events
541echo '  Using SSL library: '$ssl
542echo '  Building with these storage backends: '$STORAGES
[b7d3cc34]543
544if [ -n "$protocols" ]; then
[b3c467b]545        echo '  Building with these protocols:' $protocols
[b7d3cc34]546else
[b3c467b]547        echo '  Building without IM-protocol support. We wish you a lot of fun...'
[b7d3cc34]548fi
Note: See TracBrowser for help on using the repository browser.