source: configure @ a4dc9f7

Last change on this file since a4dc9f7 was a4dc9f7, checked in by Jelmer Vernooij <jelmer@…>, at 2006-03-01T22:48:37Z

[merge] Wilmer

  • Property mode set to 100755
File size: 10.1 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'
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
49--plugindir=...                                         $plugindir
50--pidfile=...                                           $pidfile
51--config=...                                            $config
52--ipcsocket=...                                         $ipcsocket
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, sspi, 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'`
79plugindir=`eval echo "$plugindir/" | sed 's/\/\{1,\}/\//g'`
80pidfile=`eval echo "$pidfile" | sed 's/\/\{1,\}/\//g'`
81ipcsocket=`eval echo "$ipcsocket" | sed 's/\/\{1,\}/\//g'`
82
83cat<<EOF>Makefile.settings
84## BitlBee settings, generated by configure
85PREFIX=$prefix
86BINDIR=$bindir
87ETCDIR=$etcdir
88MANDIR=$mandir
89DATADIR=$datadir
90PLUGINDIR=$plugindir
91CONFIG=$config
92IPCSOCKET=$ipcsocket
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"
112#define PLUGINDIR "$plugindir"
113#define PIDFILE "$pidfile"
114#define IPCSOCKET "$ipcsocket"
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
133echo CFLAGS+=-DHAVE_CONFIG_H >> Makefile.settings
134
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
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
160        cat<<EOF>>Makefile.settings
161EFLAGS+=`$PKG_CONFIG --libs glib-2.0 gmodule-2.0`
162CFLAGS+=`$PKG_CONFIG --cflags glib-2.0 gmodule-2.0`
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{
204        if $PKG_CONFIG --version > /dev/null 2>/dev/null && $PKG_CONFIG mozilla-nss; then
205                cat<<EOF>>Makefile.settings
206EFLAGS+=`$PKG_CONFIG --libs mozilla-nss`
207CFLAGS+=`$PKG_CONFIG --cflags mozilla-nss`
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" = "sspi" ]; then
228                echo
229        elif [ "$ssl" = "openssl" ]; then
230                echo
231                echo 'No detection code exists for OpenSSL. Make sure that you have a complete'
232                echo 'install of OpenSSL (including devel/header files) before reporting'
233                echo 'compilation problems.'
234                echo
235                echo 'Also, keep in mind that the OpenSSL is, according to some people, not'
236                echo 'completely GPL-compatible. Using GnuTLS or NSS is recommended and better'
237                echo 'supported by us. However, on many BSD machines, OpenSSL can be considered'
238                echo 'part of the operating system, which makes it GPL-compatible.'
239                echo
240                echo 'For more info, see: http://www.openssl.org/support/faq.html#LEGAL2'
241                echo '                    http://www.gnome.org/~markmc/openssl-and-the-gpl.html'
242                echo
243                echo 'Please note that distributing a BitlBee binary which links to OpenSSL is'
244                echo 'probably illegal. If you want to create and distribute a binary BitlBee'
245                echo 'package, you really should use GnuTLS or NSS instead.'
246                echo
247                echo 'Also, the OpenSSL license requires us to say this:'
248                echo ' *    "This product includes software developed by the OpenSSL Project'
249                echo ' *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"'
250               
251                echo 'EFLAGS+=-lssl -lcrypto' >> Makefile.settings
252               
253                ret=1;
254        elif [ "$ssl" = "bogus" ]; then
255                echo
256                echo 'Using bogus SSL code. This will not make the MSN module work, but it will'
257                echo 'allow you to use the Jabber module - although without working SSL support.'
258               
259                ret=1;
260        else
261                echo
262                echo 'ERROR: Unknown SSL library specified.'
263                exit 1;
264        fi
265       
266        if [ "$ret" = "0" ]; then
267                echo
268                echo 'ERROR: Could not find a suitable SSL library (GnuTLS, libnss or OpenSSL).'
269                echo '       This is necessary for MSN and full Jabber support. To continue,'
270                echo '       install a suitable SSL library or disable MSN support (--msn=0).'
271                echo '       If you want Jabber without SSL support you can try --ssl=bogus.'
272               
273                exit 1;
274        fi;
275       
276        echo 'SSL_CLIENT=ssl_'$ssl'.o' >> Makefile.settings
277fi
278
279if [ "$strip" = 0 ]; then
280        echo "STRIP=\# skip strip" >> Makefile.settings;
281else
282        if [ "$debug" = 1 ]; then
283                echo
284                echo 'Stripping binaries does not make sense when debugging. Stripping disabled.'
285                echo 'STRIP=\# skip strip' >> Makefile.settings
286                strip=0;
287        elif [ -n "$STRIP" ]; then
288                echo "STRIP=$STRIP" >> Makefile.settings;
289        elif type strip > /dev/null 2> /dev/null; then
290                echo "STRIP=strip" >> Makefile.settings;
291        elif /bin/test -x /usr/ccs/bin/strip; then
292                echo "STRIP=/usr/ccs/bin/strip" >> Makefile.settings;
293        else
294                echo
295                echo 'No strip utility found, cannot remove unnecessary parts from executable.'
296                echo 'STRIP=\# skip strip' >> Makefile.settings
297                strip=0;
298        fi;
299fi
300
301echo
302if [ -z "$BITLBEE_VERSION" -a -d .bzr -a -x "`which bzr`" ]; then
303        rev=`bzr revno`
304        echo 'Using bzr revision #'$rev' as version number'
305        BITLBEE_VERSION=\"bzr-$rev\"
306fi
307
308if [ -n "$BITLBEE_VERSION" ]; then
309        echo 'Spoofing version number: '$BITLBEE_VERSION
310        echo '#undef BITLBEE_VERSION' >> config.h
311        echo '#define BITLBEE_VERSION '$BITLBEE_VERSION >> config.h
312        echo
313fi
314
315protocols=''
316protoobjs=''
317
318if [ "$msn" = 0 ]; then
319        echo '#undef WITH_MSN' >> config.h
320else
321        echo '#define WITH_MSN' >> config.h
322        protocols=$protocols'msn '
323        protoobjs=$protoobjs'msn_mod.o '
324fi
325
326if [ "$jabber" = 0 ]; then
327        echo '#undef WITH_JABBER' >> config.h
328else
329        echo '#define WITH_JABBER' >> config.h
330        protocols=$protocols'jabber '
331        protoobjs=$protoobjs'jabber_mod.o '
332fi
333
334if [ "$oscar" = 0 ]; then
335        echo '#undef WITH_OSCAR' >> config.h
336else
337        echo '#define WITH_OSCAR' >> config.h
338        protocols=$protocols'oscar '
339        protoobjs=$protoobjs'oscar_mod.o '
340fi
341
342if [ "$yahoo" = 0 ]; then
343        echo '#undef WITH_YAHOO' >> config.h
344else
345        echo '#define WITH_YAHOO' >> config.h
346        protocols=$protocols'yahoo '
347        protoobjs=$protoobjs'yahoo_mod.o '
348fi
349
350if [ "$protocols" = "PROTOCOLS = " ]; then
351        echo "WARNING: You haven't selected any communication protocol to compile!"
352        echo "         Bitlbee will run, but you will be unable to connect to IM servers!"
353fi
354
355echo "PROTOCOLS = $protocols" >> Makefile.settings
356echo "PROTOOBJS = $protoobjs" >> Makefile.settings
357
358echo Architecture: $arch
359case "$arch" in
360Linux )
361;;
362GNU/* )
363;;
364*BSD )
365        echo 'EFLAGS+=-liconv' >> Makefile.settings;
366;;
367SunOS )
368        echo 'EFLAGS+=-lresolv -lnsl -lsocket' >> Makefile.settings
369        echo 'STRIP=\# skip strip' >> Makefile.settings
370        echo 'EFLAGS+=-liconv' >> Makefile.settings;
371;;
372Darwin )
373        echo 'EFLAGS+=-liconv' >> Makefile.settings;
374;;
375IRIX )
376;;
377CYGWIN* )
378        echo 'Cygwin is not officially supported.'
379;;
380* )
381        echo 'We haven'\''t tested BitlBee on many platforms yet, yours is untested. YMMV.'
382        echo 'Please report any problems at http://bugs.bitlbee.org/.'
383;;
384esac
385
386echo
387echo 'Configuration done:'
388
389if [ "$debug" = "1" ]; then
390        echo '  Debugging enabled.';
391else
392        echo '  Debugging disabled.';
393fi
394
395if [ "$strip" = "1" ]; then
396        echo '  Binary stripping enabled.';
397else
398        echo '  Binary stripping disabled.';
399fi
400
401if [ "$msn" = "1" ]; then
402        echo '  Using SSL library: '$ssl;
403fi
404
405#if [ "$flood" = "0" ]; then
406#       echo '  Flood protection disabled.';
407#else
408#       echo '  Flood protection enabled.';
409#fi
410
411if [ -n "$protocols" ]; then
412        echo '  Building with these protocols:' $protocols;
413else
414        echo '  Building without IM-protocol support. We wish you a lot of fun...';
415fi
Note: See TracBrowser for help on using the repository browser.