source: configure @ a312b6b

Last change on this file since a312b6b was 4ff0966, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-05-28T23:13:47Z

Merging from main/jelmer.

  • Property mode set to 100755
File size: 10.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/'
16plugindir='$prefix/lib/bitlbee/'
17includedir='$prefix/include/bitlbee/'
18libevent='/usr/'
19pidfile='/var/run/bitlbee.pid'
20ipcsocket='/var/run/bitlbee'
21pcdir='$prefix/lib/pkgconfig'
22
23msn=1
24jabber=1
25oscar=1
26yahoo=1
27
28debug=0
29strip=1
30ipv6=1
31
32events=glib
33ssl=auto
34
35arch=`uname -s`
36cpu=`uname -m`
37
38echo BitlBee configure
39
40while [ -n "$1" ]; do
41        e="`expr "X$1" : 'X--\(.*=.*\)'`"
42        if [ -z "$e" ]; then
43                cat<<EOF
44
45Usage: $0 [OPTIONS]
46
47Option          Description                             Default
48
49--prefix=...    Directories to put files in             $prefix
50--bindir=...                                            $bindir
51--etcdir=...                                            $etcdir
52--mandir=...                                            $mandir
53--datadir=...                                           $datadir
54--plugindir=...                                         $plugindir
55--pidfile=...                                           $pidfile
56--config=...                                            $config
57--ipcsocket=...                                         $ipcsocket
58
59--msn=0/1       Disable/enable MSN part                 $msn
60--jabber=0/1    Disable/enable Jabber part              $jabber
61--oscar=0/1     Disable/enable Oscar part (ICQ, AIM)    $oscar
62--yahoo=0/1     Disable/enable Yahoo part               $yahoo
63
64--debug=0/1     Disable/enable debugging                $debug
65--strip=0/1     Disable/enable binary stripping         $strip
66
67--ipv6=0/1      IPv6 socket support                     $ipv6
68
69--events=...    Event handler (glib, libevent)          $events
70--ssl=...       SSL library to use (gnutls, nss, openssl, bogus, auto)
71                                                        $ssl
72EOF
73                exit;
74        fi
75        eval "$e"
76        shift;
77done
78
79# Expand $prefix and get rid of double slashes
80bindir=`eval echo "$bindir/" | sed 's/\/\{1,\}/\//g'`
81etcdir=`eval echo "$etcdir/" | sed 's/\/\{1,\}/\//g'`
82mandir=`eval echo "$mandir/" | sed 's/\/\{1,\}/\//g'`
83datadir=`eval echo "$datadir/" | sed 's/\/\{1,\}/\//g'`
84config=`eval echo "$config/" | sed 's/\/\{1,\}/\//g'`
85plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
86includedir=`eval echo "$includedir"/ | sed 's/\/\{1,\}/\//g'`
87libevent=`eval echo "$libevent"/ | sed 's/\/\{1,\}/\//g'`
88
89pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
90ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
91pcdir=`eval echo "$pcdir" | sed 's/\/\{1,\}/\//g'`
92
93cat<<EOF>Makefile.settings
94## BitlBee settings, generated by configure
95PREFIX=$prefix
96BINDIR=$bindir
97ETCDIR=$etcdir
98MANDIR=$mandir
99DATADIR=$datadir
100PLUGINDIR=$plugindir
101CONFIG=$config
102IPCSOCKET=$ipcsocket
103INCLUDEDIR=$includedir
104PCDIR=$pcdir
105
106ARCH=$arch
107CPU=$cpu
108OUTFILE=bitlbee
109
110DESTDIR=
111LFLAGS=
112EFLAGS=
113EOF
114
115cat<<EOF>config.h
116/* BitlBee settings, generated by configure
117   
118   Do *NOT* use any of these defines in your code without thinking twice, most
119   of them can/will be overridden at run-time */
120
121#define CONFIG "$config"
122#define ETCDIR "$etcdir"
123#define VARDIR "$datadir"
124#define PLUGINDIR "$plugindir"
125#define PIDFILE "$pidfile"
126#define IPCSOCKET "$ipcsocket"
127#define ARCH "$arch"
128#define CPU "$cpu"
129EOF
130
131if [ "$ipv6" = "1" ]; then
132        echo '#define IPV6' >> config.h
133fi
134
135if [ "$debug" = "1" ]; then
136        echo 'CFLAGS=-g' >> Makefile.settings
137        echo 'DEBUG=1' >> Makefile.settings
138        echo '#define DEBUG' >> config.h
139else
140        echo 'CFLAGS=-O3' >> Makefile.settings
141fi
142
143echo CFLAGS+=-I`pwd` -I`pwd`/protocols -I. >> Makefile.settings
144
145echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
146
147if [ -n "$CC" ]; then
148        echo "CC=$CC" >> Makefile.settings;
149elif type gcc > /dev/null 2> /dev/null; then
150        echo "CC=gcc" >> Makefile.settings;
151elif type cc > /dev/null 2> /dev/null; then
152        echo "CC=cc" >> Makefile.settings;
153else
154        echo 'Cannot find a C compiler, aborting.'
155        exit 1;
156fi
157
158if [ -n "$LD" ]; then
159        echo "LD=$LD" >> Makefile.settings;
160elif type ld > /dev/null 2> /dev/null; then
161        echo "LD=ld" >> Makefile.settings;
162else
163        echo 'Cannot find ld, aborting.'
164        exit 1;
165fi
166
167if [ -z "$PKG_CONFIG" ]; then
168        PKG_CONFIG=pkg-config
169fi
170
171if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG glib-2.0; then
172        cat<<EOF>>Makefile.settings
173EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
174CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
175EOF
176else
177        echo 'Cannot find glib2 development libraries, aborting. (Install libglib2-dev?)'
178        exit 1;
179fi
180
181if [ "$events" = "libevent" ]; then
182        if ! [ -e "${libevent}include/event.h" ]; then
183                echo
184                echo 'Warning: Could not find event.h, you might have to install it and/or specify'
185                echo 'its location using the --libevent= argument. (Example: If event.h is in'
186                echo '/usr/local/include and binaries are in /usr/local/lib: --libevent=/usr/local)'
187        fi
188       
189        echo '#define EVENTS_LIBEVENT' >> config.h
190        cat <<EOF>>Makefile.settings
191EFLAGS+=-levent -L${libevent}lib
192CFLAGS+=-I${libevent}include
193EOF
194elif [ "$events" = "glib" ]; then
195        ## We already use glib anyway, so this is all we need (and in fact not even this, but just to be sure...):
196        echo '#define EVENTS_GLIB' >> config.h
197else
198        echo
199        echo 'ERROR: Unknown event handler specified.'
200        exit 1
201fi
202echo 'EVENT_HANDLER=events_'$events'.o' >> Makefile.settings
203
204detect_gnutls()
205{
206        if libgnutls-config --version > /dev/null 2> /dev/null; then
207                cat <<EOF>>Makefile.settings
208EFLAGS+=`libgnutls-config --libs`
209CFLAGS+=`libgnutls-config --cflags`
210EOF
211               
212                ssl=gnutls
213                ret=1;
214        else
215                ret=0;
216        fi;
217}
218
219detect_nss()
220{
221        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
222                cat<<EOF>>Makefile.settings
223EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
224CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
225EOF
226               
227                ssl=nss
228                ret=1;
229        else
230                ret=0;
231        fi;
232}
233
234if [ "$msn" = 1 -o "$jabber" = 1 ]; then
235        if [ "$ssl" = "auto" ]; then
236                detect_gnutls
237                if [ "$ret" = "0" ]; then
238                        detect_nss
239                fi;
240        elif [ "$ssl" = "gnutls" ]; then
241                detect_gnutls;
242        elif [ "$ssl" = "nss" ]; then
243                detect_nss;
244        elif [ "$ssl" = "openssl" ]; then
245                echo
246                echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
247                echo 'install of OpenSSL (including devel/header files) before reporting'
248                echo 'compilation problems.'
249                echo
250                echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
251                echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
252                echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
253                echo 'part of the operating system, which makes it GPL-compatible.'
254                echo
255                echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
256                echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
257                echo
258                echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
259                echo 'probably illegal. If you want to create and distribute a binary BitlBee'
260                echo 'package, you really should use GnuTLS or NSS instead.'
261                echo
262                echo 'Also, the OpenSSL license requires us to say this:'
263                echo ' *    "This product includes software developed by the OpenSSL Project'
264                echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
265               
266                echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
267               
268                ret=1;
269        elif [ "$ssl" = "bogus" ]; then
270                echo
271                echo 'Using bogus SSL code. This will not make the MSN module work, but it will'
272                echo 'allow you to use the Jabber module - although without working SSL support.'
273               
274                ret=1;
275        else
276                echo
277                echo 'ERROR: Unknown SSL library specified.'
278                exit 1;
279        fi
280       
281        if [ "$ret" = "0" ]; then
282                echo
283                echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
284                echo '       This is necessary for MSN and full Jabber support. To continue,'
285                echo '       install a suitable SSL library or disable MSN support (--msn=0).'
286                echo '       If you want Jabber without SSL support you can try --ssl=bogus.'
287               
288                exit 1;
289        fi;
290       
291        echo 'SSL_CLIENT=ssl_'$ssl'.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
432echo '  Using event handler: '$events;
433echo '  Using SSL library: '$ssl;
434
435#if [ "$flood" = "0" ]; then
436#       echo '  Flood protection disabled.';
437#else
438#       echo '  Flood protection enabled.';
439#fi
440
441if [ -n "$protocols" ]; then
442        echo '  Building with these protocols:' $protocols;
443else
444        echo '  Building without IM-protocol support. We wish you a lot of fun...';
445fi
Note: See TracBrowser for help on using the repository browser.