source: configure @ 9fae35c

Last change on this file since 9fae35c was 4fe4be2, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-01-10T14:20:48Z

Removed send-flood protection code completely.

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