source: configure @ 55078f5

Last change on this file since 55078f5 was 670204f, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-10-22T12:43:40Z

Copied 1.0.x changelogs, disabled LDAP support in configure (because the
code just doesn't work yet) and added GLib version detection. (GLib 2.4
and up *should* work.)

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