source: configure @ 9779c18

Last change on this file since 9779c18 was 9779c18, checked in by Jelmer Vernooij <jelmer@…>, at 2006-06-03T20:20:43Z

[merge] Wilmer

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