source: configure @ 5357525

Last change on this file since 5357525 was b7d3cc34, checked in by Wilmer van der Gaast <wilmer@…>, at 2005-11-06T18:23:18Z

Initial repository (0.99 release tree)

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