source: configure @ ac55e50

Last change on this file since ac55e50 was ac55e50, checked in by Jelmer Vernooij <jelmer@…>, at 2005-11-29T00:52:14Z

Merge small fix.

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