source: configure @ 16b5f86

Last change on this file since 16b5f86 was e8a6211, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-10-22T17:00:15Z

Merge from main tree.

  • Property mode set to 100755
File size: 11.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'
[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
[36e9f62]330for i in /lib /usr/lib /usr/local/lib; do
331        if [ -e $i/libresolv.a ]; then
332                echo '#define HAVE_RESOLV_A' >> config.h
333                echo 'EFLAGS+='$i'/libresolv.a' >> Makefile.settings
334                break
335        fi
336done
337
[b3c467b]338STORAGES="text xml"
339
[f32d557]340if [ "$ldap" = "auto" ]; then
341        detect_ldap
[f665dab]342fi
343
[f32d557]344if [ "$ldap" = 0 ]; then
[5973412]345        echo "#undef WITH_LDAP" >> config.h
[f32d557]346elif [ "$ldap" = 1 ]; then
[5973412]347        echo "#define WITH_LDAP 1" >> config.h
[b3c467b]348        STORAGES="$STORAGES ldap"
[f665dab]349fi
350
[b3c467b]351for i in $STORAGES; do
352        STORAGE_OBJS="$STORAGE_OBJS storage_$i.o"
353done
354echo "STORAGE_OBJS="$STORAGE_OBJS >> Makefile.settings
355
[b7d3cc34]356if [ "$strip" = 0 ]; then
357        echo "STRIP=\# skip strip" >> Makefile.settings;
358else
359        if [ "$debug" = 1 ]; then
360                echo
361                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
362                echo 'STRIP=\# skip strip' >> Makefile.settings
363                strip=0;
364        elif [ -n "$STRIP" ]; then
365                echo "STRIP=$STRIP" >> Makefile.settings;
366        elif type strip > /dev/null 2> /dev/null; then
367                echo "STRIP=strip" >> Makefile.settings;
368        else
369                echo
370                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
371                echo 'STRIP=\# skip strip' >> Makefile.settings
372                strip=0;
373        fi;
374fi
375
[ffea9b9]376echo
[a014331]377if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
378        nick=`bzr nick`
379        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
380                nick="-$nick"
381        else
382                nick=""
383        fi
[ffea9b9]384        rev=`bzr revno`
385        echo 'Using bzr revision #'$rev' as version number'
[a014331]386        BITLBEE_VERSION=\"bzr$nick-$rev\"
[ffea9b9]387fi
388
[b7d3cc34]389if [ -n "$BITLBEE_VERSION" ]; then
390        echo 'Spoofing version number: '$BITLBEE_VERSION
391        echo '#undef BITLBEE_VERSION' >> config.h
[ffea9b9]392        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
393        echo
[b7d3cc34]394fi
395
[e506d6c]396cat <<EOF>bitlbee.pc
397prefix=$prefix
398includedir=$includedir
399
400Name: bitlbee
401Description: IRC to IM gateway
402Requires: glib-2.0
403Version: $BITLBEE_VERSION
404Libs:
405Cflags: -I\${includedir}
406
407EOF
408
[b7d3cc34]409protocols=''
410protoobjs=''
411
412if [ "$msn" = 0 ]; then
413        echo '#undef WITH_MSN' >> config.h
414else
415        echo '#define WITH_MSN' >> config.h
416        protocols=$protocols'msn '
[b5a22e3]417        protoobjs=$protoobjs'msn_mod.o '
[b7d3cc34]418fi
419
420if [ "$jabber" = 0 ]; then
421        echo '#undef WITH_JABBER' >> config.h
422else
423        echo '#define WITH_JABBER' >> config.h
424        protocols=$protocols'jabber '
[b5a22e3]425        protoobjs=$protoobjs'jabber_mod.o '
[b7d3cc34]426fi
427
428if [ "$oscar" = 0 ]; then
429        echo '#undef WITH_OSCAR' >> config.h
430else
431        echo '#define WITH_OSCAR' >> config.h
432        protocols=$protocols'oscar '
[b5a22e3]433        protoobjs=$protoobjs'oscar_mod.o '
[b7d3cc34]434fi
435
436if [ "$yahoo" = 0 ]; then
437        echo '#undef WITH_YAHOO' >> config.h
438else
439        echo '#define WITH_YAHOO' >> config.h
440        protocols=$protocols'yahoo '
[b5a22e3]441        protoobjs=$protoobjs'yahoo_mod.o '
[b7d3cc34]442fi
443
444if [ "$protocols" = "PROTOCOLS = " ]; then
445        echo "WARNING: You haven't selected any communication protocol to compile!"
[b3c467b]446        echo "         BitlBee will run, but you will be unable to connect to IM servers!"
[b7d3cc34]447fi
448
449echo "PROTOCOLS = $protocols" >> Makefile.settings
450echo "PROTOOBJS = $protoobjs" >> Makefile.settings
451
452echo Architecture: $arch
453case "$arch" in
454Linux )
455;;
456GNU/* )
457;;
458*BSD )
459;;
460Darwin )
461;;
462IRIX )
463;;
[574af7e]464SunOS )
465        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
466        echo 'STRIP=\# skip strip' >> Makefile.settings
467;;
[b7d3cc34]468CYGWIN* )
469        echo 'Cygwin is not officially supported.'
470;;
471* )
[8d6c4b1]472        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
473        echo 'Please report any problems at http://bugs.bitlbee.org/.'
[b7d3cc34]474;;
475esac
476
477echo
478echo 'Configuration done:'
479
480if [ "$debug" = "1" ]; then
[b3c467b]481        echo '  Debugging enabled.'
[b7d3cc34]482else
[b3c467b]483        echo '  Debugging disabled.'
[b7d3cc34]484fi
485
486if [ "$strip" = "1" ]; then
[b3c467b]487        echo '  Binary stripping enabled.'
[b7d3cc34]488else
[b3c467b]489        echo '  Binary stripping disabled.'
[b7d3cc34]490fi
491
[b3c467b]492echo '  Using event handler: '$events
493echo '  Using SSL library: '$ssl
494echo '  Building with these storage backends: '$STORAGES
[b7d3cc34]495
496if [ -n "$protocols" ]; then
[b3c467b]497        echo '  Building with these protocols:' $protocols
[f665dab]498else
[b3c467b]499        echo '  Building without IM-protocol support. We wish you a lot of fun...'
[f665dab]500fi
Note: See TracBrowser for help on using the repository browser.