source: configure @ 9a1555d

Last change on this file since 9a1555d was 6dff9d4, checked in by Jelmer Vernooij <jelmer@…>, at 2006-03-01T21:08:03Z

Also listen for admin connections on a unix domain socket at /var/run/bitlbee

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