source: configure @ f665dab

Last change on this file since f665dab was f665dab, checked in by Jelmer Vernooij <jelmer@…>, at 2006-02-12T08:02:03Z

Initial work on new LDB-based storage backend

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