source: configure @ 25d1be7

Last change on this file since 25d1be7 was e5663e0, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-12-01T20:05:09Z

Disabling send flood protection, too many bugs (that were there from the
beginning) and too trigger-happy.

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