source: configure @ a15c097

Last change on this file since a15c097 was f32d557, checked in by Jelmer Vernooij <jelmer@…>, at 2006-03-24T15:53:29Z

Switch from LDB to LDAP (LDB's authentication subsystem is not mature enough yet)

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