source: configure @ 8e419cb

Last change on this file since 8e419cb was 8e419cb, checked in by Jelmer Vernooij <jelmer@…>, at 2006-01-10T21:35:08Z

Merge Wilmer

  • Property mode set to 100755
File size: 9.8 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/'
[7b23afd]16plugindir='$prefix/lib/bitlbee'
[b7d3cc34]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
[7b23afd]47--plugindir=...                                         $plugindir
[b7d3cc34]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
[e3fb678]60--ssl=...       SSL library to use (gnutls, nss, openssl, sspi, bogus, auto)
[b7d3cc34]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'`
[7b23afd]75plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
[b7d3cc34]76
77cat<<EOF>Makefile.settings
78## BitlBee settings, generated by configure
79PREFIX=$prefix
80BINDIR=$bindir
81ETCDIR=$etcdir
82MANDIR=$mandir
83DATADIR=$datadir
[7b23afd]84PLUGINDIR=$plugindir
[b7d3cc34]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"
[7b23afd]105#define PLUGINDIR "$plugindir"
[b7d3cc34]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
[f712188]124echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
125
[b7d3cc34]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
[32c632f]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
[b7d3cc34]151        cat<<EOF>>Makefile.settings
[32c632f]152EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
153CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
[b7d3cc34]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{
[32c632f]195        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
[b7d3cc34]196                cat<<EOF>>Makefile.settings
[32c632f]197EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
198CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
[b7d3cc34]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;
[e3fb678]218        elif [ "$ssl" = "sspi" ]; then
219                echo
[b7d3cc34]220        elif [ "$ssl" = "openssl" ]; then
221                echo
222                echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
223                echo 'install of OpenSSL (including devel/header files) before reporting'
224                echo 'compilation problems.'
225                echo
226                echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
227                echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
228                echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
229                echo 'part of the operating system, which makes it GPL-compatible.'
230                echo
231                echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
232                echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
233                echo
234                echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
235                echo 'probably illegal. If you want to create and distribute a binary BitlBee'
236                echo 'package, you really should use GnuTLS or NSS instead.'
237                echo
238                echo 'Also, the OpenSSL license requires us to say this:'
239                echo ' *    "This product includes software developed by the OpenSSL Project'
240                echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
241               
242                echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
243               
244                ret=1;
245        elif [ "$ssl" = "bogus" ]; then
246                echo
247                echo 'Using bogus SSL code. This will not make the MSN module work, but it will'
248                echo 'allow you to use the Jabber module - although without working SSL support.'
249               
250                ret=1;
251        else
252                echo
253                echo 'ERROR: Unknown SSL library specified.'
254                exit 1;
255        fi
256       
257        if [ "$ret" = "0" ]; then
258                echo
[54c5ca1]259                echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
260                echo '       This is necessary for MSN and full Jabber support. To continue,'
261                echo '       install a suitable SSL library or disable MSN support (--msn=0).'
262                echo '       If you want Jabber without SSL support you can try --ssl=bogus.'
[b7d3cc34]263               
264                exit 1;
265        fi;
266       
267        echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
268fi
269
270if [ "$strip" = 0 ]; then
271        echo "STRIP=\# skip strip" >> Makefile.settings;
272else
273        if [ "$debug" = 1 ]; then
274                echo
275                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
276                echo 'STRIP=\# skip strip' >> Makefile.settings
277                strip=0;
278        elif [ -n "$STRIP" ]; then
279                echo "STRIP=$STRIP" >> Makefile.settings;
280        elif type strip > /dev/null 2> /dev/null; then
281                echo "STRIP=strip" >> Makefile.settings;
282        elif /bin/test -x /usr/ccs/bin/strip; then
283                echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
284        else
285                echo
286                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
287                echo 'STRIP=\# skip strip' >> Makefile.settings
288                strip=0;
289        fi;
290fi
291
[ffea9b9]292echo
293if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then
294        rev=`bzr revno`
295        echo 'Using bzr revision #'$rev' as version number'
296        BITLBEE_VERSION=\"bzr-$rev\"
[b7d3cc34]297fi
298
299if [ -n "$BITLBEE_VERSION" ]; then
300        echo 'Spoofing version number: '$BITLBEE_VERSION
301        echo '#undef BITLBEE_VERSION' >> config.h
[ffea9b9]302        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
303        echo
[b7d3cc34]304fi
305
306protocols=''
307protoobjs=''
308
309if [ "$msn" = 0 ]; then
310        echo '#undef WITH_MSN' >> config.h
311else
312        echo '#define WITH_MSN' >> config.h
313        protocols=$protocols'msn '
[b5a22e3]314        protoobjs=$protoobjs'msn_mod.o '
[b7d3cc34]315fi
316
317if [ "$jabber" = 0 ]; then
318        echo '#undef WITH_JABBER' >> config.h
319else
320        echo '#define WITH_JABBER' >> config.h
321        protocols=$protocols'jabber '
[b5a22e3]322        protoobjs=$protoobjs'jabber_mod.o '
[b7d3cc34]323fi
324
325if [ "$oscar" = 0 ]; then
326        echo '#undef WITH_OSCAR' >> config.h
327else
328        echo '#define WITH_OSCAR' >> config.h
329        protocols=$protocols'oscar '
[b5a22e3]330        protoobjs=$protoobjs'oscar_mod.o '
[b7d3cc34]331fi
332
333if [ "$yahoo" = 0 ]; then
334        echo '#undef WITH_YAHOO' >> config.h
335else
336        echo '#define WITH_YAHOO' >> config.h
337        protocols=$protocols'yahoo '
[b5a22e3]338        protoobjs=$protoobjs'yahoo_mod.o '
[b7d3cc34]339fi
340
341if [ "$protocols" = "PROTOCOLS = " ]; then
342        echo "WARNING: You haven't selected any communication protocol to compile!"
343        echo "         Bitlbee will run, but you will be unable to connect to IM servers!"
344fi
345
346echo "PROTOCOLS = $protocols" >> Makefile.settings
347echo "PROTOOBJS = $protoobjs" >> Makefile.settings
348
349echo Architecture: $arch
350case "$arch" in
351Linux )
352;;
353GNU/* )
354;;
355*BSD )
356        echo 'EFLAGS+=-liconv' >> Makefile.settings;
357;;
358SunOS )
359        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
360        echo 'STRIP=\# skip strip' >> Makefile.settings
361        echo 'EFLAGS+=-liconv' >> Makefile.settings;
362;;
363Darwin )
364        echo 'EFLAGS+=-liconv' >> Makefile.settings;
365;;
366IRIX )
367;;
368CYGWIN* )
369        echo 'Cygwin is not officially supported.'
370;;
371* )
[8d6c4b1]372        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
373        echo 'Please report any problems at http://bugs.bitlbee.org/.'
[b7d3cc34]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
[e5663e0]396#if [ "$flood" = "0" ]; then
397#       echo '  Flood protection disabled.';
398#else
399#       echo '  Flood protection enabled.';
400#fi
[b7d3cc34]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.