source: configure @ c2ee85c

Last change on this file since c2ee85c was 85cf37f, checked in by Wilmer van der Gaast <wilmer@…>, at 2006-05-14T10:32:21Z

Added --events= flag to configure.

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