source: configure @ 84b045d

Last change on this file since 84b045d was 0fd8559, checked in by Wilmer van der Gaast <wilmer@…>, at 2007-02-18T17:48:04Z

Merging new Jabber module. See the massive changelog for all the cool
improvements. :-)

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