source: configure @ b4e4b95

Last change on this file since b4e4b95 was 574af7e, checked in by Jelmer Vernooij <jelmer@…>, at 2006-05-25T23:20:54Z

Require GLib 2

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