source: configure @ 1705ec3

Last change on this file since 1705ec3 was b1bd100, checked in by Jelmer Vernooij <jelmer@…>, at 2006-05-25T16:09:15Z

[merge] integration

  • Property mode set to 100755
File size: 10.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/'
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, sspi, 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
165GLIB=0
166
167if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
168        cat<<EOF>>Makefile.settings
169EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
170CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
171EOF
172        echo '#define GLIB2' >> config.h
173        GLIB=2
174elif type glib-config > /dev/null 2> /dev/null; then
175        cat<<EOF>>Makefile.settings
176EFLAGS+=`glib-config --libs`
177CFLAGS+=`glib-config --cflags`
178EOF
179        echo '#define GLIB1' >> config.h
180        GLIB=1
181else
182        echo 'Cannot find glib development libraries, aborting. (Install libglib-dev?)'
183        exit 1;
184fi
185
186if [ GLIB = 1 -o -r /usr/include/iconv.h ]; then
187        :;
188elif [ -r /usr/local/include/iconv.h ]; then
189        echo CFLAGS+=-I/usr/local/include >> Makefile.settings;
190else
191        echo
192        echo 'Warning: Could not find iconv.h, you might have to install it and/or modify'
193        echo 'Makefile.settings to tell where this file is.';
194fi
195
196
197detect_gnutls()
198{
199        if libgnutls-config --version > /dev/null 2> /dev/null; then
200                cat <<EOF>>Makefile.settings
201EFLAGS+=`libgnutls-config --libs`
202CFLAGS+=`libgnutls-config --cflags`
203EOF
204               
205                ssl=gnutls
206                ret=1;
207        else
208                ret=0;
209        fi;
210}
211
212detect_nss()
213{
214        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
215                cat<<EOF>>Makefile.settings
216EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
217CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
218EOF
219               
220                ssl=nss
221                ret=1;
222        else
223                ret=0;
224        fi;
225}
226
227if [ "$msn" = 1 -o "$jabber" = 1 ]; then
228        if [ "$ssl" = "auto" ]; then
229                detect_gnutls
230                if [ "$ret" = "0" ]; then
231                        detect_nss
232                fi;
233        elif [ "$ssl" = "gnutls" ]; then
234                detect_gnutls;
235        elif [ "$ssl" = "nss" ]; then
236                detect_nss;
237        elif [ "$ssl" = "sspi" ]; then
238                echo
239        elif [ "$ssl" = "openssl" ]; then
240                echo
241                echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
242                echo 'install of OpenSSL (including devel/header files) before reporting'
243                echo 'compilation problems.'
244                echo
245                echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
246                echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
247                echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
248                echo 'part of the operating system, which makes it GPL-compatible.'
249                echo
250                echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
251                echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
252                echo
253                echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
254                echo 'probably illegal. If you want to create and distribute a binary BitlBee'
255                echo 'package, you really should use GnuTLS or NSS instead.'
256                echo
257                echo 'Also, the OpenSSL license requires us to say this:'
258                echo ' *    "This product includes software developed by the OpenSSL Project'
259                echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
260               
261                echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
262               
263                ret=1;
264        elif [ "$ssl" = "bogus" ]; then
265                echo
266                echo 'Using bogus SSL code. This will not make the MSN module work, but it will'
267                echo 'allow you to use the Jabber module - although without working SSL support.'
268               
269                ret=1;
270        else
271                echo
272                echo 'ERROR: Unknown SSL library specified.'
273                exit 1;
274        fi
275       
276        if [ "$ret" = "0" ]; then
277                echo
278                echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
279                echo '       This is necessary for MSN and full Jabber support. To continue,'
280                echo '       install a suitable SSL library or disable MSN support (--msn=0).'
281                echo '       If you want Jabber without SSL support you can try --ssl=bogus.'
282               
283                exit 1;
284        fi;
285       
286        echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
287fi
288
289if [ "$strip" = 0 ]; then
290        echo "STRIP=\# skip strip" >> Makefile.settings;
291else
292        if [ "$debug" = 1 ]; then
293                echo
294                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
295                echo 'STRIP=\# skip strip' >> Makefile.settings
296                strip=0;
297        elif [ -n "$STRIP" ]; then
298                echo "STRIP=$STRIP" >> Makefile.settings;
299        elif type strip > /dev/null 2> /dev/null; then
300                echo "STRIP=strip" >> Makefile.settings;
301        elif /bin/test -x /usr/ccs/bin/strip; then
302                echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
303        else
304                echo
305                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
306                echo 'STRIP=\# skip strip' >> Makefile.settings
307                strip=0;
308        fi;
309fi
310
311echo
312if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
313        nick=`bzr nick`
314        if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
315                nick="-$nick"
316        else
317                nick=""
318        fi
319        rev=`bzr revno`
320        echo 'Using bzr revision #'$rev' as version number'
321        BITLBEE_VERSION=\"bzr$nick-$rev\"
322fi
323
324if [ -n "$BITLBEE_VERSION" ]; then
325        echo 'Spoofing version number: '$BITLBEE_VERSION
326        echo '#undef BITLBEE_VERSION' >> config.h
327        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
328        echo
329fi
330
331cat <<EOF>bitlbee.pc
332prefix=$prefix
333includedir=$includedir
334
335Name: bitlbee
336Description: IRC to IM gateway
337Requires: glib-2.0
338Version: $BITLBEE_VERSION
339Libs:
340Cflags: -I\${includedir}
341
342EOF
343
344protocols=''
345protoobjs=''
346
347if [ "$msn" = 0 ]; then
348        echo '#undef WITH_MSN' >> config.h
349else
350        echo '#define WITH_MSN' >> config.h
351        protocols=$protocols'msn '
352        protoobjs=$protoobjs'msn_mod.o '
353fi
354
355if [ "$jabber" = 0 ]; then
356        echo '#undef WITH_JABBER' >> config.h
357else
358        echo '#define WITH_JABBER' >> config.h
359        protocols=$protocols'jabber '
360        protoobjs=$protoobjs'jabber_mod.o '
361fi
362
363if [ "$oscar" = 0 ]; then
364        echo '#undef WITH_OSCAR' >> config.h
365else
366        echo '#define WITH_OSCAR' >> config.h
367        protocols=$protocols'oscar '
368        protoobjs=$protoobjs'oscar_mod.o '
369fi
370
371if [ "$yahoo" = 0 ]; then
372        echo '#undef WITH_YAHOO' >> config.h
373else
374        echo '#define WITH_YAHOO' >> config.h
375        protocols=$protocols'yahoo '
376        protoobjs=$protoobjs'yahoo_mod.o '
377fi
378
379if [ "$protocols" = "PROTOCOLS = " ]; then
380        echo "WARNING: You haven't selected any communication protocol to compile!"
381        echo "         Bitlbee will run, but you will be unable to connect to IM servers!"
382fi
383
384echo "PROTOCOLS = $protocols" >> Makefile.settings
385echo "PROTOOBJS = $protoobjs" >> Makefile.settings
386
387echo Architecture: $arch
388case "$arch" in
389Linux )
390;;
391GNU/* )
392;;
393*BSD )
394        echo 'EFLAGS+=-liconv' >> Makefile.settings;
395;;
396SunOS )
397        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
398        echo 'STRIP=\# skip strip' >> Makefile.settings
399        echo 'EFLAGS+=-liconv' >> Makefile.settings;
400;;
401Darwin )
402        echo 'EFLAGS+=-liconv' >> Makefile.settings;
403;;
404IRIX )
405;;
406CYGWIN* )
407        echo 'Cygwin is not officially supported.'
408;;
409* )
410        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
411        echo 'Please report any problems at http://bugs.bitlbee.org/.'
412;;
413esac
414
415echo
416echo 'Configuration done:'
417
418if [ "$debug" = "1" ]; then
419        echo '  Debugging enabled.';
420else
421        echo '  Debugging disabled.';
422fi
423
424if [ "$strip" = "1" ]; then
425        echo '  Binary stripping enabled.';
426else
427        echo '  Binary stripping disabled.';
428fi
429
430if [ "$msn" = "1" ]; then
431        echo '  Using SSL library: '$ssl;
432fi
433
434#if [ "$flood" = "0" ]; then
435#       echo '  Flood protection disabled.';
436#else
437#       echo '  Flood protection enabled.';
438#fi
439
440if [ -n "$protocols" ]; then
441        echo '  Building with these protocols:' $protocols;
442else
443        echo '  Building without IM-protocol support. We wish you a lot of fun...';
444fi
Note: See TracBrowser for help on using the repository browser.